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

;; name: geometry-h.gc
;; name in dgo: geometry-h
;; dgos: GAME

(define-extern quaternion-from-two-vectors-max-angle! (function quaternion vector vector float quaternion))
(define-extern vector-orient-by-quat! (function vector vector quaternion vector))

;; DECOMP BEGINS

(deftype curve (structure)
  ((cverts      (inline-array vector))
   (num-cverts  int32)
   (knots       (pointer float))
   (num-knots   int32)
   (length      float)
   )
  )


(deftype line-intersection-val (structure)
  ((tt0  float)
   (tt1  float)
   )
  )


(deftype border-plane (basic)
  ((name    symbol)
   (action  basic)
   (slot    int8)
   (trans   vector  :inline)
   (normal  vector  :inline)
   )
  (:methods
    (debug-draw (_type_) int)
    (point-past-plane? (_type_ vector) symbol)
    )
  )


(deftype lissajous (structure)
  "A curve where the x and y position are set by two different sinusoids.
This stores the parameters and state for evaluating this curve."
  ((x-mag         float)
   (y-mag         float)
   (theta         float)
   (wx            float)
   (wy            float)
   (period-shift  float)
   (theta-rate    float)
   )
  :pack-me
  (:methods
    (evaluate! (_type_ vector) vector)
    )
  )


(deftype lissajous-interp (structure)
  "Handles interpolating between two different lissajous parameters, and also
stepping forward the dynamics."
  ((current  lissajous  :inline)
   (dest     lissajous  :inline)
   (rate     lissajous  :inline)
   )
  (:methods
    (evaluate! (_type_ vector) vector)
    (update! (_type_) float)
    )
  )
