
# Objective A Bezier curve is a curve defined by two or more control points. In the simplest form, it's just a line. The (arguably) most common type of Bezier curve is a cubic Bezier, defined by four control points. These are often used in animation, etc. Bevy has a Bezier curve struct called `Bezier`. However, this is technically a misnomer as it only represents cubic Bezier curves. ## Solution This PR changes the struct name to `CubicBezier` to more accurately reflect the struct's usage. Since it's exposed in Bevy's prelude, it can potentially collide with other `Bezier` implementations. While that might instead be an argument for removing it from the prelude, there's also something to be said for adding a more general `Bezier` into Bevy, in which case we'd likely want to use the name `Bezier`. As a final motivator, not only is the struct located in `cubic_spines.rs`, there are also several other spline-related structs which follow the `CubicXxx` naming convention where applicable. For example, `CubicSegment` represents a cubic Bezier curve (with coefficients pre-baked). --- ## Migration Guide - Change all `Bezier` references to `CubicBezier`
33 lines
860 B
Rust
33 lines
860 B
Rust
//! 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`].
|
|
|
|
#![allow(clippy::type_complexity)]
|
|
#![warn(missing_docs)]
|
|
|
|
mod affine3;
|
|
pub mod cubic_splines;
|
|
mod ray;
|
|
mod rects;
|
|
|
|
pub use affine3::*;
|
|
pub use ray::Ray;
|
|
pub use rects::*;
|
|
|
|
/// The `bevy_math` prelude.
|
|
pub mod prelude {
|
|
#[doc(hidden)]
|
|
pub use crate::{
|
|
cubic_splines::{
|
|
BSpline, CardinalSpline, CubicBezier, CubicGenerator, CubicSegment, Hermite,
|
|
},
|
|
BVec2, BVec3, BVec4, EulerRot, IRect, IVec2, IVec3, IVec4, Mat2, Mat3, Mat4, Quat, Ray,
|
|
Rect, URect, UVec2, UVec3, UVec4, Vec2, Vec2Swizzles, Vec3, Vec3Swizzles, Vec4,
|
|
Vec4Swizzles,
|
|
};
|
|
}
|
|
|
|
pub use glam::*;
|