Skip to content
This repository was archived by the owner on May 17, 2026. It is now read-only.

Commit f4953c6

Browse files
committed
Fix ROTATE-BY
1 parent 639e9d3 commit f4953c6

1 file changed

Lines changed: 25 additions & 16 deletions

File tree

renderers/simple/transforms.lisp

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -188,26 +188,35 @@
188188

189189
(defun rotate-by (renderer phi)
190190
(let* ((matrix (transform-matrix renderer))
191+
(phi (float phi 0f0))
191192
(x (float (cos phi) 0f0))
192193
(y (float (sin phi) 0f0)))
193194
(declare (type matrix matrix))
194195
(declare (optimize speed))
195-
(setf (mref matrix 0 0) (+ (* (mref matrix 0 0) x)
196-
(* (mref matrix 0 1) y)))
197-
(setf (mref matrix 0 1) (- (* (mref matrix 0 1) x)
198-
(* (mref matrix 0 0) y)))
199-
(setf (mref matrix 1 0) (+ (* (mref matrix 1 0) x)
200-
(* (mref matrix 1 1) y)))
201-
(setf (mref matrix 1 1) (- (* (mref matrix 1 1) x)
202-
(* (mref matrix 1 0) y)))
203-
(setf (mref matrix 2 0) (+ (* (mref matrix 2 0) x)
204-
(* (mref matrix 2 1) y)))
205-
(setf (mref matrix 2 1) (- (* (mref matrix 2 1) x)
206-
(* (mref matrix 2 0) y)))
207-
(setf (mref matrix 3 0) (+ (* (mref matrix 3 0) x)
208-
(* (mref matrix 3 1) y)))
209-
(setf (mref matrix 3 1) (- (* (mref matrix 3 1) x)
210-
(* (mref matrix 3 0) y)))
196+
(let ((c00 (+ (* (mref matrix 0 0) x)
197+
(* (mref matrix 0 1) y)))
198+
(c01 (- (* (mref matrix 0 1) x)
199+
(* (mref matrix 0 0) y)))
200+
(c10 (+ (* (mref matrix 1 0) x)
201+
(* (mref matrix 1 1) y)))
202+
(c11 (- (* (mref matrix 1 1) x)
203+
(* (mref matrix 1 0) y)))
204+
(c20 (+ (* (mref matrix 2 0) x)
205+
(* (mref matrix 2 1) y)))
206+
(c21 (- (* (mref matrix 2 1) x)
207+
(* (mref matrix 2 0) y)))
208+
(c30 (+ (* (mref matrix 3 0) x)
209+
(* (mref matrix 3 1) y)))
210+
(c31 (- (* (mref matrix 3 1) x)
211+
(* (mref matrix 3 0) y))))
212+
(setf (mref matrix 0 0) c00)
213+
(setf (mref matrix 0 1) c01)
214+
(setf (mref matrix 1 0) c10)
215+
(setf (mref matrix 1 1) c11)
216+
(setf (mref matrix 2 0) c20)
217+
(setf (mref matrix 2 1) c21)
218+
(setf (mref matrix 3 0) c30)
219+
(setf (mref matrix 3 1) c31))
211220
renderer))
212221

213222
(defun orthographic-matrix (w h &optional (target (matrix)))

0 commit comments

Comments
 (0)