Struct pax_runtime_api::math::Vector2
source · pub struct Vector2<W = Generic> {
pub x: f64,
pub y: f64,
/* private fields */
}
Fields§
§x: f64
§y: f64
Implementations§
source§impl<W: Space> Vector2<W>
impl<W: Space> Vector2<W>
pub fn new(x: f64, y: f64) -> Self
pub fn normal(&self) -> Self
pub fn normalize(self) -> Self
pub fn length_squared(&self) -> f64
pub fn length(&self) -> f64
pub fn coord_abs(&self) -> Self
pub fn project_onto(self, axis: Self) -> Self
pub fn project_axis_aligned(self, other: Self) -> Self
sourcepub fn angle_to(self, other: Self) -> Rotation
pub fn angle_to(self, other: Self) -> Rotation
Returns the angle walking from self to other counter clockwise
sourcepub fn cross(self, other: Self) -> f64
pub fn cross(self, other: Self) -> f64
Returns the magnitude of the cross product as if both vectors had z value 0.0
pub fn to_signums_of(&self, other: Self) -> Self
pub fn to_point(&self) -> Point2<W>
pub fn cast_space<WNew: Space>(&self) -> Vector2<WNew>
Trait Implementations§
source§impl<W: Space> PartialEq for Vector2<W>
impl<W: Space> PartialEq for Vector2<W>
impl<W: Space> Copy for Vector2<W>
Auto Trait Implementations§
impl<W> Freeze for Vector2<W>
impl<W> RefUnwindSafe for Vector2<W>where
W: RefUnwindSafe,
impl<W> Send for Vector2<W>where
W: Send,
impl<W> Sync for Vector2<W>where
W: Sync,
impl<W> Unpin for Vector2<W>where
W: Unpin,
impl<W> UnwindSafe for Vector2<W>where
W: UnwindSafe,
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, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
source§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.