#[repr(C)]pub struct Vec2Fix {
pub x: Fix128,
pub y: Fix128,
}Expand description
2D vector using Fix128 components.
Provides full operator overloading, geometric utilities, and deterministic arithmetic for 2D physics simulation.
Fields§
§x: Fix128X component
y: Fix128Y component
Implementations§
Source§impl Vec2Fix
impl Vec2Fix
Sourcepub fn length_squared(self) -> Fix128
pub fn length_squared(self) -> Fix128
Squared length (avoids sqrt).
Sourcepub fn cross_scalar(self, rhs: Self) -> Fix128
pub fn cross_scalar(self, rhs: Self) -> Fix128
2D cross product (returns a scalar: a.x * b.y - a.y * b.x).
This is the z-component of the 3D cross product when both vectors are embedded in the XY plane.
Sourcepub fn rotate(self, angle: Fix128) -> Self
pub fn rotate(self, angle: Fix128) -> Self
Rotate this vector by an angle (radians, counter-clockwise).
Sourcepub fn perpendicular(self) -> Self
pub fn perpendicular(self) -> Self
Return the perpendicular vector (90 degrees counter-clockwise): (-y, x).
Sourcepub fn distance_to(self, other: Self) -> Fix128
pub fn distance_to(self, other: Self) -> Fix128
Distance to another point.
Trait Implementations§
impl Copy for Vec2Fix
impl Eq for Vec2Fix
impl StructuralPartialEq for Vec2Fix
Auto Trait Implementations§
impl Freeze for Vec2Fix
impl RefUnwindSafe for Vec2Fix
impl Send for Vec2Fix
impl Sync for Vec2Fix
impl Unpin for Vec2Fix
impl UnsafeUnpin for Vec2Fix
impl UnwindSafe for Vec2Fix
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more