Point3

Struct Point3 

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

A point in 3D space.

Fields§

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

Implementations§

Source§

impl Point3

Source

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

Source

pub fn to_spherical(&self, center: Point3) -> Spherical

Conert from cartesian to Spherical coordinates.

Source

pub fn rotate_x(&self, theta: f32) -> Self

Rotate around the x-axis.

Source

pub fn rotate_y(&self, theta: f32) -> Self

Rotate around the y-axis.

Source

pub fn rotate_z(&self, theta: f32) -> Self

Rotate around the z-axis.

Trait Implementations§

Source§

impl Add for Point3

Source§

type Output = Point3

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign for Point3

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl Algebra for Point3

Source§

const ZERO: Self

Source§

fn scale(self, k: f32) -> Self

Multiply all coordinates by a scalar.
Source§

fn lerp(self, other: Self, t: f32) -> Self

Linear interpolation between two points.
Source§

fn mag2(self) -> f32

The square of the magnitude of the vector.
Source§

fn dist2(self, other: Self) -> f32

The distance squared between two points.
Source§

fn dot(self, other: Self) -> f32

The dot product of two vectors.
Source§

fn mag(self) -> f32

The magnitude of the vector.
Source§

fn normalize(self) -> Self

Normalize the vector.
Source§

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

The average of two vectors.
Source§

fn dist(self, other: Self) -> f32

Distance between two points.
Source§

impl Clone for Point3

Source§

fn clone(&self) -> Point3

Returns a duplicate 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 Debug for Point3

Source§

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

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

impl Div<Point3> for f32

Source§

type Output = Point3

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Point3) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<f32> for Point3

Source§

type Output = Point3

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f32) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign<f32> for Point3

Source§

fn div_assign(&mut self, rhs: f32)

Performs the /= operation. Read more
Source§

impl Mul<Point3> for f32

Source§

type Output = Point3

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Point3) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<f32> for Point3

Source§

type Output = Point3

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f32) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<f32> for Point3

Source§

fn mul_assign(&mut self, rhs: f32)

Performs the *= operation. Read more
Source§

impl Sub for Point3

Source§

type Output = Point3

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign for Point3

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl Copy 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> 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> 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V