Skip to main content

Vector3

Struct Vector3 

Source
pub struct Vector3<F: VectorFrame, U: VectorUnit> { /* private fields */ }
Expand description

Three components of one quantity in one frame.

Components are in the frame’s axis order (VectorFrame::AXES); each frame has accessors named after its axes.

Implementations§

Source§

impl<F: VectorFrame, U: VectorUnit> Vector3<F, U>

Source

pub const fn new(first: U, second: U, third: U) -> Self

Vector from components in axis order.

Source

pub const fn components(&self) -> [U; 3]

Components in axis order.

Source

pub fn magnitude(&self) -> U

Length.

Source

pub fn horizontal_magnitude(&self) -> U

Length of the projection on the first two axes (horizontal, for a level frame).

Source§

impl<U: VectorUnit> Vector3<Ned, U>

Source

pub const fn north(&self) -> U

North component.

Source

pub const fn east(&self) -> U

East component.

Source

pub const fn down(&self) -> U

Down component.

Source

pub fn to_enu(self) -> Vector3<Enu, U>

Same vector in ENU.

Source

pub fn horizontal_direction(&self) -> Option<TrueCourse>

True direction of the horizontal component; None if negligible.

For a velocity: course over ground.

Source§

impl<U: VectorUnit> Vector3<Enu, U>

Source

pub const fn east(&self) -> U

East component.

Source

pub const fn north(&self) -> U

North component.

Source

pub const fn up(&self) -> U

Up component.

Source

pub fn to_ned(self) -> Vector3<Ned, U>

Same vector in NED.

Source

pub fn horizontal_direction(&self) -> Option<TrueCourse>

True direction of the horizontal component; None if negligible.

Source§

impl<U: VectorUnit> Vector3<Body, U>

Source

pub const fn forward(&self) -> U

Forward component.

Source

pub const fn right(&self) -> U

Starboard component.

Source

pub const fn down(&self) -> U

Down component.

Trait Implementations§

Source§

impl<F: VectorFrame, U: VectorUnit> Add for Vector3<F, U>

Source§

type Output = Vector3<F, U>

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
Source§

impl<F: Clone + VectorFrame, U: Clone + VectorUnit> Clone for Vector3<F, U>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: Copy + VectorFrame, U: Copy + VectorUnit> Copy for Vector3<F, U>

Source§

impl<F: VectorFrame, U: VectorUnit> Debug for Vector3<F, U>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F: VectorFrame, U: VectorUnit + Display> Display for Vector3<F, U>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats as (north 200.0 m, east 50.0 m, down -3.0 m).

Source§

impl<F: VectorFrame, U: VectorUnit> Div<f64> for Vector3<F, U>

Source§

fn div(self, divisor: f64) -> Self

Division by zero yields infinite components, which from_si maps to zero; callers dividing by elapsed time check it first.

Source§

type Output = Vector3<F, U>

The resulting type after applying the / operator.
Source§

impl<F: VectorFrame, U: VectorUnit> Mul<f64> for Vector3<F, U>

Source§

type Output = Vector3<F, U>

The resulting type after applying the * operator.
Source§

fn mul(self, factor: f64) -> Self

Performs the * operation. Read more
Source§

impl<F: VectorFrame, U: VectorUnit> Neg for Vector3<F, U>

Source§

type Output = Vector3<F, U>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<F: PartialEq + VectorFrame, U: PartialEq + VectorUnit> PartialEq for Vector3<F, U>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<F: PartialEq + VectorFrame, U: PartialEq + VectorUnit> StructuralPartialEq for Vector3<F, U>

Source§

impl<F: VectorFrame, U: VectorUnit> Sub for Vector3<F, U>

Source§

type Output = Vector3<F, U>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<F, U> Freeze for Vector3<F, U>

§

impl<F, U> RefUnwindSafe for Vector3<F, U>

§

impl<F, U> Send for Vector3<F, U>

§

impl<F, U> Sync for Vector3<F, U>

§

impl<F, U> Unpin for Vector3<F, U>

§

impl<F, U> UnsafeUnpin for Vector3<F, U>

§

impl<F, U> UnwindSafe for Vector3<F, U>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.