Struct kittycad_modeling_cmds::shared::Point3d

source ·
pub struct Point3d<T = f32> {
    pub x: T,
    pub y: T,
    pub z: T,
}
Expand description

A point in 3D space

Fields§

§x: T§y: T§z: T

Implementations§

source§

impl Point3d<LengthUnit>

source

pub fn to_millimeters(&self, from: UnitLength) -> Point3d<f64>

Convert the point to millimeters.

source§

impl Point3d<f64>

source

pub fn from_millimeters(&self, to: UnitLength) -> Point3d<LengthUnit>

Convert the point from millimeters.

source§

impl<T> Point3d<T>

source

pub fn from_2d(_: Point2d<T>, z: T) -> Self

Add the given z component to a 2D point to produce a 3D point.

source

pub fn with_w(self, w: T) -> Point4d<T>

Add the given w component to a 3D point to produce a 4D point.

source

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

Takes some closure, and calls it on each component of this point.

§Examples
use kittycad_modeling_cmds::shared::Point3d;
let p0 = Point3d{x: 1.0, y: 1.0, z: 1.0};
assert_eq!(p0.map(|n| n*2.0), Point3d{x: 2.0, y: 2.0, z:2.0});
source§

impl<T> Point3d<T>
where T: Copy,

source

pub fn uniform(value: T) -> Self

Make a point where all components have the given value.

Trait Implementations§

source§

impl<T> Add for Point3d<T>
where T: Add<Output = T>,

Arithmetic between two points happens component-wise, e.g. p + q == (p.x + q.x, p.y + q.y)

source§

type Output = Point3d<T>

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<T> AddAssign for Point3d<T>
where T: AddAssign<T>,

Arithmetic between two points happens component-wise, e.g. p + q == (p.x + q.x, p.y + q.y)

source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
source§

impl<T: Clone> Clone for Point3d<T>

source§

fn clone(&self) -> Point3d<T>

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<T: Debug> Debug for Point3d<T>

source§

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

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

impl<T: Default> Default for Point3d<T>

source§

fn default() -> Point3d<T>

Returns the “default value” for a type. Read more
source§

impl<'de, T> Deserialize<'de> for Point3d<T>
where T: Deserialize<'de>,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Point3d<f64>

source§

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

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

impl<T> Div<T> for Point3d<T>
where T: Div<Output = T> + Copy,

Applies an arithmetic operation to each component, e.g. p * 3 = (p.x * 3, p.y * 3)

source§

type Output = Point3d<T>

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl<T> Div for Point3d<T>
where T: Div<Output = T>,

Arithmetic between two points happens component-wise, e.g. p + q == (p.x + q.x, p.y + q.y)

source§

type Output = Point3d<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Point3d<T>) -> Self::Output

Performs the / operation. Read more
source§

impl<T> DivAssign<T> for Point3d<T>
where T: DivAssign<T> + Copy,

Applies an arithmetic operation to each component, e.g. p * 3 = (p.x * 3, p.y * 3)

source§

fn div_assign(&mut self, other: T)

Performs the /= operation. Read more
source§

impl<T> DivAssign for Point3d<T>
where T: DivAssign<T>,

Arithmetic between two points happens component-wise, e.g. p + q == (p.x + q.x, p.y + q.y)

source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
source§

impl<T> From<[T; 3]> for Point3d<T>

source§

fn from([x, y, z]: [T; 3]) -> Self

Converts to this type from the input type.
source§

impl From<Vec3> for Point3d<f32>

source§

fn from(v: Vec3) -> Self

Converts to this type from the input type.
source§

impl<T: JsonSchema> JsonSchema for Point3d<T>

source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
source§

impl<T> Mul<T> for Point3d<T>
where T: Mul<Output = T> + Copy,

Applies an arithmetic operation to each component, e.g. p * 3 = (p.x * 3, p.y * 3)

source§

type Output = Point3d<T>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<T> Mul for Point3d<T>
where T: Mul<Output = T>,

Arithmetic between two points happens component-wise, e.g. p + q == (p.x + q.x, p.y + q.y)

source§

type Output = Point3d<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Point3d<T>) -> Self::Output

Performs the * operation. Read more
source§

impl<T> MulAssign<T> for Point3d<T>
where T: MulAssign<T> + Copy,

Applies an arithmetic operation to each component, e.g. p * 3 = (p.x * 3, p.y * 3)

source§

fn mul_assign(&mut self, other: T)

Performs the *= operation. Read more
source§

impl<T> MulAssign for Point3d<T>
where T: MulAssign<T>,

Arithmetic between two points happens component-wise, e.g. p + q == (p.x + q.x, p.y + q.y)

source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
source§

impl<T: PartialEq> PartialEq for Point3d<T>

source§

fn eq(&self, other: &Point3d<T>) -> 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<T> Serialize for Point3d<T>
where T: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T> Sub for Point3d<T>
where T: Sub<Output = T>,

Arithmetic between two points happens component-wise, e.g. p + q == (p.x + q.x, p.y + q.y)

source§

type Output = Point3d<T>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<T> SubAssign for Point3d<T>
where T: SubAssign<T>,

Arithmetic between two points happens component-wise, e.g. p + q == (p.x + q.x, p.y + q.y)

source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
source§

impl<T: Copy> Copy for Point3d<T>

source§

impl<T> 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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoResult<T> for T

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
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> ToSmolStr for T
where T: Display + ?Sized,

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T, Rhs, Output> GroupOps<Rhs, Output> for T
where T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + AddAssign<Rhs> + SubAssign<Rhs>,

source§

impl<T, Rhs, Output> ScalarMul<Rhs, Output> for T
where T: Mul<Rhs, Output = Output> + MulAssign<Rhs>,

source§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,