Struct Point3

Source
pub struct Point3 {
    pub x: f32,
    pub y: f32,
    pub z: f32,
}
Expand description

A 3D Point with x, y and z coordinates: Point3

Fields§

§x: f32§y: f32§z: f32

Implementations§

Source§

impl Point3

Source

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

Instantiates a new Point3 with x, y and z.

Source

pub fn to_vec(&self) -> Vector3

Creates a new Vector3 relative to position (0, 0, 0)

Source

pub fn origin() -> Point3

Instantiates a Point3 with (0, 0, 0)

Source

pub fn ONE() -> Point3

Instantiates a Point3 with (1, 1, 1)

Source

pub fn transform(&self, m: M, vec: Vector3) -> Point3

Transforms a Point 3 from one vectorspace to another via a matrix3x3 transform. Same as Point2 but with Point3, Matrix3x3 and Vector3.

Trait Implementations§

Source§

impl Add<Vector3> for Point3

Source§

fn add(self, new_vec: Vector3) -> Point3

Overloads + for Points and Vectors: P + PQ = Q

Source§

type Output = Point3

The resulting type after applying the + operator.
Source§

impl Debug for Point3

Source§

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

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

impl Mul<&Point3> for &Matrix3x3

Source§

fn mul(self, vec: &Point3) -> Point3

Implements the transform matrix of a point 3 into another point 3. The order should be matrix * point because of 3x3 * 3x1 = 3x1

Source§

type Output = Point3

The resulting type after applying the * operator.
Source§

impl Mul<&Point3> for &Vector3

Source§

fn mul(self, new_vec: &Point3) -> f32

Implements the dot product of &Point3 and &Vector3 as ‘*’.

Source§

type Output = f32

The resulting type after applying the * operator.
Source§

impl Mul<&Point3> for Matrix3x3

Source§

fn mul(self, vec: &Point3) -> Point3

Implements the transform matrix of a point 3 into another point 3. The order should be matrix * point because of 3x3 * 3x1 = 3x1

Source§

type Output = Point3

The resulting type after applying the * operator.
Source§

impl PartialEq<Vector3> for Point3

Source§

fn eq(&self, other: &Vector3) -> 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.
Source§

impl PartialEq for Point3

Source§

fn eq(&self, other: &Point3) -> 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.
Source§

impl StructuralPartialEq for Point3

Auto Trait Implementations§

§

impl Freeze for Point3

§

impl RefUnwindSafe for Point3

§

impl Send for Point3

§

impl Sync for Point3

§

impl Unpin for Point3

§

impl UnwindSafe for Point3

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, 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.