Crate bevy_math

Source
Expand description

Provides math types and functionality for the Bevy game engine.

The commonly used types are vectors like Vec2 and Vec3, matrices like Mat2, Mat3 and Mat4 and orientation representations like Quat.

Re-exports§

pub use ops::FloatPow;
pub use curve::Curve;curve
pub use sampling::FromRng;rand
pub use sampling::ShapeSample;rand
pub use common_traits::*;

Modules§

bool
bool vector mask types.
bounding
This module contains traits and implements for working with bounding shapes
common_traits
This module contains abstract mathematical traits shared by types used in bevy_math.
cubic_splines
Provides types for building cubic splines for rendering curves and use with animation easing.
curvecurve
The Curve trait, providing a domain-agnostic description of curves.
f32
f32 vector, quaternion and matrix types.
f64
f64 vector, quaternion and matrix types.
i8
i8 vector types.
i16
i16 vector types.
i32
i32 vector types.
i64
i64 vector types.
ops
This mod re-exports the correct versions of floating-point operations with unspecified precision in the standard library depending on whether the libm crate feature is enabled.
prelude
The math prelude.
primitives
This module defines primitive shapes. The origin is (0, 0) for 2D primitives and (0, 0, 0) for 3D primitives, unless stated otherwise.
samplingrand
This module contains tools related to random sampling.
swizzles
Traits adding swizzle methods to all vector types.
u8
u8 vector types.
u16
u16 vector types.
u32
u32 vector types.
u64
u64 vector types.

Structs§

Affine2
A 2D affine transform, which can represent translation, rotation, scaling and shear.
Affine3
Reduced-size version of glam::Affine3A for use when storage has significant performance impact. Convert to glam::Affine3A to do non-trivial calculations.
Affine3A
A 3D affine transform, which can represent translation, rotation, scaling and shear.
AspectRatio
An AspectRatio is the ratio of width to height.
BVec2
A 2-dimensional bool vector mask.
BVec3
A 3-dimensional bool vector mask.
BVec4
A 4-dimensional bool vector mask.
BVec3A
A 3-dimensional SIMD vector mask.
BVec4A
A 4-dimensional SIMD vector mask.
DAffine2
A 2D affine transform, which can represent translation, rotation, scaling and shear.
DAffine3
A 3D affine transform, which can represent translation, rotation, scaling and shear.
DMat2
A 2x2 column major matrix.
DMat3
A 3x3 column major matrix.
DMat4
A 4x4 column major matrix.
DQuat
A quaternion representing an orientation.
DVec2
A 2-dimensional vector.
DVec3
A 3-dimensional vector.
DVec4
A 4-dimensional vector.
Dir2
A normalized vector pointing in a direction in 2D space
Dir3
A normalized vector pointing in a direction in 3D space
Dir3A
A normalized SIMD vector pointing in a direction in 3D space.
FloatOrd
A wrapper for floats that implements Ord, Eq, and Hash traits.
I8Vec2
A 2-dimensional vector.
I8Vec3
A 3-dimensional vector.
I8Vec4
A 4-dimensional vector.
I16Vec2
A 2-dimensional vector.
I16Vec3
A 3-dimensional vector.
I16Vec4
A 4-dimensional vector.
I64Vec2
A 2-dimensional vector.
I64Vec3
A 3-dimensional vector.
I64Vec4
A 4-dimensional vector.
IRect
A rectangle defined by two opposite corners.
IVec2
A 2-dimensional vector.
IVec3
A 3-dimensional vector.
IVec4
A 4-dimensional vector.
Isometry2d
An isometry in two dimensions, representing a rotation followed by a translation. This can often be useful for expressing relative positions and transformations from one position to another.
Isometry3d
An isometry in three dimensions, representing a rotation followed by a translation. This can often be useful for expressing relative positions and transformations from one position to another.
Mat2
A 2x2 column major matrix.
Mat3
A 3x3 column major matrix.
Mat4
A 4x4 column major matrix.
Mat3A
A 3x3 column major matrix.
Quat
A quaternion representing an orientation.
Ray2d
An infinite half-line starting at origin and going in direction in 2D space.
Ray3d
An infinite half-line starting at origin and going in direction in 3D space.
Rect
A rectangle defined by two opposite corners.
Rot2
A counterclockwise 2D rotation.
U8Vec2
A 2-dimensional vector.
U8Vec3
A 3-dimensional vector.
U8Vec4
A 4-dimensional vector.
U16Vec2
A 2-dimensional vector.
U16Vec3
A 3-dimensional vector.
U16Vec4
A 4-dimensional vector.
U64Vec2
A 2-dimensional vector.
U64Vec3
A 3-dimensional vector.
U64Vec4
A 4-dimensional vector.
URect
A rectangle defined by two opposite corners.
UVec2
A 2-dimensional vector.
UVec3
A 3-dimensional vector.
UVec4
A 4-dimensional vector.
Vec2
A 2-dimensional vector.
Vec3
A 3-dimensional vector.
Vec4
A 4-dimensional vector.
Vec3A
A 3-dimensional vector.

