From a0713598da8ef18c7dbe0742ce8d44670cd98abb Mon Sep 17 00:00:00 2001 From: Jacek Olszak <jacekolszak@gmail.com> Date: Tue, 12 Feb 2019 16:26:19 +0100 Subject: [PATCH] #159 Add test case for rotated and moved matrix --- geometry_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/geometry_test.go b/geometry_test.go index 13f90e2..b1ce00f 100644 --- a/geometry_test.go +++ b/geometry_test.go @@ -100,6 +100,12 @@ func TestMatrix_Unproject(t *testing.T) { assert.InDelta(t, unprojected.X, 2, delta) assert.InDelta(t, unprojected.Y, 2, delta) }) + t.Run("for rotated and moved matrix", func(t *testing.T) { + matrix := pixel.IM.Rotated(pixel.ZV, math.Pi/2).Moved(pixel.V(1, 1)) + unprojected := matrix.Unproject(pixel.V(1, 2)) + assert.InDelta(t, unprojected.X, 1, delta) + assert.InDelta(t, unprojected.Y, 0, delta) + }) t.Run("for singular matrix", func(t *testing.T) { matrix := pixel.Matrix{0, 0, 0, 0, 0, 0} unprojected := matrix.Unproject(pixel.ZV) -- GitLab