Struct cgmath::Point3

source ·
pub struct Point3<S> {
    pub x: S,
    pub y: S,
    pub z: S,
}
Expand description

A point in 3-dimensional space.

Fields§

§x: S§y: S§z: S

Implementations§

source§

impl<S: BaseNum> Point3<S>

source

pub fn new(x: S, y: S, z: S) -> Point3<S>

source§

impl<S: BaseNum> Point3<S>

source

pub fn from_homogeneous(v: Vector4<S>) -> Point3<S>

source

pub fn to_homogeneous(self) -> Vector4<S>

Trait Implementations§

source§

impl<'a, 'b, S: BaseNum> Add<&'a Vector3<S>> for &'b Point3<S>

§

type Output = Point3<S>

The resulting type after applying the + operator.
source§

fn add(self, other: &'a Vector3<S>) -> Point3<S>

Performs the + operation. Read more
source§

impl<'a, S: BaseNum> Add<&'a Vector3<S>> for Point3<S>

§

type Output = Point3<S>

The resulting type after applying the + operator.
source§

fn add(self, other: &'a Vector3<S>) -> Point3<S>

Performs the + operation. Read more
source§

impl<'a, S: BaseNum> Add<Vector3<S>> for &'a Point3<S>

§

type Output = Point3<S>

The resulting type after applying the + operator.
source§

fn add(self, other: Vector3<S>) -> Point3<S>

Performs the + operation. Read more
source§

impl<S: BaseNum> Add<Vector3<S>> for Point3<S>

§

type Output = Point3<S>

The resulting type after applying the + operator.
source§

fn add(self, other: Vector3<S>) -> Point3<S>

Performs the + operation. Read more
source§

impl<S: BaseFloat> ApproxEq for Point3<S>

§

type Epsilon = S

source§

fn approx_eq_eps(&self, other: &Point3<S>, epsilon: &S) -> bool

source§

fn approx_epsilon() -> Self::Epsilon

source§

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

source§

impl<S: BaseNum> Array for Point3<S>

§

type Element = S

source§

fn sum(self) -> S

The sum of the elements of the array.
source§

fn product(self) -> S

The product of the elements of the array.
source§

fn min(self) -> S

The minimum element of the array.
source§

fn max(self) -> S

The maximum element of the array.
source§

fn as_ptr(&self) -> *const Self::Element

Get the pointer to the first element of the array.
source§

fn as_mut_ptr(&mut self) -> *mut Self::Element

Get a mutable pointer to the first element of the array.
source§

fn swap_elements(&mut self, i: usize, j: usize)

Swap the elements at indices i and j in-place.
source§

impl<S> AsMut<[S; 3]> for Point3<S>

source§

fn as_mut(&mut self) -> &mut [S; 3]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<S> AsMut<(S, S, S)> for Point3<S>

source§

fn as_mut(&mut self) -> &mut (S, S, S)

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<S> AsRef<[S; 3]> for Point3<S>

source§

fn as_ref(&self) -> &[S; 3]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<S> AsRef<(S, S, S)> for Point3<S>

source§

fn as_ref(&self) -> &(S, S, S)

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<S: Clone> Clone for Point3<S>

source§

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

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
source§

impl<S: BaseNum> Debug for Point3<S>

source§

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

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

impl<S: Decodable> Decodable for Point3<S>

source§

fn decode<__D: Decoder>(d: &mut __D) -> Result<Point3<S>, __D::Error>

Deserialize a value using a Decoder.
source§

impl<'a, S: BaseNum> Div<S> for &'a Point3<S>

§

type Output = Point3<S>

The resulting type after applying the / operator.
source§

fn div(self, other: S) -> Point3<S>

Performs the / operation. Read more
source§

impl<S: BaseNum> Div<S> for Point3<S>

§

type Output = Point3<S>

The resulting type after applying the / operator.
source§

fn div(self, other: S) -> Point3<S>

Performs the / operation. Read more
source§

impl<S: Encodable> Encodable for Point3<S>

source§

fn encode<__S: Encoder>(&self, s: &mut __S) -> Result<(), __S::Error>

Serialize a value using an Encoder.
source§

impl<'a, S> From<&'a [S; 3]> for &'a Point3<S>

source§

fn from(v: &'a [S; 3]) -> &'a Point3<S>

Converts to this type from the input type.
source§

impl<'a, S> From<&'a (S, S, S)> for &'a Point3<S>

source§

fn from(v: &'a (S, S, S)) -> &'a Point3<S>

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut [S; 3]> for &'a mut Point3<S>

source§

fn from(v: &'a mut [S; 3]) -> &'a mut Point3<S>

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut (S, S, S)> for &'a mut Point3<S>

source§

fn from(v: &'a mut (S, S, S)) -> &'a mut Point3<S>

Converts to this type from the input type.
source§

impl<S: Clone> From<[S; 3]> for Point3<S>

source§

fn from(v: [S; 3]) -> Point3<S>

Converts to this type from the input type.
source§

impl<S> From<(S, S, S)> for Point3<S>

source§

fn from(v: (S, S, S)) -> Point3<S>

Converts to this type from the input type.
source§

impl<S: Hash> Hash for Point3<S>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

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
source§

impl<S> Index<Range<usize>> for Point3<S>

§

type Output = [S]

The returned type after indexing.
source§

fn index<'a>(&'a self, i: Range<usize>) -> &'a [S]

Performs the indexing (container[index]) operation. Read more
source§

impl<S> Index<RangeFrom<usize>> for Point3<S>

§

type Output = [S]

The returned type after indexing.
source§

fn index<'a>(&'a self, i: RangeFrom<usize>) -> &'a [S]

Performs the indexing (container[index]) operation. Read more
source§

impl<S> Index<RangeFull> for Point3<S>

§

type Output = [S]

The returned type after indexing.
source§

fn index<'a>(&'a self, i: RangeFull) -> &'a [S]

Performs the indexing (container[index]) operation. Read more
source§

impl<S> Index<RangeTo<usize>> for Point3<S>

§

type Output = [S]

The returned type after indexing.
source§

fn index<'a>(&'a self, i: RangeTo<usize>) -> &'a [S]

Performs the indexing (container[index]) operation. Read more
source§

impl<S> Index<usize> for Point3<S>

§

type Output = S

The returned type after indexing.
source§

fn index<'a>(&'a self, i: usize) -> &'a S

Performs the indexing (container[index]) operation. Read more
source§

impl<S> IndexMut<Range<usize>> for Point3<S>

source§

fn index_mut<'a>(&'a mut self, i: Range<usize>) -> &'a mut [S]

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<S> IndexMut<RangeFrom<usize>> for Point3<S>

