bevy/crates/bevy_math/src
Matty 6c9ec88e54
Basic isometry types (#14269)
# Objective

Introduce isometry types for describing relative and absolute position
in mathematical contexts.

## Solution

For the time being, this is a very minimal implementation. This
implements the following faculties for two- and three-dimensional
isometry types:
- Identity transformations
- Creation from translations and/or rotations
- Inverses
- Multiplication (composition) of isometries with each other
- Application of isometries to points (as vectors)
- Conversion of isometries to affine transformations

There is obviously a lot more that could be added, so I erred on the
side of adding things that I knew would be useful, with the idea of
expanding this in the near future as needed.

(I also fixed some random doc problems in `bevy_math`.)

---

## Design

One point of interest here is the matter of if/when to use aligned
types. In the implementation of 3d isometries, I used `Vec3A` rather
than `Vec3` because it has no impact on size/alignment, but I'm still
not sure about that decision (although it is easily changed).

For 2d isometries — which are encoded by four floats — the idea of
shoving them into a single 128-bit buffer (`__m128` or whatever) sounds
kind of enticing, but it's more involved and would involve writing
unsafe code, so I didn't do that for now.

## Future work

- Expand the API to include shortcuts like `inverse_mul` and
`inverse_transform` for efficiency reasons.
- Include more convenience constructors and methods (e.g. `from_xy`,
`from_xyz`).
- Refactor `bevy_math::bounding` to use the isometry types.
- Add conversions to/from isometries for `Transform`/`GlobalTransform`
in `bevy_transform`.
2024-07-14 15:27:42 +00:00
..
bounding Basic isometry types (#14269) 2024-07-14 15:27:42 +00:00
primitives Updated descriptions for some geometric primitives to include more detail (#13937) 2024-06-20 12:16:27 +00:00
rects Move bevy_math Reflect impls (#13520) 2024-05-27 14:15:22 +00:00
sampling Uniform mesh sampling (#14071) 2024-07-08 00:57:08 +00:00
affine3.rs Implemented Reflect for (almost) all bevy_math types (#13537) 2024-05-27 18:18:10 +00:00
aspect_ratio.rs Implemented Reflect for (almost) all bevy_math types (#13537) 2024-05-27 18:18:10 +00:00
common_traits.rs Make bevy_math::common_traits public (#14245) 2024-07-09 17:16:47 +00:00
compass.rs Fix intra-doc links and make CI test them (#14076) 2024-07-11 13:08:31 +00:00
cubic_splines.rs Fix a few "repeated word" typos (#13955) 2024-06-20 21:35:20 +00:00
direction.rs Rename Rotation2d to Rot2 (#13694) 2024-06-05 21:51:13 +00:00
float_ord.rs Implemented Reflect for (almost) all bevy_math types (#13537) 2024-05-27 18:18:10 +00:00
isometry.rs Basic isometry types (#14269) 2024-07-14 15:27:42 +00:00
lib.rs Basic isometry types (#14269) 2024-07-14 15:27:42 +00:00
ray.rs Implemented Reflect for (almost) all bevy_math types (#13537) 2024-05-27 18:18:10 +00:00
rotation2d.rs Rename Rotation2d to Rot2 (#13694) 2024-06-05 21:51:13 +00:00