use crate::Scalar;
pub type Vec2 = glam::DVec2;
pub type Vec3 = glam::DVec3;
pub type Point2 = Vec2;
pub type Point3 = Vec3;
pub type Mat3 = glam::DMat3;
pub type Transform2 = glam::DAffine2;
pub type Transform3 = glam::DAffine3;
pub type Mat4 = Transform3;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Frame2 {
pub origin: Point2,
pub x: Vec2,
pub y: Vec2,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Frame3 {
pub origin: Point3,
pub x: Vec3,
pub y: Vec3,
pub z: Vec3,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Interval {
pub start: Scalar,
pub end: Scalar,
}
impl Interval {
pub const UNIT: Self = Self {
start: 0.0,
end: 1.0,
};
pub const fn new(start: Scalar, end: Scalar) -> Self {
Self { start, end }
}
pub fn length(self) -> Scalar {
(self.end - self.start).abs()
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Plane3 {
pub origin: Point3,
pub normal: Vec3,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Ray3 {
pub origin: Point3,
pub direction: Vec3,
}