Commit d81b318f authored by Dave Cooper's avatar Dave Cooper

experimental changes to PDF drawing to support proper twist of view.

parent 470c7fba
......@@ -39,6 +39,45 @@
(:raphael `(let ((*raphael-translation* (add-vectors (subseq ,center 0 2) *raphael-translation*))) ,@body))))
(define-lens (pdf base-drawing)()
(with-format-slots (view)
(let ((view-center (if (the user-center)
(scalar*vector (the user-scale) (the user-center))
(make-point 0 0 0))))
(when view (unless *fixed-scale?* (pdf:scale (the-object view view-scale-total)
(the-object view view-scale-total))))
(mapc #'(lambda(child-view)
(let ((width (the-object child-view width))
(length (the-object child-view length))
(center (the-object child-view center)))
(with-translated-state (:pdf (make-point (- (get-x view-center)) (- (get-y view-center))))
(let ((rotation (angle-between-vectors-d
(the-object child-view (face-normal-vector :rear))
;;(pdf:rotate rotation)
(pdf:basic-rect (+ (get-x center) (- (half width)))
(+ (get-y center) (- (half length)))
width length)
(if (the-object child-view border-box?) (pdf:stroke)
(write-the-object child-view (cad-output rotation))))))) (the views))))))))
(define-lens (pdf base-drawing)()
......@@ -83,7 +122,7 @@
(define-lens (pdf base-view)()
(&optional rotation)
(set-format-slot view self)
......@@ -92,16 +131,22 @@
(view-center (scalar*vector (the view-scale-total)
(keyed-transform*vector (the view-transform)
(the view-center)))))
(with-translated-state (:pdf center)
(pdf:rotate rotation)
;; FLAG - look into capturing this translate in the
;; vertex-array-2d-scaled in view-object-cache. so it will
;; become unecessary here.
(with-translated-state (:pdf (make-vector (- (get-x view-center)) (- (get-y view-center))))
(dolist (cache (list-elements (the object-caches))) (write-the-object cache lines-and-curves)))
(dolist (cache (list-elements (the object-caches))) (write-the-object cache object cad-output))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment