Struct Transform

Source
pub struct Transform { /* private fields */ }
Expand description

A Transform, when applied, modifies a mesh. When applied to a rule, it transforms all the meshes that rule eventually expands to. Transforms may be translations, scales, rotations, etc.

It may be helpful to think of transforms to rules as transforming the space in which the rule or mesh is evaluated. For example this rule will translate a cube 4.0 on the x axis in our root frame of reference:

let our_translated_cube = Rule::new().push(Tf::tx(4.0), cube());

This rule will translate a cube -4.0 on the x axis in our root frame of reference:

let containing_rule = Rule::new().push(Tf::ry(180.0), our_translated_cube);

This rule will translate a half-sized cube 2.0 on the x axis in our root frame of reference.

let containing_rule = Rule::new().push(Tf::s(0.5), our_translated_cube)

Implementations§

Source§

impl Transform

Source

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

A translation on all axes.

Source

pub fn tx(x: f32) -> Self

A translation on the x axis.

Source

pub fn ty(y: f32) -> Self

A translation on the y axis.

Source

pub fn tz(z: f32) -> Self

A translation on the z axis.

Source

pub fn s(factor: f32) -> Self

A uniform scale in all dimensions.

Source

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

A scale in all dimensions.

Source

pub fn rx(x: f32) -> Self

A rotation about the x axis.

Source

pub fn ry(y: f32) -> Self

A rotation about the y axis.

Source

pub fn rz(z: f32) -> Self

A rotation about the z axis.

Source

pub fn color(color: Hsv) -> Self

A color override that takes precedence over colors set higher in the rule tree.

Source

pub fn hue(delta: impl Into<RgbHue<f32>>) -> Self

Adds delta to the current color hue.

Source

pub fn saturation(factor: f32) -> Self

Multiplies the current color saturation by factor

Source

pub fn value(factor: f32) -> Self

Multiplies the current color value by factor.

Trait Implementations§

Source§

impl Clone for Transform

Source§

fn clone(&self) -> Transform

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 Transform

Source§

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

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

impl Default for Transform

Source§

fn default() -> Self

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

impl From<Transform> for TransformArgument

A single transform will correspond to one invocation.

Source§

fn from(transform: Transform) -> Self

Converts to this type from the input type.
Source§

impl Copy for Transform

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Component + Float, Swp: WhitePoint, Dwp: WhitePoint, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<Swp, Dwp, T>,

Convert the source color to the destination color using the specified method
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

unsafe fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.