bevy_math/
lib.rs

1#![forbid(unsafe_code)]
2#![allow(internal_features)]
3#![cfg_attr(any(docsrs, docsrs_dep), feature(rustdoc_internals))]
4#![cfg_attr(docsrs, feature(doc_auto_cfg))]
5#![doc(
6    html_logo_url = "https://bevyengine.org/assets/icon.png",
7    html_favicon_url = "https://bevyengine.org/assets/icon.png"
8)]
9
10//! Provides math types and functionality for the Bevy game engine.
11//!
12//! The commonly used types are vectors like [`Vec2`] and [`Vec3`],
13//! matrices like [`Mat2`], [`Mat3`] and [`Mat4`] and orientation representations
14//! like [`Quat`].
15
16mod affine3;
17mod aspect_ratio;
18pub mod bounding;
19pub mod common_traits;
20mod compass;
21pub mod cubic_splines;
22mod direction;
23mod float_ord;
24mod isometry;
25pub mod ops;
26pub mod primitives;
27mod ray;
28mod rects;
29mod rotation2d;
30
31#[cfg(feature = "curve")]
32pub mod curve;
33
34#[cfg(feature = "rand")]
35pub mod sampling;
36
37pub use affine3::*;
38pub use aspect_ratio::AspectRatio;
39pub use common_traits::*;
40pub use compass::{CompassOctant, CompassQuadrant};
41pub use direction::*;
42pub use float_ord::*;
43pub use isometry::{Isometry2d, Isometry3d};
44pub use ops::FloatPow;
45pub use ray::{Ray2d, Ray3d};
46pub use rects::*;
47pub use rotation2d::Rot2;
48
49#[cfg(feature = "curve")]
50pub use curve::Curve;
51
52#[cfg(feature = "rand")]
53pub use sampling::{FromRng, ShapeSample};
54
55/// The math prelude.
56///
57/// This includes the most common types in this crate, re-exported for your convenience.
58pub mod prelude {
59    #[doc(hidden)]
60    pub use crate::{
61        cubic_splines::{
62            CubicBSpline, CubicBezier, CubicCardinalSpline, CubicCurve, CubicGenerator,
63            CubicHermite, CubicNurbs, CubicNurbsError, CubicSegment, CyclicCubicGenerator,
64            RationalCurve, RationalGenerator, RationalSegment,
65        },
66        direction::{Dir2, Dir3, Dir3A},
67        ops,
68        primitives::*,
69        BVec2, BVec3, BVec4, EulerRot, FloatExt, IRect, IVec2, IVec3, IVec4, Isometry2d,
70        Isometry3d, Mat2, Mat3, Mat4, Quat, Ray2d, Ray3d, Rect, Rot2, StableInterpolate, URect,
71        UVec2, UVec3, UVec4, Vec2, Vec2Swizzles, Vec3, Vec3Swizzles, Vec4, Vec4Swizzles,
72    };
73
74    #[doc(hidden)]
75    #[cfg(feature = "curve")]
76    pub use crate::curve::*;
77
78    #[doc(hidden)]
79    #[cfg(feature = "rand")]
80    pub use crate::sampling::{FromRng, ShapeSample};
81}
82
83pub use glam::*;