Basis Variables and Equations


(setf (get 'line-segment 'basis-vars)
      '(p1x p1y p2x p2y))

(setf (get 'line-segment 'equations)
      '((= p1     (tuple (x p1x) (y p1y)))
        (= p1x    (x p1))
        (= p1y    (y p1))
        (= p2     (tuple (x p2x) (y p2y)))
        (= p2x    (x p2))
        (= p2y    (y p2))
        (= deltax (- p2x p1x))
        (= deltay (- p2y p1y))
        (= slope  (/ deltay (float deltax)))
        (= slope  (tan theta))
        (= slope  (/ 1.0 (tan phi)))
        (= length (sqrt (+ (expt deltax 2)
                           (expt deltay 2))))
        (= theta  (atan deltay deltax))
        (= phi    (- (/ pi 2.0) theta))
        (= phi    (atan deltax deltay))
        (= deltay (* length (sin theta)))
        (= deltax (* length (cos theta)))
        (= deltay (* length (cos phi)))
        (= deltax (* length (sin phi))) ) )

Contents    Page-10    Prev    Next    Page+10    Index