Merge pull request #263 from bjz/rename-matrix-scale-functions

Rename matrix scale functions for better ergonomics
This commit is contained in:
Brendan Zabarauskas 2015-12-08 08:44:17 +11:00
commit 0094ebb726

View file

@ -217,21 +217,21 @@ impl<S: BaseFloat> Matrix4<S> {
v.x, v.y, v.z, S::one()) v.x, v.y, v.z, S::one())
} }
/// Create a homogeneous transformation matrix from a scale value.
#[inline]
pub fn from_scale(value: S) -> Matrix4<S> {
Matrix4::from_nonuniform_scale(value, value, value)
}
/// Create a homogeneous transformation matrix from a set of scale values. /// Create a homogeneous transformation matrix from a set of scale values.
#[inline] #[inline]
pub fn from_scale(x: S, y: S, z: S) -> Matrix4<S> { pub fn from_nonuniform_scale(x: S, y: S, z: S) -> Matrix4<S> {
Matrix4::new(x, S::zero(), S::zero(), S::zero(), Matrix4::new(x, S::zero(), S::zero(), S::zero(),
S::zero(), y, S::zero(), S::zero(), S::zero(), y, S::zero(), S::zero(),
S::zero(), S::zero(), z, S::zero(), S::zero(), S::zero(), z, S::zero(),
S::zero(), S::zero(), S::zero(), S::one()) S::zero(), S::zero(), S::zero(), S::one())
} }
/// Create a homogeneous transformation matrix from a scale value.
#[inline]
pub fn from_uniform_scale(value: S) -> Matrix4<S> {
Matrix4::from_scale(value, value, value)
}
/// Create a homogeneous transformation matrix that will cause a vector to point at /// Create a homogeneous transformation matrix that will cause a vector to point at
/// `dir`, using `up` for orientation. /// `dir`, using `up` for orientation.
pub fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> { pub fn look_at(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> {