Added Matrix3::from_diagonal
Useful for creation of scale matrices.
This commit is contained in:
parent
38364a6439
commit
535b5aa01f
1 changed files with 7 additions and 0 deletions
|
@ -208,6 +208,13 @@ Matrix3<S> {
|
|||
_1subc * axis.y * axis.z - s * axis.x,
|
||||
_1subc * axis.z * axis.z + c)
|
||||
}
|
||||
|
||||
/// Create a matrix from a non-uniform scale
|
||||
pub fn from_diagonal(value: &Vector3<S>) -> Matrix3<S> {
|
||||
Matrix3::new(value.x, zero(), zero(),
|
||||
zero(), value.y, zero(),
|
||||
zero(), zero(), value.z)
|
||||
}
|
||||
}
|
||||
|
||||
impl<S: BaseNum> Matrix4<S> {
|
||||
|
|
Loading…
Reference in a new issue