From ce09bb1114ae520d9448a66d98379438b32266f1 Mon Sep 17 00:00:00 2001
From: faiface <faiface@ksp.sk>
Date: Mon, 4 Sep 2017 00:40:12 +0200
Subject: [PATCH] fix Matrix.Chained (wrong order of composition)

---
 geometry.go | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/geometry.go b/geometry.go
index d956bd0..0fe8a9d 100644
--- a/geometry.go
+++ b/geometry.go
@@ -348,12 +348,12 @@ func (m Matrix) Rotated(around Vec, angle float64) Matrix {
 // after the transformations of this Matrix.
 func (m Matrix) Chained(next Matrix) Matrix {
 	return Matrix{
-		m[0]*next[0] + m[2]*next[1],
-		m[1]*next[0] + m[3]*next[1],
-		m[0]*next[2] + m[2]*next[3],
-		m[1]*next[2] + m[3]*next[3],
-		m[0]*next[4] + m[2]*next[5] + m[4],
-		m[1]*next[4] + m[3]*next[5] + m[5],
+		next[0]*m[0] + next[2]*m[1],
+		next[1]*m[0] + next[3]*m[1],
+		next[0]*m[2] + next[2]*m[3],
+		next[1]*m[2] + next[3]*m[3],
+		next[0]*m[4] + next[2]*m[5] + next[4],
+		next[1]*m[4] + next[3]*m[5] + next[5],
 	}
 }
 
-- 
GitLab