Struct three_d::core::prelude::Point3

source ·
#[repr(C)]
pub struct Point3<S> { pub x: S, pub y: S, pub z: S, }
Expand description

A point in 3-dimensional space.

This type is marked as #[repr(C)].

Fields§

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

Implementations§

source§

impl<S> Point3<S>
where S: BaseNum,

source

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

source

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

source§

impl<S> Point3<S>

source

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

Construct a new point, using the provided values.

source

pub fn map<U, F>(self, f: F) -> Point3<U>
where F: FnMut(S) -> U,

Perform the given operation on each field in the point, returning a new point constructed from the operations.

source

pub fn zip<S2, S3, F>(self, p2: Point3<S2>, f: F) -> Point3<S3>
where F: FnMut(S, S2) -> S3,

Construct a new point where each component is the result of applying the given operation to each pair of components of the given points.

source§

impl<S> Point3<S>
where S: NumCast + Copy,

source

pub fn cast<T>(&self) -> Option<Point3<T>>
where T: NumCast,

Component-wise casting to another type

Trait Implementations§

source§

impl<S> AbsDiffEq for Point3<S>
where S: BaseFloat,

§

type Epsilon = <S as AbsDiffEq>::Epsilon

Used for specifying relative comparisons.
source§

fn default_epsilon() -> <S as AbsDiffEq>::Epsilon

The default tolerance to use when testing values that are close together. Read more
source§

fn abs_diff_eq( &self, other: &Point3<S>, epsilon: <S as AbsDiffEq>::Epsilon ) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of [AbsDiffEq::abs_diff_eq].
source§

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

§

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> Add<&'a Vector3<S>> for Point3<S>
where S: BaseNum,

§

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> Add<Vector3<S>> for &'a Point3<S>
where S: BaseNum,

§

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> Add<Vector3<S>> for Point3<S>
where S: BaseNum,

§

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> AddAssign<Vector3<S>> for Point3<S>
where S: BaseNum + AddAssign,

source§

fn add_assign(&mut self, vector: Vector3<S>)

Performs the += operation. Read more
source§

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

§

type Element = S

source§

fn len() -> usize

Get the number of elements in the array type Read more
source§

fn from_value(scalar: S) -> Point3<S>

Construct a vector from a single value, replicating it. Read more
source§

fn sum(self) -> S
where S: Add<Output = S>,

The sum of the elements of the array.
source§

fn product(self) -> S
where S: Mul<Output = S>,

The product of the elements of the array.
source§

fn is_finite(&self) -> bool
where S: Float,

Whether all elements of the array are finite
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> Bounded for Point3<S>
where S: Bounded,

source§

fn min_value() -> Point3<S>

Returns the smallest finite number this type can represent
source§

fn max_value() -> Point3<S>

Returns the largest finite number this type can represent
source§

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

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> Debug for Point3<S>
where S: Debug,

source§

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

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

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

§

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> Div<S> for Point3<S>
where S: BaseNum,

§

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> DivAssign<S> for Point3<S>
where S: BaseNum + DivAssign,

source§

fn div_assign(&mut self, scalar: S)

Performs the /= operation. Read more
source§

impl<S> ElementWise<S> for Point3<S>
where S: BaseNum,

source§

fn add_element_wise(self, rhs: S) -> Point3<S>

source§

fn sub_element_wise(self, rhs: S) -> Point3<S>

source§

fn mul_element_wise(self, rhs: S) -> Point3<S>

source§

fn div_element_wise(self, rhs: S) -> Point3<S>

source§

fn rem_element_wise(self, rhs: S) -> Point3<S>

source§

fn add_assign_element_wise(&mut self, rhs: S)

source§

fn sub_assign_element_wise(&mut self, rhs: S)

source§

fn mul_assign_element_wise(&mut self, rhs: S)

source§

fn div_assign_element_wise(&mut self, rhs: S)

source§

fn rem_assign_element_wise(&mut self, rhs: S)

source§

impl<S> ElementWise for Point3<S>
where S: BaseNum,

source§

fn add_element_wise(self, rhs: Point3<S>) -> Point3<S>

source§

fn sub_element_wise(self, rhs: Point3<S>) -> Point3<S>

source§

fn mul_element_wise(self, rhs: Point3<S>) -> Point3<S>

source§

fn div_element_wise(self, rhs: Point3<S>) -> Point3<S>

source§

fn rem_element_wise(self, rhs: Point3<S>) -> Point3<S>

source§

fn add_assign_element_wise(&mut self, rhs: Point3<S>)

source§

fn sub_assign_element_wise(&mut self, rhs: Point3<S>)

source§

fn mul_assign_element_wise(&mut self, rhs: Point3<S>)

source§

fn div_assign_element_wise(&mut self, rhs: Point3<S>)

