Skip to main content

Point3

Struct Point3 

Source
pub struct Point3<T> {
    pub x: T,
    pub y: T,
    pub z: T,
}
Expand description

A 3D point (distinct from Vector3 to model affine semantics).

Fields§

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

Implementations§

Source§

impl<T: Default> Point3<T>

Source

pub fn origin() -> Self

Origin point.

Source§

impl<T> Point3<T>

Source

pub fn new(x: T, y: T, z: T) -> Self

Construct from components.

Source§

impl Point3<f64>

Source

pub fn coords(&self) -> Vector3<f64>

Coords as a Vector3.

Source

pub fn from_vec(v: Vector3<f64>) -> Self

Construct from a Vector3.

Source

pub fn to_homogeneous(&self) -> [f64; 4]

Convert to homogeneous coordinates (4-element column vector).

Source

pub fn from_homogeneous(h: [f64; 4]) -> Option<Self>

Create from homogeneous coordinates. Returns None if w is near zero.

Trait Implementations§

Source§

impl Add<Vector3<f64>> for Point3<f64>

Point3 + Vector3 → Point3

Source§

type Output = Point3<f64>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Vector3<f64>) -> Self

Performs the + operation. Read more
Source§

impl AddAssign<Vector3<f64>> for Point3<f64>

Point3 += Vector3

Source§

fn add_assign(&mut self, rhs: Vector3<f64>)

Performs the += operation. Read more
Source§

impl<T: Clone> Clone for Point3<T>

Source§

fn clone(&self) -> Point3<T>

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<T: Copy> Copy for Point3<T>

Source§

impl<T: Debug> Debug for Point3<T>

Source§

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

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

impl<'de, T> Deserialize<'de> for Point3<T>
where T: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

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

impl From<Vector3<f64>> for Point3<f64>

Construct Point3 from Vector3 (via From trait).

Source§

fn from(v: Vector3<f64>) -> Self

Converts to this type from the input type.
Source§

impl Mul<Point3<f64>> for Matrix3<f64>

Matrix3 * Point3 → Point3 (transform point).

Source§

type Output = Point3<f64>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Point3<f64>) -> Point3<f64>

Performs the * operation. Read more
Source§

impl Mul<f64> for Point3<f64>

Point3 * f64 — scale coordinates (matches nalgebra pattern).

Source§

type Output = Vector3<f64>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Vector3<f64>

Performs the * operation. Read more
Source§

impl<T: PartialEq> PartialEq for Point3<T>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
Source§

impl<T> Serialize for Point3<T>
where T: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

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

impl<T> StructuralPartialEq for Point3<T>

Source§

impl Sub for Point3<f64>

Point3 - Point3 → Vector3

Source§

type Output = Vector3<f64>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Vector3<f64>

Performs the - operation. Read more
Source§

impl<'a, 'b> Sub<&'b Point3<f64>> for &'a Point3<f64>

&Point3 - &Point3 → Vector3

Source§

type Output = Vector3<f64>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'b Point3<f64>) -> Vector3<f64>

Performs the - operation. Read more
Source§

impl Sub<Vector3<f64>> for Point3<f64>

Point3 - Vector3 → Point3

Source§

type Output = Point3<f64>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Vector3<f64>) -> Self

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Point3<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Point3<T>
where T: RefUnwindSafe,

§

impl<T> Send for Point3<T>
where T: Send,

§

impl<T> Sync for Point3<T>
where T: Sync,

§

impl<T> Unpin for Point3<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Point3<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Point3<T>
where T: UnwindSafe,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.