;;-*-Lisp-*-
(in-package goal)

;; definition of type quaternion
(deftype quaternion (structure)
  ((x    float           :offset-assert   0)
   (y    float           :offset-assert   4)
   (z    float           :offset-assert   8)
   (w    float           :offset-assert  12)
   (data float   4       :offset          0)
   (vec  vector  :inline :offset          0)
   (quad uint128         :offset          0)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type quaternion
;; INFO: this function exists in multiple non-identical object files
;; INFO: Used lq/sq
(defmethod inspect quaternion ((obj quaternion))
  (format #t "[~8x] ~A~%" obj 'quaternion)
  (format #t "~Tdata[4] @ #x~X~%" (&-> obj x))
  (format #t "~Tx: ~f~%" (-> obj x))
  (format #t "~Ty: ~f~%" (-> obj y))
  (format #t "~Tz: ~f~%" (-> obj z))
  (format #t "~Tw: ~f~%" (-> obj w))
  (format #t "~Tvec: #<vector @ #x~X>~%" (&-> obj x))
  (format #t "~Tquad: ~D~%" (-> obj vec quad))
  obj
  )

;; definition for symbol *unity-quaternion*, type quaternion
(define *unity-quaternion* (new 'static 'quaternion :w 1.0))

;; failed to figure out what this is:
0
