Trait crystal_ball::math::Transformable
source · pub trait Transformable: Send + Sync {
// Required methods
fn translate(self, translation: Vec3) -> Self
where Self: Sized;
fn rotate(self, origin: Point3, axis: Vec3, angle: f64) -> Self
where Self: Sized;
fn rotate_x(self, angle: f64) -> Self
where Self: Sized;
fn rotate_y(self, angle: f64) -> Self
where Self: Sized;
fn rotate_z(self, angle: f64) -> Self
where Self: Sized;
fn scale_x(self, factor: f64) -> Self
where Self: Sized;
fn scale_y(self, factor: f64) -> Self
where Self: Sized;
fn scale_z(self, factor: f64) -> Self
where Self: Sized;
fn scale_xyz(self, scale: Vec3) -> Self
where Self: Sized;
fn scale(self, origin: Point3, scale: Vec3) -> Self
where Self: Sized;
fn look_at(self, target: Point3, view_up: Vec3) -> Self
where Self: Sized;
}
Expand description
An interface to easily apply transformations.
Required Methods§
sourcefn translate(self, translation: Vec3) -> Selfwhere
Self: Sized,
fn translate(self, translation: Vec3) -> Selfwhere
Self: Sized,
Translate self
by the given translation
.
This does not set the position but shifts it.
sourcefn rotate(self, origin: Point3, axis: Vec3, angle: f64) -> Selfwhere
Self: Sized,
fn rotate(self, origin: Point3, axis: Vec3, angle: f64) -> Selfwhere
Self: Sized,
Rotate self
around the specified origin
along an arbitrary axis.
angle
is assumed to be in radians.
sourcefn rotate_x(self, angle: f64) -> Selfwhere
Self: Sized,
fn rotate_x(self, angle: f64) -> Selfwhere
Self: Sized,
Rotate self
around its center along the +X axis.
angle
is assumed to be in radians.
sourcefn rotate_y(self, angle: f64) -> Selfwhere
Self: Sized,
fn rotate_y(self, angle: f64) -> Selfwhere
Self: Sized,
Rotate self
around its center along the +Y axis.
angle
is assumed to be in radians.
sourcefn rotate_z(self, angle: f64) -> Selfwhere
Self: Sized,
fn rotate_z(self, angle: f64) -> Selfwhere
Self: Sized,
Rotate self
around its center along the +Z axis.
angle
is assumed to be in radians.
sourcefn scale_x(self, factor: f64) -> Selfwhere
Self: Sized,
fn scale_x(self, factor: f64) -> Selfwhere
Self: Sized,
Scale self
relative to its center along the +X axis.
sourcefn scale_y(self, factor: f64) -> Selfwhere
Self: Sized,
fn scale_y(self, factor: f64) -> Selfwhere
Self: Sized,
Scale self
relative to its center along the +Y axis.
sourcefn scale_z(self, factor: f64) -> Selfwhere
Self: Sized,
fn scale_z(self, factor: f64) -> Selfwhere
Self: Sized,
Scale self
relative to its center along the +Z axis.
sourcefn scale_xyz(self, scale: Vec3) -> Selfwhere
Self: Sized,
fn scale_xyz(self, scale: Vec3) -> Selfwhere
Self: Sized,
Scale self
relative to its center along all 3 dimensions.