diff --git a/geometry.go b/geometry.go index ad63f990c3954db57e4ad30c10d017f8cdf4cc1a..12a324f2ef9400183104c203277c009bdbc4ecc7 100644 --- a/geometry.go +++ b/geometry.go @@ -284,6 +284,14 @@ func (m Matrix) Rotated(around Vec, angle float64) Matrix { 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. // // Time complexity is O(1).