Struct gdnative::prelude::Basis [−][src]
A 3x3 matrix.
Fields
elements: [Vector3D<f32, UnknownUnit>; 3]
Implementations
impl Basis
[src]
pub const fn identity() -> Basis
[src]
The identity basis.
Identical to calling Basis::default()
.
pub const fn flip_x() -> Basis
[src]
The basis that will flip something along the X Axis when used in a transformation.
pub const fn flip_y() -> Basis
[src]
The basis that will flip something along the Y axis when used in a transformation.
pub const fn flip_z() -> Basis
[src]
The basis that will flip something along the Z axis when used in a transformation.
pub const fn from_diagonal(p_diag: Vector3D<f32, UnknownUnit>) -> Basis
[src]
Creates a Basis from the given Vector3
pub const fn from_elements(elements: [Vector3D<f32, UnknownUnit>; 3]) -> Basis
[src]
Creates a Basis
from 3 Vector3
s
pub fn from_euler(euler: Vector3D<f32, UnknownUnit>) -> Basis
[src]
Creates a rotation matrix.
pub fn from_axis_angle(axis: &Vector3D<f32, UnknownUnit>, phi: f32) -> Basis
[src]
Rotation matrix from axis and angle.
See https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_angle
Panics
If axis
is not normalized.
pub fn invert(&mut self)
[src]
pub fn inverted(self) -> Basis
[src]
pub fn transpose(&mut self)
[src]
Transposes the matrix.
pub fn transposed(self) -> Basis
[src]
Returns the transposed version of the matrix.
pub fn determinant(&self) -> f32
[src]
Returns the determinant of the matrix.
pub fn orthonormalize(&mut self)
[src]
Orthonormalizes the matrix.
Performs a Gram-Schmidt orthonormalization on the basis of the matrix. This can be useful to call from time to time to avoid rounding errors for orthogonal matrices.
Panics
If the determinant of self
is zero.
pub fn orthonormalized(self) -> Basis
[src]
Returns an orthonormalized version of the matrix.
pub fn approx_eq(&self, other: &Basis) -> bool
[src]
Returns true
if self
and other
are approximately equal.
pub fn rotated(self, axis: Vector3D<f32, UnknownUnit>, phi: f32) -> Basis
[src]
Multiplies the matrix from left by the rotation matrix: M -> R.M
The main use of Basis
is as a Transform.basis
, which is used as the transformation matrix
of the 3D object. rotated()
here refers to rotation of the object (which is R * self
), not the matrix itself.
pub fn rotate(&mut self, axis: Vector3D<f32, UnknownUnit>, phi: f32)
[src]
Rotates the matrix.
If object rotation is needed, see Basis::rotated()
pub fn to_quat(&self) -> Rotation3D<f32, UnknownUnit, UnknownUnit>
[src]
Converts matrix into a Quaternion
Quaternions are frequently used in 3D graphics, because they enable easy and cheap interpolation. However, they are less human-readable. For Euler angles, see Basis::to_euler()
.
Panics
If self
is not normalized.
pub fn to_scale(&self) -> Vector3D<f32, UnknownUnit>
[src]
Returns the scale of the matrix.
pub fn scaled(self, scale: &Vector3D<f32, UnknownUnit>) -> Basis
[src]
Introduce an additional scaling specified by the given 3D scaling factor.
pub fn to_euler(&self) -> Vector3D<f32, UnknownUnit>
[src]
Returns the Basis
’s rotation in the form of Euler angles.
In the YXZ convention: first Z, then X, and Y last.
The returned Vector3
contains the rotation angles in the format (X angle, Y angle, Z angle).
See Basis::to_quat
if you need a quaternion instead.
pub fn xform(&self, v: Vector3D<f32, UnknownUnit>) -> Vector3D<f32, UnknownUnit>
[src]
Returns a vector transformed (multiplied) by the matrix.
pub fn xform_inv(
&self,
v: Vector3D<f32, UnknownUnit>
) -> Vector3D<f32, UnknownUnit>
[src]
&self,
v: Vector3D<f32, UnknownUnit>
) -> Vector3D<f32, UnknownUnit>
Returns a vector transformed (multiplied) by the transposed matrix.
Note: This results in a multiplication by the inverse of the matrix only if it represents a rotation-reflection.
pub fn from_transform(
transform: &Transform3D<f32, UnknownUnit, UnknownUnit>
) -> Basis
[src]
transform: &Transform3D<f32, UnknownUnit, UnknownUnit>
) -> Basis
Creates a Basis
from the rotation and scaling of the provided transform.
pub fn from_typed_transform<Src, Dst>(
transform: &Transform3D<f32, Src, Dst>
) -> Basis
[src]
transform: &Transform3D<f32, Src, Dst>
) -> Basis
Creates a Basis
from the rotation and scaling of the provided transform, in Dst
space.
pub fn tdotx(&self, v: Vector3D<f32, UnknownUnit>) -> f32
[src]
Transposed dot product with the X Axis of the matrix.
pub fn tdoty(&self, v: Vector3D<f32, UnknownUnit>) -> f32
[src]
Transposed dot product with the Y axis of the matrix.
pub fn tdotz(&self, v: Vector3D<f32, UnknownUnit>) -> f32
[src]
Transposed dot product with the Z axis of the matrix.
pub fn x(&self) -> Vector3D<f32, UnknownUnit>
[src]
Get the X Axis of the matrix
pub fn set_x(&mut self, v: Vector3D<f32, UnknownUnit>)
[src]
Set the X Axis of the matrix
pub fn y(&self) -> Vector3D<f32, UnknownUnit>
[src]
Get the Y axis of the matrix
pub fn set_y(&mut self, v: Vector3D<f32, UnknownUnit>)
[src]
Set the Y axis of the matrix
pub fn z(&self) -> Vector3D<f32, UnknownUnit>
[src]
Get the Z axis of the matrix
pub fn set_z(&mut self, v: Vector3D<f32, UnknownUnit>)
[src]
Set the Z axis of the matrix
Trait Implementations
impl Clone for Basis
[src]
impl Copy for Basis
[src]
impl Debug for Basis
[src]
impl Default for Basis
[src]
impl Export for Basis
[src]
type Hint = ()
A type-specific hint type that is valid for the type being exported.
pub fn export_info(_hint: Option<<Basis as Export>::Hint>) -> ExportInfo
[src]
impl FromVariant for Basis
[src]
pub fn from_variant(variant: &Variant) -> Result<Basis, FromVariantError>
[src]
impl Mul<Basis> for Basis
[src]
type Output = Basis
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Basis) -> Basis
[src]
impl PartialEq<Basis> for Basis
[src]
impl StructuralPartialEq for Basis
[src]
impl ToVariant for Basis
[src]
pub fn to_variant(&self) -> Variant
[src]
Auto Trait Implementations
impl RefUnwindSafe for Basis
[src]
impl Send for Basis
[src]
impl Sync for Basis
[src]
impl Unpin for Basis
[src]
impl UnwindSafe for Basis
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> OwnedToVariant for T where
T: ToVariant,
[src]
T: ToVariant,
pub fn owned_to_variant(self) -> Variant
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,