Transformation matrix accounts for coordinates being the lower-left corner of cells.

This commit is contained in:
David Vierra 2015-10-08 23:34:20 -10:00
parent adf70cf8a6
commit 4778a3c87d

View File

@ -47,6 +47,9 @@ def rotationMatrix(anchor, rotX, rotY, rotZ):
translate[3, 1] = anchor[1] translate[3, 1] = anchor[1]
translate[3, 2] = anchor[2] 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 = np.matrix(np.identity(4))
reverse_translate[3, 0] = -anchor[0] reverse_translate[3, 0] = -anchor[0]
reverse_translate[3, 1] = -anchor[1] reverse_translate[3, 1] = -anchor[1]