Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/crates/bevy_math/src/lib.rs
9328 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_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
mod mat3;
39
pub mod ops;
40
pub mod primitives;
41
mod ray;
42
mod rects;
43
mod rotation2d;
44
45
#[cfg(feature = "curve")]
46
pub mod curve;
47
48
#[cfg(feature = "rand")]
49
pub mod sampling;
50
51
pub use affine3::*;
52
pub use aspect_ratio::AspectRatio;
53
pub use common_traits::*;
54
pub use compass::{CompassOctant, CompassQuadrant};
55
pub use direction::*;
56
pub use float_ord::*;
57
pub use isometry::{Isometry2d, Isometry3d};
58
pub use mat3::*;
59
pub use ops::FloatPow;
60
pub use ray::{Ray2d, Ray3d};
61
pub use rects::*;
62
pub use rotation2d::Rot2;
63
64
#[cfg(feature = "curve")]
65
pub use curve::Curve;
66
67
#[cfg(feature = "rand")]
68
pub use sampling::{FromRng, ShapeSample};
69
70
/// The math prelude.
71
///
72
/// This includes the most common types in this crate, re-exported for your convenience.
73
pub mod prelude {
74
#[doc(hidden)]
75
pub use crate::{
76
bvec2, bvec3, bvec3a, bvec4, bvec4a,
77
cubic_splines::{CubicNurbsError, CubicSegment, RationalSegment},
78
direction::{Dir2, Dir3, Dir3A},
79
ivec2, ivec3, ivec4, mat2, mat3, mat3a, mat4, ops,
80
primitives::*,
81
quat, uvec2, uvec3, uvec4, vec2, vec3, vec3a, vec4, BVec2, BVec3, BVec3A, BVec4, BVec4A,
82
EulerRot, FloatExt, IRect, IVec2, IVec3, IVec4, Isometry2d, Isometry3d, Mat2, Mat3, Mat3A,
83
Mat4, Quat, Ray2d, Ray3d, Rect, Rot2, StableInterpolate, URect, UVec2, UVec3, UVec4, Vec2,
84
Vec2Swizzles, Vec3, Vec3A, Vec3Swizzles, Vec4, Vec4Swizzles,
85
};
86
87
#[doc(hidden)]
88
#[cfg(feature = "curve")]
89
pub use crate::curve::*;
90
91
#[doc(hidden)]
92
#[cfg(feature = "rand")]
93
pub use crate::sampling::{FromRng, ShapeSample};
94
95
#[cfg(feature = "alloc")]
96
#[doc(hidden)]
97
pub use crate::cubic_splines::{
98
CubicBSpline, CubicBezier, CubicCardinalSpline, CubicCurve, CubicGenerator, CubicHermite,
99
CubicNurbs, CyclicCubicGenerator, RationalCurve, RationalGenerator,
100
};
101
}
102
103
pub use glam::*;
104
105