Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/crates/bevy_math/src/lib.rs
6595 views
1
#![forbid(unsafe_code)]
2
#![cfg_attr(
3
any(docsrs, docsrs_dep),
4
expect(
5
internal_features,
6
reason = "rustdoc_internals is needed for fake_variadic"
7
)
8
)]
9
#![cfg_attr(any(docsrs, docsrs_dep), feature(rustdoc_internals))]
10
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
11
#![doc(
12
html_logo_url = "https://bevy.org/assets/icon.png",
13
html_favicon_url = "https://bevy.org/assets/icon.png"
14
)]
15
#![no_std]
16
17
//! Provides math types and functionality for the Bevy game engine.
18
//!
19
//! The commonly used types are vectors like [`Vec2`] and [`Vec3`],
20
//! matrices like [`Mat2`], [`Mat3`] and [`Mat4`] and orientation representations
21
//! like [`Quat`].
22
23
#[cfg(feature = "std")]
24
extern crate std;
25
26
#[cfg(feature = "alloc")]
27
extern crate alloc;
28
29
mod affine3;
30
mod aspect_ratio;
31
pub mod bounding;
32
pub mod common_traits;
33
mod compass;
34
pub mod cubic_splines;
35
mod direction;
36
mod float_ord;
37
mod isometry;
38
pub mod ops;
39
pub mod primitives;
40
mod ray;
41
mod rects;
42
mod rotation2d;
43
44
#[cfg(feature = "curve")]
45
pub mod curve;
46
47
#[cfg(feature = "rand")]
48
pub mod sampling;
49
50
pub use affine3::*;
51
pub use aspect_ratio::AspectRatio;
52
pub use common_traits::*;
53
pub use compass::{CompassOctant, CompassQuadrant};
54
pub use direction::*;
55
pub use float_ord::*;
56
pub use isometry::{Isometry2d, Isometry3d};
57
pub use ops::FloatPow;
58
pub use ray::{Ray2d, Ray3d};
59
pub use rects::*;
60
pub use rotation2d::Rot2;
61
62
#[cfg(feature = "curve")]
63
pub use curve::Curve;
64
65
#[cfg(feature = "rand")]
66
pub use sampling::{FromRng, ShapeSample};
67
68
/// The math prelude.
69
///
70
/// This includes the most common types in this crate, re-exported for your convenience.
71
pub mod prelude {
72
#[doc(hidden)]
73
pub use crate::{
74
bvec2, bvec3, bvec3a, bvec4, bvec4a,
75
cubic_splines::{CubicNurbsError, CubicSegment, RationalSegment},
76
direction::{Dir2, Dir3, Dir3A},
77
ivec2, ivec3, ivec4, mat2, mat3, mat3a, mat4, ops,
78
primitives::*,
79
quat, uvec2, uvec3, uvec4, vec2, vec3, vec3a, vec4, BVec2, BVec3, BVec3A, BVec4, BVec4A,
80
EulerRot, FloatExt, IRect, IVec2, IVec3, IVec4, Isometry2d, Isometry3d, Mat2, Mat3, Mat3A,
81
Mat4, Quat, Ray2d, Ray3d, Rect, Rot2, StableInterpolate, URect, UVec2, UVec3, UVec4, Vec2,
82
Vec2Swizzles, Vec3, Vec3A, Vec3Swizzles, Vec4, Vec4Swizzles,
83
};
84
85
#[doc(hidden)]
86
#[cfg(feature = "curve")]
87
pub use crate::curve::*;
88
89
#[doc(hidden)]
90
#[cfg(feature = "rand")]
91
pub use crate::sampling::{FromRng, ShapeSample};
92
93
#[cfg(feature = "alloc")]
94
#[doc(hidden)]
95
pub use crate::cubic_splines::{
96
CubicBSpline, CubicBezier, CubicCardinalSpline, CubicCurve, CubicGenerator, CubicHermite,
97
CubicNurbs, CyclicCubicGenerator, RationalCurve, RationalGenerator,
98
};
99
}
100
101
pub use glam::*;
102
103