[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



(defun draw-arrow (view anf-punkt end-punkt &key 
                        (liniendicke 1)
                        (spitzen-winkel 40)
                        (spitzen-laenge 11))
  #|Autor: Ute/Andreas 6/91|#
  (draw-line view anf-punkt end-punkt 
             :liniendicke liniendicke)
  (draw-end-of-arrow view anf-punkt end-punkt
                     :spitzen-winkel spitzen-winkel
                     :spitzen-laenge spitzen-laenge))

(defun draw-line (view anf-punkt end-punkt &key (liniendicke 1))
  #|Autor: Ute/Andreas 6/91|#
  (with-port (wptr view)
    (when (> liniendicke 1) (_PenSize :long (make-point liniendicke liniendicke)))
    (_Moveto :long anf-punkt)
    (_Lineto :long end-punkt)))

(defun draw-end-of-arrow (view anf-punkt end-punkt
                                       &key (spitzen-winkel 40)
                                       (spitzen-laenge 11))
  #|Autor: Ute/Andreas 6/91|#
  (let* ((groesse (make-point spitzen-laenge spitzen-laenge))
         (halber-spitzen-winkel (floor (/ spitzen-winkel 2)))
         (diff (subtract-points end-punkt anf-punkt))
         (quotient (if (/= 0 (point-h diff)) 
                     (/ (point-v diff) (point-h diff)) NIL))
         (winkel (if quotient 
                   (+ (round (* (/ (atan quotient) PI) 180)) 90) 
                   (if (> 0 (point-v diff)) 180  0))))
    (when (< 0 (point-h diff)) 
      (when quotient (setq winkel (+ 180 winkel))))
    (with-port (wptr view)
      (ccl::with-rectangle-arg (r (subtract-points end-punkt groesse) (add-points end-punkt groesse))
                            (_PaintArc :ptr r :word (- winkel halber-spitzen-winkel) :word spitzen-winkel)))))

#|
Example

(let ((fenster (make-instance 'window)))
  (dotimes (x 5)
    (draw-arrow fenster (make-point 20 20)
                (make-point (+ (* 15 x) 100) (+ x 100)))))
|#
#|

The parameters are in German, the translation is:


anf-punkt = start point  of arrow
end-punkt = ende point of arrow
liniendicke = width of arrow
spitzen-winkel = angle of top of arrow
spitzen-laenge = length ot top of arrow
|#

Karsten Poeck