add Matrix.Chained

This commit is contained in:
faiface 2017-03-19 00:08:46 +01:00
parent 1ff57ffbe4
commit bec6bdca6a
1 changed files with 8 additions and 0 deletions

View File

@ -284,6 +284,14 @@ func (m Matrix) Rotated(around Vec, angle float64) Matrix {
return Matrix(m3) return Matrix(m3)
} }
// Chained adds another Matrix to this one. All tranformations by the next Matrix will be applied
// after the transformations of this Matrix.
func (m Matrix) Chained(next Matrix) Matrix {
m3 := mgl64.Mat3(m)
m3 = mgl64.Mat3(next).Mul3(m3)
return Matrix(m3)
}
// Project applies all transformations added to the Matrix to a vector u and returns the result. // Project applies all transformations added to the Matrix to a vector u and returns the result.
// //
// Time complexity is O(1). // Time complexity is O(1).