bevy/crates/bevy_math/src
Lynn 03f4cc5dde
Extrusion (#13270)
# Objective

- Adds a basic `Extrusion<T: Primitive2d>` shape, suggestion of #10572 

## Solution

- Adds `Measured2d` and `Measured3d` traits for getting the
perimeter/area or area/volume of shapes. This allows implementing
`.volume()` and `.area()` for all extrusions `Extrusion<T: Primitive2d +
Measured2d>` within `bevy_math`
- All existing perimeter, area and volume implementations for primitves
have been moved into implementations of `Measured2d` and `Measured3d`
- Shapes should be extruded along the Z-axis since an extrusion of depth
`0.` should be equivalent in everything but name to the base shape

## Caviats

- I am not sure about the naming. `Extrusion<T>` could also be
`Prism<T>` and the `MeasuredNd` could also be something like
`MeasuredPrimitiveNd`. If you have any other suggestions, please fell
free to share them :)

## Future work

This PR adds a basic `Extrusion` shape and does not implement a lot of
things you might want it to. Some of the future possibilities include:
- [ ] bounding for extrusions
- [ ] making extrusions work with gizmos
- [ ] meshing

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-05-07 14:41:55 +00:00
..
bounding replace std::f32::EPSILON with f32::EPSILON (#13267) 2024-05-07 05:23:53 +00:00
primitives Extrusion (#13270) 2024-05-07 14:41:55 +00:00
rects Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
sampling Random sampling of directions and quaternions (#12857) 2024-04-04 23:13:00 +00:00
affine3.rs Automatic batching/instancing of draw commands (#9685) 2023-09-21 22:12:34 +00:00
aspect_ratio.rs Implement basic traits for AspectRatio (#12840) 2024-04-01 23:02:07 +00:00
common_traits.rs Remove VectorSpace impl on Quat (#12796) 2024-03-30 17:18:52 +00:00
cubic_splines.rs Fix uses of "it's" vs "its". (#13033) 2024-04-19 18:17:31 +00:00
direction.rs Use Vec3A for 3D bounding volumes and raycasts (#13087) 2024-04-25 18:56:58 +00:00
float_ord.rs Move FloatOrd into bevy_math (#12732) 2024-03-27 18:30:11 +00:00
lib.rs Random sampling of directions and quaternions (#12857) 2024-04-04 23:13:00 +00:00
ray.rs separating finite and infinite 3d planes (#12426) 2024-04-18 14:13:22 +00:00
rotation2d.rs Add Rotation2d (#11658) 2024-03-11 19:11:57 +00:00