pub trait PointTrait: Clone + PartialEqwhere
Self::PScalar: Real + FromPrimitive + UlpsEq + Debug + Display + PartialEq + MulAssign + SubAssign + DivAssign + AddAssign,{
type PScalar;
const DIMENSION: u8;
// Required methods
fn x(&self) -> Self::PScalar;
fn y(&self) -> Self::PScalar;
fn set_x(&mut self, x: Self::PScalar);
fn set_y(&mut self, y: Self::PScalar);
fn at(&self, index: u8) -> Self::PScalar;
fn at_mut(&mut self, index: u8) -> &mut Self::PScalar;
// Provided method
fn dist_sq<Q: PointTrait<PScalar = Self::PScalar>>(
a: &Self,
b: &Q,
) -> Self::PScalar { ... }
}Required Associated Constants§
Required Associated Types§
Required Methods§
fn x(&self) -> Self::PScalar
fn y(&self) -> Self::PScalar
fn set_x(&mut self, x: Self::PScalar)
fn set_y(&mut self, y: Self::PScalar)
fn at(&self, index: u8) -> Self::PScalar
fn at_mut(&mut self, index: u8) -> &mut Self::PScalar
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl PointTrait for Vector2<f32>
Available on crate features cgmath and vector-traits only.
impl PointTrait for Vector2<f32>
Available on crate features
cgmath and vector-traits only.const DIMENSION: u8 = 2u8
type PScalar = f32
fn x(&self) -> Self::PScalar
fn y(&self) -> Self::PScalar
fn set_x(&mut self, x: Self::PScalar)
fn set_y(&mut self, y: Self::PScalar)
fn at(&self, index: u8) -> Self::PScalar
fn at_mut(&mut self, index: u8) -> &mut Self::PScalar
Source§impl PointTrait for Vector2<f64>
Available on crate features cgmath and vector-traits only.
impl PointTrait for Vector2<f64>
Available on crate features
cgmath and vector-traits only.const DIMENSION: u8 = 2u8
type PScalar = f64
fn x(&self) -> Self::PScalar
fn y(&self) -> Self::PScalar
fn set_x(&mut self, x: Self::PScalar)
fn set_y(&mut self, y: Self::PScalar)
fn at(&self, index: u8) -> Self::PScalar
fn at_mut(&mut self, index: u8) -> &mut Self::PScalar
Source§impl PointTrait for Vec2
Available on crate features glam and vector-traits only.
impl PointTrait for Vec2
Available on crate features
glam and vector-traits only.const DIMENSION: u8 = 2u8
type PScalar = f32
fn x(&self) -> Self::PScalar
fn y(&self) -> Self::PScalar
fn set_x(&mut self, x: Self::PScalar)
fn set_y(&mut self, y: Self::PScalar)
fn at(&self, index: u8) -> Self::PScalar
fn at_mut(&mut self, index: u8) -> &mut Self::PScalar
Source§impl PointTrait for DVec2
Available on crate features glam and vector-traits only.
impl PointTrait for DVec2
Available on crate features
glam and vector-traits only.const DIMENSION: u8 = 2u8
type PScalar = f64
fn x(&self) -> Self::PScalar
fn y(&self) -> Self::PScalar
fn set_x(&mut self, x: Self::PScalar)
fn set_y(&mut self, y: Self::PScalar)
fn at(&self, index: u8) -> Self::PScalar
fn at_mut(&mut self, index: u8) -> &mut Self::PScalar
Source§impl PointTrait for Vec2A
Available on crate features glam and vector-traits only.
impl PointTrait for Vec2A
Available on crate features
glam and vector-traits only.