anchor.diff:           (cl:- xz wy)             (cl:+ yz wx)            (cl:- 1.0 (cl:+ xx yy))  0.0
            0.0                      0.0                     0.0                      1.0)))))
   
  -(defun dot (quat-a quat-b)
  -  (v4:dot quat-a quat-b))
  +(defn dot ((quat-a quaternion) (quat-b quaternion)) single-float
  +  (declare (optimize (speed 3) (safety 1) (debug 1)))
  +  "return the dot product of the quat-a and quat-b."
  +  (declare (optimize (speed 3) (safety 1) (debug 1)))
  +  (cl:+ (cl:* (w quat-a) (w quat-b))
  +        (cl:* (x quat-a) (x quat-b))
  +        (cl:* (y quat-a) (y quat-b))
  +        (cl:* (z quat-a) (z quat-b))))
   
   ;; [TODO] Look into assets (this should be a unit quaternion
  -(defun rotate (vec3 quat)
  +(defn rotate ((vec3 vec3) (quat quaternion)) vec3
     "Rotate vec3 by quaternion. Assumes quaternion is normalized."
  +  (declare (optimize (speed 3) (safety 1) (debug 1)))
     (let* ((v-mult (cl:* 2.0 (cl:+ (cl:* (x quat) (aref vec3 0))
                                    (cl:* (y quat) (aref vec3 1))
                                    (cl:* (z quat) (aref vec3 2)))))
  
positive.code:          (cl:+ xy wz)            (cl:- 1.0 (cl:+ xx zz)) (cl:- yz wx)
           (cl:- xz wy)            (cl:+ yz wx)            (cl:- 1.0 (cl:+ xx yy)))))))
  
  (defun to-mat4 (quat)
    (let ((w (w quat))  (x (x quat))  (y (y quat))  (z (z quat)))
      (let ((x2 (cl:+ x x)) (y2 (cl:+ y y)) (z2 (cl:+ z z)))
        (let ((wx (cl:* w x2))  (wy (cl:* w y2))  (wz (cl:* w z2))
  
negative.code:           (aref q 3) z)
      q))
  
  (defn 0! () quaternion
    (declare (optimize (speed 3) (safety 1) (debug 1)))
    (q! 0.0 0.0 0.0 0.0))
  
  (defn 0p ((quat quaternion)) boolean
    (declare (optimize (speed 3) (safety 1) (debug 1)))
    (let ((w (w quat)) (x (x quat)) (y (y quat)) (z (z quat)))
      (cl:= 0f0 (cl:+ (cl:* w w) (cl:* x x) (cl:* y y) (cl:* z z)))))
  
  (defn unitp ((quat quaternion)) boolean
    (declare (optimize (speed 3) (safety 1) (debug 1)))
    (let ((w (w quat)) (x (x quat)) (y (y quat)) (z (z quat)))
      (cl:= 0f0 (cl:- 1.0 (cl:* w w) (cl:* x x) (cl:* y y) (cl:* z z)))))
  
  (defn identity () quaternion
    (declare (optimize (speed 3) (safety 1) (debug 1)))
    (q! 1.0 0.0 0.0 0.0))
  
  (defn identity-p ((quat quaternion)) boolean
    (declare (optimize (speed 3) (safety 1) (debug 1)))
    (and (cl:= 0f0 (cl:- 1.0 (w quat)))
         (cl:= 0f0 (x quat))
         (cl:= 0f0 (y quat))
         (cl:= 0f0 (z quat))))
  
  (defn from-mat3 ((mat3 mat3)) quaternion
    ;;(declare (optimize (speed 3) (safety 1) (debug 1)))
    (let ((trace (m3:trace mat3)))
      (if (> trace 0s0)
          (let* ((s (sqrt (cl:+ trace 1s0)))
  