zng_layout::unit::euclid::default

Type Alias HomogeneousVector

pub type HomogeneousVector<T> = HomogeneousVector<T, UnknownUnit>;

Aliased Type§

struct HomogeneousVector<T> {
    pub x: T,
    pub y: T,
    pub z: T,
    pub w: T,
}

Fields§

§x: T§y: T§z: T§w: T

Implementations

§

impl<T, U> HomogeneousVector<T, U>

pub const fn new(x: T, y: T, z: T, w: T) -> HomogeneousVector<T, U>

Constructor taking scalar values directly.

§

impl<T, U> HomogeneousVector<T, U>
where T: Copy + Div<Output = T> + Zero + PartialOrd,

pub fn to_point2d(self) -> Option<Point2D<T, U>>

Convert into Cartesian 2D point.

Returns None if the point is on or behind the W=0 hemisphere.

pub fn to_point3d(self) -> Option<Point3D<T, U>>

Convert into Cartesian 3D point.

Returns None if the point is on or behind the W=0 hemisphere.

Trait Implementations

§

impl<T, U> Clone for HomogeneousVector<T, U>
where T: Clone,

§

fn clone(&self) -> HomogeneousVector<T, U>

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
§

impl<T, U> Debug for HomogeneousVector<T, U>
where T: Debug,

§

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

Formats the value using the given formatter. Read more
§

impl<'de, T, U> Deserialize<'de> for HomogeneousVector<T, U>
where T: Deserialize<'de>,

§

fn deserialize<D>( deserializer: D, ) -> Result<HomogeneousVector<T, U>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl<T, U> From<Point2D<T, U>> for HomogeneousVector<T, U>
where T: Zero + One,

§

fn from(p: Point2D<T, U>) -> HomogeneousVector<T, U>

Converts to this type from the input type.
§

impl<T, U> From<Point3D<T, U>> for HomogeneousVector<T, U>
where T: One,

§

fn from(p: Point3D<T, U>) -> HomogeneousVector<T, U>

Converts to this type from the input type.
§

impl<T, U> From<Vector2D<T, U>> for HomogeneousVector<T, U>
where T: Zero,

§

fn from(v: Vector2D<T, U>) -> HomogeneousVector<T, U>

Converts to this type from the input type.
§

impl<T, U> From<Vector3D<T, U>> for HomogeneousVector<T, U>
where T: Zero,

§

fn from(v: Vector3D<T, U>) -> HomogeneousVector<T, U>

Converts to this type from the input type.
§

impl<T, U> Hash for HomogeneousVector<T, U>
where T: Hash,

§

fn hash<H>(&self, h: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<T, U> PartialEq for HomogeneousVector<T, U>
where T: PartialEq,

§

fn eq(&self, other: &HomogeneousVector<T, U>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<T, U> Serialize for HomogeneousVector<T, U>
where T: Serialize,

§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl<T, U> Zeroable for HomogeneousVector<T, U>
where T: Zeroable,

§

fn zeroed() -> Self

§

impl<T, U> Copy for HomogeneousVector<T, U>
where T: Copy,

§

impl<T, U> Eq for HomogeneousVector<T, U>
where T: Eq,

§

impl<T, U> Pod for HomogeneousVector<T, U>
where T: Pod, U: 'static,