source§

fn index_mut<'a>(&'a mut self, i: RangeFrom<usize>) -> &'a mut [S]

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<S> IndexMut<RangeFull> for Point3<S>

source§

fn index_mut<'a>(&'a mut self, i: RangeFull) -> &'a mut [S]

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<S> IndexMut<RangeTo<usize>> for Point3<S>

source§

fn index_mut<'a>(&'a mut self, i: RangeTo<usize>) -> &'a mut [S]

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<S> IndexMut<usize> for Point3<S>

source§

fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut S

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<S> Into<[S; 3]> for Point3<S>

source§

fn into(self) -> [S; 3]

Converts this type into the (usually inferred) input type.
source§

impl<S> Into<(S, S, S)> for Point3<S>

source§

fn into(self) -> (S, S, S)

Converts this type into the (usually inferred) input type.
source§

impl<'a, S: BaseNum> Mul<S> for &'a Point3<S>

§

type Output = Point3<S>

The resulting type after applying the * operator.
source§

fn mul(self, other: S) -> Point3<S>

Performs the * operation. Read more
source§

impl<S: BaseNum> Mul<S> for Point3<S>

§

type Output = Point3<S>

The resulting type after applying the * operator.
source§

fn mul(self, other: S) -> Point3<S>

Performs the * operation. Read more
source§

impl<S: PartialEq> PartialEq<Point3<S>> for Point3<S>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<S: BaseNum> Point for Point3<S>

§

type Scalar = S

The associated scalar. Read more
§

type Vector = Vector3<S>

The associated displacement vector.
source§

fn origin() -> Point3<S>

Create a point at the origin.
source§

fn from_vec(v: Vector3<S>) -> Point3<S>

Create a point from a vector.
source§

fn to_vec(self) -> Vector3<S>

Convert a point to a vector.
source§

fn dot(self, v: Vector3<S>) -> S

This is a weird one, but its useful for plane calculations.
source§

impl<'a, S: BaseNum> Rem<S> for &'a Point3<S>

§

type Output = Point3<S>

The resulting type after applying the % operator.
source§

fn rem(self, other: S) -> Point3<S>

Performs the % operation. Read more
source§

impl<S: BaseNum> Rem<S> for Point3<S>

§

type Output = Point3<S>

The resulting type after applying the % operator.
source§

fn rem(self, other: S) -> Point3<S>

Performs the % operation. Read more
source§

impl<S: BaseFloat> Rotation<Point3<S>> for Basis3<S>

source§

fn one() -> Basis3<S>

Create the identity transform (causes no transformation).
source§

fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Basis3<S>

Create a rotation to a given direction with an ‘up’ vector
source§

