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 x() -> Self
pub fn y() -> 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>
pub fn rotate(&self, angle: Rotation) -> Self
pub fn rotate90(self) -> Self
pub fn mult(&self, other: Self) -> Vector2<W>
Trait Implementations§
Source§impl CoercionRules for Vector2
impl CoercionRules for Vector2
Source§impl<W: Space> Interpolatable for Vector2<W>
impl<W: Space> Interpolatable for Vector2<W>
fn interpolate(&self, _other: &Self, _t: f64) -> Self
Source§impl ToPaxValue for Vector2
impl ToPaxValue for Vector2
fn to_pax_value(self) -> PaxValue
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.