Struct ark_api::IsoTransform
source · [−]pub struct IsoTransform { /* private fields */ }
Expand description
An isometric transform represented by translation * rotation.
An isometric transform conserves distances and angles.
The operations are applied right-to-left, so when transforming a point it will first be rotated and finally translated.
Implementations
sourceimpl IsoTransform
impl IsoTransform
sourcepub const IDENTITY: IsoTransform = Self{ rotation: Quat::IDENTITY, translation: Vec3A::ZERO,}
pub const IDENTITY: IsoTransform = Self{ rotation: Quat::IDENTITY, translation: Vec3A::ZERO,}
The identity transform: doesn’t transform at all. Like multiplying with 1
.
sourcepub fn from_rotation_translation(
rotation: Quat,
translation: Vec3
) -> IsoTransform
pub fn from_rotation_translation(
rotation: Quat,
translation: Vec3
) -> IsoTransform
A transform that first rotates around the origin and then moves all points by a set amount.
Equivalent to IsoTransform::from_translation(translation) * IsoTransform::from_quat(rotation)
.
The given rotation should be normalized.
sourcepub fn from_rotation_around_point(rotation: Quat, point: Vec3) -> IsoTransform
pub fn from_rotation_around_point(rotation: Quat, point: Vec3) -> IsoTransform
A rotation around a given point
sourcepub fn from_quat(rotation: Quat) -> IsoTransform
pub fn from_quat(rotation: Quat) -> IsoTransform
A pure rotation without any translation.
The given rotation should be normalized.
sourcepub fn from_translation(translation: Vec3) -> IsoTransform
pub fn from_translation(translation: Vec3) -> IsoTransform
A pure translation without any rotation.
sourcepub fn from_mat4(t: &Mat4) -> Option<IsoTransform>
pub fn from_mat4(t: &Mat4) -> Option<IsoTransform>
Tries to convert a 4x4 matrix to a IsoTransform
.
This may return None
as a Mat4
can represent things that a IsoTransform
cannot,
such as scale, shearing and projection.
sourcepub fn look_at_rh(eye: Vec3, target: Vec3, up: Vec3) -> Option<IsoTransform>
pub fn look_at_rh(eye: Vec3, target: Vec3, up: Vec3) -> Option<IsoTransform>
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.
pub fn rotation(&self) -> Quat
pub fn set_rotation(&mut self, rotation: Quat)
pub fn translation(&self) -> Vec3
pub fn set_translation(&mut self, translation: Vec3)
sourcepub fn inverse(&self) -> IsoTransform
pub fn inverse(&self) -> IsoTransform
Get the transform that undoes this transform so that t.inverse() * t == IDENTITY
.
sourcepub fn normalize(&self) -> IsoTransform
pub fn normalize(&self) -> IsoTransform
Returns self normalized.
You generally don’t need to call this unless you’ve multiplied A LOT of IsoTransforms
.
sourcepub fn transform_point3(&self, p: Vec3) -> Vec3
pub fn transform_point3(&self, p: Vec3) -> Vec3
Rotate and translate a point.
sourcepub fn transform_vector3(&self, v: Vec3) -> Vec3
pub fn transform_vector3(&self, v: Vec3) -> Vec3
Rotate a vector.
Trait Implementations
sourceimpl Clone for IsoTransform
impl Clone for IsoTransform
sourcefn clone(&self) -> IsoTransform
fn clone(&self) -> IsoTransform
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 IsoTransform
impl Debug for IsoTransform
sourceimpl Default for IsoTransform
impl Default for IsoTransform
Identity transform
sourcefn default() -> IsoTransform
fn default() -> IsoTransform
Identity transform
sourceimpl<'de> Deserialize<'de> for IsoTransform
impl<'de> Deserialize<'de> for IsoTransform
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<IsoTransform, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<IsoTransform, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<IsoTransform> for Affine3A
impl From<IsoTransform> for Affine3A
sourcefn from(iso: IsoTransform) -> Affine3A
fn from(iso: IsoTransform) -> Affine3A
Converts to this type from the input type.
sourceimpl From<IsoTransform> for Mat4
impl From<IsoTransform> for Mat4
sourcefn from(t: IsoTransform) -> Mat4
fn from(t: IsoTransform) -> Mat4
Converts to this type from the input type.
sourceimpl Mul<&IsoTransform> for &IsoTransform
impl Mul<&IsoTransform> for &IsoTransform
iso * iso -> iso
type Output = IsoTransform
type Output = IsoTransform
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: &IsoTransform) -> IsoTransform
fn mul(self, rhs: &IsoTransform) -> IsoTransform
Performs the *
operation. Read more
sourceimpl Mul<Affine3A> for IsoTransform
impl Mul<Affine3A> for IsoTransform
iso * affine3a -> affine3a
sourceimpl Mul<IsoTransform> for &IsoTransform
impl Mul<IsoTransform> for &IsoTransform
iso * iso -> iso
type Output = IsoTransform
type Output = IsoTransform
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: IsoTransform) -> IsoTransform
fn mul(self, rhs: IsoTransform) -> IsoTransform
Performs the *
operation. Read more
sourceimpl Mul<IsoTransform> for Affine3A
impl Mul<IsoTransform> for Affine3A
affine3a * iso -> affine3a
sourceimpl Mul<IsoTransform> for IsoTransform
impl Mul<IsoTransform> for IsoTransform
iso * iso -> iso
type Output = IsoTransform
type Output = IsoTransform
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: IsoTransform) -> IsoTransform
fn mul(self, rhs: IsoTransform) -> IsoTransform
Performs the *
operation. Read more
sourceimpl Mul<IsoTransform> for Mat4
impl Mul<IsoTransform> for Mat4
iso * mat4 -> mat4
sourceimpl Mul<Mat4> for IsoTransform
impl Mul<Mat4> for IsoTransform
mat4 * iso -> mat4
sourceimpl Mul<Ray3> for IsoTransform
impl Mul<Ray3> for IsoTransform
sourceimpl PartialEq<IsoTransform> for IsoTransform
impl PartialEq<IsoTransform> for IsoTransform
sourcefn eq(&self, other: &IsoTransform) -> bool
fn eq(&self, other: &IsoTransform) -> 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 IsoTransform where
C_: Context,
impl<'a_, C_> Readable<'a_, C_> for IsoTransform where
C_: Context,
fn read_from<R_>(
_reader_: &mut R_
) -> Result<IsoTransform, <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 IsoTransform
impl Serialize for IsoTransform
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 IsoTransform where
C_: Context,
impl<C_> Writable<C_> for IsoTransform where
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 IsoTransform
impl StructuralPartialEq for IsoTransform
Auto Trait Implementations
impl RefUnwindSafe for IsoTransform
impl Send for IsoTransform
impl Sync for IsoTransform
impl Unpin for IsoTransform
impl UnwindSafe for IsoTransform
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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