fn between_vectors(a: Vector3<S>, b: Vector3<S>) -> Basis3<S>

Create a shortest rotation to transform vector ‘a’ into ‘b’. Both given vectors are assumed to have unit length.
source§

fn rotate_vector(&self, vec: Vector3<S>) -> Vector3<S>

Rotate a vector using this rotation.
source§

fn concat(&self, other: &Basis3<S>) -> Basis3<S>

Create a new rotation which combines both this rotation, and another.
source§

fn concat_self(&mut self, other: &Basis3<S>)

Modify this rotation in-place by combining it with another.
source§

fn invert(&self) -> Basis3<S>

Create a new rotation which “un-does” this rotation. That is, r.concat(r.invert()) is the identity.
source§

fn invert_self(&mut self)

Invert this rotation in-place.
source§

fn rotate_point(&self, point: P) -> P

Rotate a point using this rotation, by converting it to its representation as a vector.
source§

impl<S: BaseFloat> Rotation<Point3<S>> for Quaternion<S>

source§

fn one() -> Quaternion<S>

Create the identity transform (causes no transformation).
source§

fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Quaternion<S>

Create a rotation to a given direction with an ‘up’ vector
source§

fn between_vectors(a: Vector3<S>, b: Vector3<S>) -> Quaternion<S>

Create a shortest rotation to transform vector ‘a’ into ‘b’. Both given vectors are assumed to have unit length.
source§

fn rotate_vector(&self, vec: Vector3<S>) -> Vector3<S>

Rotate a vector using this rotation.
source§

fn concat(&self, other: &Quaternion<S>) -> Quaternion<S>

Create a new rotation which combines both this rotation, and another.
source§

fn concat_self(&mut self, other: &Quaternion<S>)

Modify this rotation in-place by combining it with another.
source§

fn invert(&self) -> Quaternion<S>

Create a new rotation which “un-does” this rotation. That is, r.concat(r.invert()) is the identity.
source§

fn invert_self(&mut self)

Invert this rotation in-place.
source§

fn rotate_point(&self, point: P) -> P

Rotate a point using this rotation, by converting it to its representation as a vector.
source§

impl<'a, 'b, S: BaseNum> Sub<&'a Point3<S>> for &'b Point3<S>

§

type Output = Vector3<S>

The resulting type after applying the - operator.
source§

fn sub(self, other: &'a Point3<S>) -> Vector3<S>

Performs the - operation. Read more
source§

impl<'a, S: BaseNum> Sub<&'a Point3<S>> for Point3<S>

§

type Output = Vector3<S>

The resulting type after applying the - operator.
source§

fn sub(self, other: &'a Point3<S>) -> Vector3<S>

Performs the - operation. Read more
source§

impl<'a, S: BaseNum> Sub<Point3<S>> for &'a Point3<S>

§

type Output = Vector3<S>

The resulting type after applying the - operator.
source§

fn sub(self, other: Point3<S>) -> Vector3<S>

Performs the - operation. Read more
source§

impl<S: BaseNum> Sub<Point3<S>> for Point3<S>

§

type Output = Vector3<S>

The resulting type after applying the - operator.
source§

fn sub(self, other: Point3<S>) -> Vector3<S>

Performs the - operation. Read more
source§

impl<S: BaseFloat> Transform<Point3<S>> for AffineMatrix3<S>

source§

fn one() -> AffineMatrix3<S>

Create an identity transformation. That is, a transformation which does nothing.
source§

fn look_at( eye: Point3<S>, center: Point3<S>, up: Vector3<S> ) -> AffineMatrix3<S>

Create a transformation that rotates a vector to look at center from eye, using up for orientation.
source§

fn transform_vector(&self, vec: Vector3<S>) -> Vector3<S>

Transform a vector using this transform.
source§

fn transform_point(&self, point: Point3<S>) -> Point3<S>

Transform a point using this transform.
source§

fn concat(&self, other: &AffineMatrix3<S>) -> AffineMatrix3<S>

Combine this transform with another, yielding a new transformation which has the effects of both.
source§

fn invert(&self) -> Option<AffineMatrix3<S>>

Create a transform that “un-does” this one.
source§

fn transform_as_point(&self, vec: P::Vector) -> P::Vector

Transform a vector as a point using this transform.
source§

fn concat_self(&mut self, other: &Self)

Combine this transform with another, in-place.
source§

fn invert_self(&mut self)

Invert this transform in-place, failing if the transformation is not invertible.
source§

impl<S: Copy> Copy for Point3<S>

source§

impl<S: Eq> Eq for Point3<S>

source§

impl<S> StructuralEq for Point3<S>

source§

impl<S> StructuralPartialEq for Point3<S>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for Twhere T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,