pub struct Point3D<T: Number> {
pub x: T,
pub y: T,
pub z: T,
}
Expand description
Struct representing a 3D point or vector.
Fields§
§x: T
§y: T
§z: T
Implementations§
source§impl<T: Number> Point3D<T>
impl<T: Number> Point3D<T>
pub const ORIGIN: Self = _
pub const fn new(x: T, y: T, z: T) -> Self
sourcepub fn manhattan_distance(self) -> T
pub fn manhattan_distance(self) -> T
Returns the manhattan distance from the origin.
sourcepub fn manhattan_distance_unsigned(self) -> T::Unsignedwhere
T: SignedInteger,
pub fn manhattan_distance_unsigned(self) -> T::Unsignedwhere
T: SignedInteger,
Returns the manhattan distance from the origin.
sourcepub fn wrapping_add_signed(self, rhs: Point3D<T::Signed>) -> Selfwhere
T: UnsignedInteger,
pub fn wrapping_add_signed(self, rhs: Point3D<T::Signed>) -> Selfwhere
T: UnsignedInteger,
Add the provided signed point, wrapping on overflow.
Useful for adding a signed direction onto an unsigned position.
Trait Implementations§
source§impl<T: Number> AddAssign for Point3D<T>
impl<T: Number> AddAssign for Point3D<T>
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresource§impl<T: Number> MulAssign<T> for Point3D<T>
impl<T: Number> MulAssign<T> for Point3D<T>
source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*=
operation. Read moresource§impl<T: Ord + Number> Ord for Point3D<T>
impl<T: Ord + Number> Ord for Point3D<T>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T: PartialOrd + Number> PartialOrd for Point3D<T>
impl<T: PartialOrd + Number> PartialOrd for Point3D<T>
source§impl<T: Number> SubAssign for Point3D<T>
impl<T: Number> SubAssign for Point3D<T>
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl<T: Copy + Number> Copy for Point3D<T>
impl<T: Eq + Number> Eq for Point3D<T>
impl<T: Number> StructuralPartialEq for Point3D<T>
Auto Trait Implementations§
impl<T> Freeze for Point3D<T>where
T: Freeze,
impl<T> RefUnwindSafe for Point3D<T>where
T: RefUnwindSafe,
impl<T> Send for Point3D<T>where
T: Send,
impl<T> Sync for Point3D<T>where
T: Sync,
impl<T> Unpin for Point3D<T>where
T: Unpin,
impl<T> UnwindSafe for Point3D<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)