pub struct Xform {
pub typ: String,
pub guid: String,
pub name: String,
pub m: [f32; 16],
}
Expand description
A 4x4 column-major transformation matrix in 3D space
Fields§
§typ: String
§guid: String
§name: String
§m: [f32; 16]
The matrix elements stored in column-major order as a flattened array
Implementations§
Source§impl Xform
impl Xform
pub fn new() -> Self
pub fn from_matrix(matrix: [f32; 16]) -> Self
pub fn identity() -> Self
pub fn from_cols(col_x: Vector, col_y: Vector, col_z: Vector) -> Self
pub fn translation(x: f32, y: f32, z: f32) -> Self
pub fn scaling(x: f32, y: f32, z: f32) -> Self
pub fn rotation_x(angle_radians: f32) -> Self
pub fn rotation_y(angle_radians: f32) -> Self
pub fn rotation_z(angle_radians: f32) -> Self
pub fn rotation(axis: &Vector, angle_radians: f32) -> Self
pub fn look_at_rh(eye: &Point, target: &Point, up: &Vector) -> Self
pub fn change_basis( origin: &Point, x_axis: &Vector, y_axis: &Vector, z_axis: &Vector, ) -> Self
pub fn inverse(&self) -> Option<Xform>
pub fn transformed_point(&self, point: &Point) -> Point
pub fn transformed_vector(&self, vector: &Vector) -> Vector
pub fn transform_point(&self, point: &mut Point)
pub fn transform_vector(&self, vector: &mut Vector)
pub fn x(&self) -> Vector
pub fn y(&self) -> Vector
pub fn z(&self) -> Vector
pub fn is_identity(&self) -> bool
pub fn change_basis_alt( origin_1: &Point, x_axis_1: &Vector, y_axis_1: &Vector, z_axis_1: &Vector, origin_0: &Point, x_axis_0: &Vector, y_axis_0: &Vector, z_axis_0: &Vector, ) -> Self
pub fn plane_to_plane( origin_0: &Point, x_axis_0: &Vector, y_axis_0: &Vector, z_axis_0: &Vector, origin_1: &Point, x_axis_1: &Vector, y_axis_1: &Vector, z_axis_1: &Vector, ) -> Self
pub fn plane_to_xy( origin: &Point, x_axis: &Vector, y_axis: &Vector, z_axis: &Vector, ) -> Self
pub fn xy_to_plane( origin: &Point, x_axis: &Vector, y_axis: &Vector, z_axis: &Vector, ) -> Self
pub fn scale_xyz(scale_x: f32, scale_y: f32, scale_z: f32) -> Self
pub fn scale_uniform(origin: &Point, scale_value: f32) -> Self
pub fn scale_non_uniform( origin: &Point, scale_x: f32, scale_y: f32, scale_z: f32, ) -> Self
pub fn axis_rotation(angle: f32, axis: &Vector) -> Self
pub fn jsondump(&self) -> Result<String, Box<dyn Error>>
pub fn jsonload(json_data: &str) -> Result<Self, Box<dyn Error>>
pub fn to_json(&self, filepath: &str) -> Result<(), Box<dyn Error>>
pub fn from_json(filepath: &str) -> Result<Self, Box<dyn Error>>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Xform
impl<'de> Deserialize<'de> for Xform
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 MulAssign for Xform
impl MulAssign for Xform
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moreimpl StructuralPartialEq for Xform
Auto Trait Implementations§
impl Freeze for Xform
impl RefUnwindSafe for Xform
impl Send for Xform
impl Sync for Xform
impl Unpin for Xform
impl UnwindSafe for Xform
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more