Struct ark_api::Conformal3
source · [−]pub struct Conformal3 { /* private fields */ }Expand description
Represents a transform with translation + rotation + uniform scale. Preserves local angles. Scale and rotation will be applied first, then translation.
Implementations
sourceimpl Conformal3
impl Conformal3
sourcepub const IDENTITY: Conformal3 = Self{ translation_and_scale: Vec4::W, rotation: Quat::IDENTITY,}
pub const IDENTITY: Conformal3 = Self{ translation_and_scale: Vec4::W, rotation: Quat::IDENTITY,}
The identity transform: doesn’t transform at all. Like multiplying with 1.
sourcepub fn from_scale_rotation_translation(
scale: f32,
rotation: Quat,
translation: Vec3
) -> Conformal3
pub fn from_scale_rotation_translation(
scale: f32,
rotation: Quat,
translation: Vec3
) -> Conformal3
A transform that first rotates and scales around the origin and then moves all points by a set amount.
Equivalent to Conformal3::from_translation(translation) * (Conformal3::from_scale(rotation) * Conformal3::from_quat(scale)).
The given rotation should be normalized.
sourcepub fn from_rotation_translation(rotation: Quat, translation: Vec3) -> Conformal3
pub fn from_rotation_translation(rotation: Quat, translation: Vec3) -> Conformal3
A transform that first rotates around the origin and then moves all points by a set amount.
Equivalent to Conformal3::from_translation(translation) * Conformal3::from_quat(rotation).
The given rotation should be normalized.
sourcepub fn from_translation(translation: Vec3) -> Conformal3
pub fn from_translation(translation: Vec3) -> Conformal3
A pure translation without any rotation or scale.
sourcepub fn to_scale_rotation_translation(&self) -> (f32, Quat, Vec3)
pub fn to_scale_rotation_translation(&self) -> (f32, Quat, Vec3)
Returns this transform decomposed into scale, rotation, translation
sourcepub fn from_quat(rotation: Quat) -> Conformal3
pub fn from_quat(rotation: Quat) -> Conformal3
A pure rotation without any translation or scale.
sourcepub fn from_scale(scale: f32) -> Conformal3
pub fn from_scale(scale: f32) -> Conformal3
A pure scale without any translation or rotation.
sourcepub fn inverse(&self) -> Conformal3
pub fn inverse(&self) -> Conformal3
Returns the inverse of this transform. my_transform * my_transform.inverse() = Conformal3::IDENITTY
sourcepub fn from_affine3a_lossy(transform: &Affine3A) -> Conformal3
pub fn from_affine3a_lossy(transform: &Affine3A) -> Conformal3
Will attempt to create a Conformal3 from an Affine3A. Assumes no shearing and uniform scaling.
If the affine transform contains shearing or non-uniform scaling it will be lost.
sourcepub fn to_affine3a(&self) -> Affine3A
pub fn to_affine3a(&self) -> Affine3A
Returns this transform as an Affine3A
sourcepub fn transform_point3(&self, value: Vec3) -> Vec3
pub fn transform_point3(&self, value: Vec3) -> Vec3
Transform a Vec3 using translation, rotation, scale.
sourcepub fn transform_vector3(&self, value: Vec3) -> Vec3
pub fn transform_vector3(&self, value: Vec3) -> Vec3
Transform a Vec3 using only rotation and scale.
sourcepub fn set_rotation(&mut self, rotation: Quat)
pub fn set_rotation(&mut self, rotation: Quat)
Sets the rotation
sourcepub fn translation(&self) -> Vec3
pub fn translation(&self) -> Vec3
Returns the translation
sourcepub fn translation_and_scale(&self) -> Vec4
pub fn translation_and_scale(&self) -> Vec4
Returns the translation and scale as a Vec4
sourcepub fn set_translation(&mut self, translation: Vec3)
pub fn set_translation(&mut self, translation: Vec3)
Sets the translation
sourcepub fn from_iso_transform(t: IsoTransform) -> Conformal3
pub fn from_iso_transform(t: IsoTransform) -> Conformal3
Builds a Conformal3 from an IsoTransform (rotation, translation).
sourcepub fn look_at_rh(eye: Vec3, target: Vec3, up: Vec3) -> Option<Conformal3>
pub fn look_at_rh(eye: Vec3, target: Vec3, up: Vec3) -> Option<Conformal3>
Creates a right-handed view transform using a camera position, a point to look at, and an up direction.
The result transforms from world coordinates to view coordinates.
For a view coordinate system with +X=right, +Y=up and +Z=back.
Will return None if any argument is zero, non-finite, or if forward and up are colinear.
Trait Implementations
sourceimpl Clone for Conformal3
impl Clone for Conformal3
sourcefn clone(&self) -> Conformal3
fn clone(&self) -> Conformal3
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for Conformal3
impl Debug for Conformal3
sourceimpl Default for Conformal3
impl Default for Conformal3
Identity transform
sourcefn default() -> Conformal3
fn default() -> Conformal3
Identity transform
sourceimpl<'de> Deserialize<'de> for Conformal3
impl<'de> Deserialize<'de> for Conformal3
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<Conformal3, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Conformal3, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Conformal3> for Affine3A
impl From<Conformal3> for Affine3A
sourcefn from(c: Conformal3) -> Affine3A
fn from(c: Conformal3) -> Affine3A
Converts to this type from the input type.
sourceimpl From<Conformal3> for Mat4
impl From<Conformal3> for Mat4
sourcefn from(c: Conformal3) -> Mat4
fn from(c: Conformal3) -> Mat4
Converts to this type from the input type.
sourceimpl From<IsoTransform> for Conformal3
impl From<IsoTransform> for Conformal3
sourcefn from(c: IsoTransform) -> Conformal3
fn from(c: IsoTransform) -> Conformal3
Converts to this type from the input type.
sourceimpl Mul<&Conformal3> for &Conformal3
impl Mul<&Conformal3> for &Conformal3
type Output = Conformal3
type Output = Conformal3
The resulting type after applying the * operator.
sourcefn mul(self, rhs: &Conformal3) -> Conformal3
fn mul(self, rhs: &Conformal3) -> Conformal3
Performs the * operation. Read more
sourceimpl Mul<Conformal3> for &Conformal3
impl Mul<Conformal3> for &Conformal3
type Output = Conformal3
type Output = Conformal3
The resulting type after applying the * operator.
sourcefn mul(self, rhs: Conformal3) -> Conformal3
fn mul(self, rhs: Conformal3) -> Conformal3
Performs the * operation. Read more
sourceimpl Mul<Conformal3> for Conformal3
impl Mul<Conformal3> for Conformal3
type Output = Conformal3
type Output = Conformal3
The resulting type after applying the * operator.
sourcefn mul(self, rhs: Conformal3) -> Conformal3
fn mul(self, rhs: Conformal3) -> Conformal3
Performs the * operation. Read more
sourceimpl Mul<Conformal3> for IsoTransform
impl Mul<Conformal3> for IsoTransform
type Output = Conformal3
type Output = Conformal3
The resulting type after applying the * operator.
sourcefn mul(self, rhs: Conformal3) -> Conformal3
fn mul(self, rhs: Conformal3) -> Conformal3
Performs the * operation. Read more
sourceimpl Mul<IsoTransform> for Conformal3
impl Mul<IsoTransform> for Conformal3
type Output = Conformal3
type Output = Conformal3
The resulting type after applying the * operator.
sourcefn mul(self, rhs: IsoTransform) -> Conformal3
fn mul(self, rhs: IsoTransform) -> Conformal3
Performs the * operation. Read more
sourceimpl Mul<Ray3> for Conformal3
impl Mul<Ray3> for Conformal3
sourceimpl PartialEq<Conformal3> for Conformal3
impl PartialEq<Conformal3> for Conformal3
sourcefn eq(&self, other: &Conformal3) -> bool
fn eq(&self, other: &Conformal3) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourceimpl<'a_, C_> Readable<'a_, C_> for Conformal3where
C_: Context,
impl<'a_, C_> Readable<'a_, C_> for Conformal3where
C_: Context,
fn read_from<R_>(
_reader_: &mut R_
) -> Result<Conformal3, <C_ as Context>::Error>where
R_: Reader<'a_, C_>,
fn minimum_bytes_needed() -> usize
fn read_from_buffer_with_ctx(
context: C,
buffer: &'a [u8]
) -> Result<Self, <C as Context>::Error>
fn read_with_length_from_buffer_with_ctx(
context: C,
buffer: &'a [u8]
) -> (Result<Self, <C as Context>::Error>, usize)
fn read_from_buffer_copying_data_with_ctx(
context: C,
buffer: &[u8]
) -> Result<Self, <C as Context>::Error>
fn read_with_length_from_buffer_copying_data_with_ctx(
context: C,
buffer: &[u8]
) -> (Result<Self, <C as Context>::Error>, usize)
fn read_with_length_from_buffer_copying_data_with_ctx_mut(
context: &mut C,
buffer: &[u8]
) -> (Result<Self, <C as Context>::Error>, usize)
fn read_from_stream_unbuffered_with_ctx<S>(
context: C,
stream: S
) -> Result<Self, <C as Context>::Error>where
S: Read,
fn read_from_stream_buffered_with_ctx<S>(
context: C,
stream: S
) -> Result<Self, <C as Context>::Error>where
S: Read,
fn read_from_file_with_ctx(
context: C,
path: impl AsRef<Path>
) -> Result<Self, <C as Context>::Error>
sourceimpl Serialize for Conformal3
impl Serialize for Conformal3
sourcefn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
sourceimpl<C_> Writable<C_> for Conformal3where
C_: Context,
impl<C_> Writable<C_> for Conformal3where
C_: Context,
fn write_to<T_>(&self, _writer_: &mut T_) -> Result<(), <C_ as Context>::Error>where
T_: Writer<C_> + ?Sized,
fn write_to_buffer_with_ctx(
&self,
context: C,
buffer: &mut [u8]
) -> Result<(), <C as Context>::Error>
fn write_to_buffer_with_ctx_mut(
&self,
context: &mut C,
buffer: &mut [u8]
) -> Result<(), <C as Context>::Error>
fn write_to_vec_with_ctx(
&self,
context: C
) -> Result<Vec<u8, Global>, <C as Context>::Error>
fn write_to_vec_with_ctx_mut(
&self,
context: &mut C
) -> Result<Vec<u8, Global>, <C as Context>::Error>
fn write_to_stream_with_ctx<S>(
&self,
context: C,
stream: S
) -> Result<(), <C as Context>::Error>where
S: Write,
fn write_to_file_with_ctx(
&self,
context: C,
path: impl AsRef<Path>
) -> Result<(), <C as Context>::Error>
fn bytes_needed(&self) -> Result<usize, <C as Context>::Error>
impl Copy for Conformal3
impl StructuralPartialEq for Conformal3
Auto Trait Implementations
impl RefUnwindSafe for Conformal3
impl Send for Conformal3
impl Sync for Conformal3
impl Unpin for Conformal3
impl UnwindSafe for Conformal3
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