source§

fn rem_assign_element_wise(&mut self, rhs: Point3<S>)

source§

impl<S> EuclideanSpace for Point3<S>
where S: BaseNum,

§

type Scalar = S

The associated scalar over which the space is defined. Read more
§

type Diff = Vector3<S>

The associated space of displacement vectors.
source§

fn origin() -> Point3<S>

The point at the origin of the Euclidean space.
source§

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

Convert a displacement vector to a point. Read more
source§

fn to_vec(self) -> Vector3<S>

Convert a point to a displacement vector. Read more
source§

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

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

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

Returns the middle point between two other points. Read more
source§

fn centroid(points: &[Self]) -> Self

Returns the average position of all points in the slice. Read more
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> From<[S; 3]> for Point3<S>
where S: Clone,

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 for Point3<S>
where S: Hash,

source§

fn hash<__H>(&self, state: &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
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<S> MetricSpace for Point3<S>
where S: BaseFloat,

§

type Metric = S

The metric to be returned by the distance function.
source§

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

Returns the squared distance. Read more
source§

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

§

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> Mul<S> for Point3<S>
where S: BaseNum,

§

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> MulAssign<S> for Point3<S>
where S: BaseNum + MulAssign,

source§

fn mul_assign(&mut self, scalar: S)

Performs the *= operation. Read more
source§

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

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> RelativeEq for Point3<S>
where S: BaseFloat,

source§

fn default_max_relative() -> <S as AbsDiffEq>::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
source§

fn relative_eq( &self, other: &Point3<S>, epsilon: <S as AbsDiffEq>::Epsilon, max_relative: <S as AbsDiffEq>::Epsilon ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool

The inverse of [RelativeEq::relative_eq].
source§

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

§

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> Rem<S> for Point3<S>
where S: BaseNum,

§

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> RemAssign<S> for Point3<S>
where S: BaseNum + RemAssign,

source§

fn rem_assign(&mut self, scalar: S)

Performs the %= operation. Read more
source§

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

§

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> Sub<&'a Point3<S>> for Point3<S>
where S: BaseNum,

§

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, 'b, S> Sub<&'a Vector3<S>> for &'b Point3<S>
where S: BaseNum,

§

type Output = Point3<S>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

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

§

type Output = Point3<S>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

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

§

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<'a, S> Sub<Vector3<S>> for &'a Point3<S>
where S: BaseNum,

§

type Output = Point3<S>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<S> Sub<Vector3<S>> for Point3<S>
where S: BaseNum,

§

type Output = Point3<S>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

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

§

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> SubAssign<Vector3<S>> for Point3<S>
where S: BaseNum + SubAssign,

source§

fn sub_assign(&mut self, vector: Vector3<S>)

Performs the -= operation. Read more
source§

impl<S> Transform<Point3<S>> for Matrix3<S>
where S: BaseFloat,

source§

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

👎Deprecated: Use look_at_rh or look_at_lh
Create a transformation that rotates a vector to look at center from eye, using up for orientation.
source§

fn look_at_lh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix3<S>

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

fn look_at_rh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix3<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: &Matrix3<S>) -> Matrix3<S>

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

fn inverse_transform(&self) -> Option<Matrix3<S>>

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

fn inverse_transform_vector( &self, vec: <P as EuclideanSpace>::Diff ) -> Option<<P as EuclideanSpace>::Diff>

Inverse transform a vector using this transform
source§

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

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

impl<S> Transform<Point3<S>> for Matrix4<S>
where S: BaseFloat,

source§

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

👎Deprecated: Use look_at_rh or look_at_lh
Create a transformation that rotates a vector to look at center from eye, using up for orientation.
source§

fn look_at_lh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S>

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

fn look_at_rh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<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: &Matrix4<S>) -> Matrix4<S>

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

fn inverse_transform(&self) -> Option<Matrix4<S>>

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

fn inverse_transform_vector( &self, vec: <P as EuclideanSpace>::Diff ) -> Option<<P as EuclideanSpace>::Diff>

Inverse transform a vector using this transform
source§

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

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

impl<S> UlpsEq for Point3<S>
where S: BaseFloat,

source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
source§

fn ulps_eq( &self, other: &Point3<S>, epsilon: <S as AbsDiffEq>::Epsilon, max_ulps: u32 ) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
§

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of [UlpsEq::ulps_eq].
source§

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

source§

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

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 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> 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> LowerBounded for T
where T: Bounded,

source§

fn min_value() -> T

Returns the smallest finite number this type can represent
source§

impl<T> ToOwned for T
where 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 T
where 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 T
where 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> UpperBounded for T
where T: Bounded,

source§

fn max_value() -> T

Returns the largest finite number this type can represent
source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,