Enums§

CompassOctant
A compass enum with 8 directions.
CompassQuadrant
A compass enum with 4 directions.
EulerRot
Euler rotation sequences.
InvalidDirectionError
An error indicating that a direction is invalid.

Traits§

FloatExt
A trait for extending f32 and f64 with extra methods.
Vec2Swizzles
Vec3Swizzles
Vec4Swizzles

Functions§

bvec2
Creates a 2-dimensional bool vector mask.
bvec3
Creates a 3-dimensional bool vector mask.
bvec4
Creates a 4-dimensional bool vector mask.
bvec3a
Creates a 3-dimensional bool vector mask.
bvec4a
Creates a 4-dimensional bool vector mask.
dmat2
Creates a 2x2 matrix from two column vectors.
dmat3
Creates a 3x3 matrix from three column vectors.
dmat4
Creates a 4x4 matrix from four column vectors.
dquat
Creates a quaternion from x, y, z and w values.
dvec2
Creates a 2-dimensional vector.
dvec3
Creates a 3-dimensional vector.
dvec4
Creates a 4-dimensional vector.
i8vec2
Creates a 2-dimensional vector.
i8vec3
Creates a 3-dimensional vector.
i8vec4
Creates a 4-dimensional vector.
i16vec2
Creates a 2-dimensional vector.
i16vec3
Creates a 3-dimensional vector.
i16vec4
Creates a 4-dimensional vector.
i64vec2
Creates a 2-dimensional vector.
i64vec3
Creates a 3-dimensional vector.
i64vec4
Creates a 4-dimensional vector.
ivec2
Creates a 2-dimensional vector.
ivec3
Creates a 3-dimensional vector.
ivec4
Creates a 4-dimensional vector.
mat2
Creates a 2x2 matrix from two column vectors.
mat3
Creates a 3x3 matrix from three column vectors.
mat4
Creates a 4x4 matrix from four column vectors.
mat3a
Creates a 3x3 matrix from three column vectors.
quat
Creates a quaternion from x, y, z and w values.
u8vec2
Creates a 2-dimensional vector.
u8vec3
Creates a 3-dimensional vector.
u8vec4
Creates a 4-dimensional vector.
u16vec2
Creates a 2-dimensional vector.
u16vec3
Creates a 3-dimensional vector.
u16vec4
Creates a 4-dimensional vector.
u64vec2
Creates a 2-dimensional vector.
u64vec3
Creates a 3-dimensional vector.
u64vec4
Creates a 4-dimensional vector.
uvec2
Creates a 2-dimensional vector.
uvec3
Creates a 3-dimensional vector.
uvec4
Creates a 4-dimensional vector.
vec2
Creates a 2-dimensional vector.
vec3
Creates a 3-dimensional vector.
vec4
Creates a 4-dimensional vector.
vec3a
Creates a 3-dimensional vector.

Type Aliases§

Direction2dDeprecated
A normalized vector pointing in a direction in 2D space
Direction3dDeprecated
A normalized vector pointing in a direction in 3D space