use super::AdjustPrecision;
use bevy_math::*;
pub type Scalar = f32;
pub const FRAC_PI_2: Scalar = std::f32::consts::FRAC_PI_2;
pub const PI: Scalar = std::f32::consts::PI;
pub const TAU: Scalar = std::f32::consts::TAU;
pub const FRAC_1_SQRT_2: Scalar = std::f32::consts::FRAC_1_SQRT_2;
#[cfg(feature = "2d")]
pub type Vector = Vec2;
#[cfg(feature = "3d")]
pub type Vector = Vec3;
pub type Vector2 = Vec2;
pub type Vector3 = Vec3;
#[cfg(feature = "2d")]
pub type Matrix = Mat2;
#[cfg(feature = "3d")]
pub type Matrix = Mat3;
pub type Matrix2 = Mat2;
pub type Matrix3 = Mat3;
pub type Quaternion = Quat;
impl AdjustPrecision for f32 {
type Adjusted = Scalar;
fn adjust_precision(&self) -> Self::Adjusted {
*self as Scalar
}
}
impl AdjustPrecision for f64 {
type Adjusted = Scalar;
fn adjust_precision(&self) -> Self::Adjusted {
*self as Scalar
}
}
impl AdjustPrecision for Vec3 {
type Adjusted = Vector3;
fn adjust_precision(&self) -> Self::Adjusted {
*self
}
}
impl AdjustPrecision for DVec3 {
type Adjusted = Vector3;
fn adjust_precision(&self) -> Self::Adjusted {
self.as_vec3()
}
}
impl AdjustPrecision for Vec2 {
type Adjusted = Vector2;
fn adjust_precision(&self) -> Self::Adjusted {
*self
}
}
impl AdjustPrecision for DVec2 {
type Adjusted = Vector2;
fn adjust_precision(&self) -> Self::Adjusted {
self.as_vec2()
}
}
impl AdjustPrecision for Quat {
type Adjusted = Quaternion;
fn adjust_precision(&self) -> Self::Adjusted {
*self
}
}
impl AdjustPrecision for DQuat {
type Adjusted = Quaternion;
fn adjust_precision(&self) -> Self::Adjusted {
self.as_quat()
}
}
impl AdjustPrecision for Mat3 {
type Adjusted = Matrix3;
fn adjust_precision(&self) -> Self::Adjusted {
*self
}
}
impl AdjustPrecision for DMat3 {
type Adjusted = Matrix3;
fn adjust_precision(&self) -> Self::Adjusted {
self.as_mat3()
}
}