From 4778a3c87dbc6b079e1935ab76afb09e251dcea0 Mon Sep 17 00:00:00 2001 From: David Vierra Date: Thu, 8 Oct 2015 23:34:20 -1000 Subject: [PATCH] Transformation matrix accounts for coordinates being the lower-left corner of cells. --- src/mceditlib/transform.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mceditlib/transform.py b/src/mceditlib/transform.py index 3c34019..2cf0512 100644 --- a/src/mceditlib/transform.py +++ b/src/mceditlib/transform.py @@ -47,6 +47,9 @@ def rotationMatrix(anchor, rotX, rotY, rotZ): translate[3, 1] = anchor[1] translate[3, 2] = anchor[2] + # Rotate around center of cells. + anchor = Vector(*anchor) - (0.5, 0.5, 0.5) + reverse_translate = np.matrix(np.identity(4)) reverse_translate[3, 0] = -anchor[0] reverse_translate[3, 1] = -anchor[1]