pub struct Vector2<W = Generic> {
pub x: f64,
pub y: f64,
/* private fields */
}Expand description
A representation of a vector in 2D space.
Fields§
§x: f64Horizontal component.
y: f64Vertical component.
Implementations§
Source§impl<W> Vector2<W>where
W: Space,
impl<W> Vector2<W>where
W: Space,
Sourcepub fn length_squared(&self) -> f64
pub fn length_squared(&self) -> f64
Returns squared vector length.
Sourcepub fn project_onto(self, axis: Vector2<W>) -> Vector2<W>
pub fn project_onto(self, axis: Vector2<W>) -> Vector2<W>
Projects this vector onto axis.
pub fn project_axis_aligned(self, other: Vector2<W>) -> Vector2<W>
Sourcepub fn angle_to(self, other: Vector2<W>) -> Rotation
pub fn angle_to(self, other: Vector2<W>) -> Rotation
Returns the counter-clockwise angle from this vector to other.
Sourcepub fn cross(self, other: Vector2<W>) -> f64
pub fn cross(self, other: Vector2<W>) -> f64
Returns the z component of the 3D cross product, assuming both vectors have z value 0.0.
Sourcepub fn to_signums_of(&self, other: Vector2<W>) -> Vector2<W>
pub fn to_signums_of(&self, other: Vector2<W>) -> Vector2<W>
Copies this vector’s magnitudes onto the component signs of other.
Sourcepub fn cast_space<WNew>(&self) -> Vector2<WNew>where
WNew: Space,
pub fn cast_space<WNew>(&self) -> Vector2<WNew>where
WNew: Space,
Casts this vector into another phantom coordinate space.
Trait Implementations§
Source§impl CoercionRules for Vector2
impl CoercionRules for Vector2
Source§fn allows_singleton_stack() -> bool
fn allows_singleton_stack() -> bool
Opts appearance layers into scalar-to-singleton stack conversion.
Ordinary vector values remain list-only.
Source§fn is_identity_roundtrip() -> bool
fn is_identity_roundtrip() -> bool
Whether cloning
Self preserves the semantics of converting that clone
through ToPaxValue and back with try_coerce. Read moreimpl<W> Copy for Vector2<W>where
W: Space,
Source§impl<W> Interpolatable for Vector2<W>where
W: Space,
impl<W> Interpolatable for Vector2<W>where
W: Space,
Source§fn interpolate(&self, _other: &Self, _t: f64) -> Self
fn interpolate(&self, _other: &Self, _t: f64) -> Self
Source§impl<F, T> Mul<Vector2<F>> for Transform2<F, T>
impl<F, T> Mul<Vector2<F>> for Transform2<F, T>
Source§impl ToPaxValue for Vector2
impl ToPaxValue for Vector2
Source§fn to_pax_value(self) -> PaxValue
fn to_pax_value(self) -> PaxValue
Converts this value into a
PaxValue.Source§fn nested_properties(&self) -> Vec<UntypedProperty>
fn nested_properties(&self) -> Vec<UntypedProperty>
Live properties read when snapshotting a compound value for PAXEL.
Adapters observe these as well as the containing property.
Source§fn to_pax_value_in_graph(self) -> PaxValuewhere
Self: Sized,
fn to_pax_value_in_graph(self) -> PaxValuewhere
Self: Sized,
Converts against owner-thread graph views, including nested generated
property fields. Requires an entered property graph for shared fields.
Ordinary
Self::to_pax_value reads published value snapshots.Auto Trait Implementations§
impl<W> Freeze for Vector2<W>where
PhantomData<W>: Freeze,
impl<W> RefUnwindSafe for Vector2<W>where
PhantomData<W>: RefUnwindSafe,
impl<W> Send for Vector2<W>where
PhantomData<W>: Send,
impl<W> Sync for Vector2<W>where
PhantomData<W>: Sync,
impl<W> Unpin for Vector2<W>where
PhantomData<W>: Unpin,
impl<W> UnsafeUnpin for Vector2<W>where
PhantomData<W>: UnsafeUnpin,
impl<W> UnwindSafe for Vector2<W>where
PhantomData<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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> PropertyValue for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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.