anchor.diff:  ;;;   Created: 1998-12-02 19:26
   ;;;    Author: Gilbert Baumann <unk6@rz.uni-karlsruhe.de>
   ;;;   License: LGPL (See file COPYING for details).
  -;;;       $Id: regions.lisp,v 1.9 2001-03-12 12:00:24 rouanet Exp $
  +;;;       $Id: regions.lisp,v 1.10 2001-07-09 16:27:50 boninfan Exp $
   ;;; --------------------------------------------------------------------------------------
   ;;;  (c) copyright 1998,1999 by Gilbert Baumann
   ;;;  (c) copyright 2001 by Arnaud Rouanet (rouanet@emi.u-bordeaux.fr)
  
positive.code:         (/ (- py y0) dy))))
  
  (defun map-over-schnitt-gerade/polygon (fun x1 y1 x2 y2 points)
    (let ((n (length points)))
      (dotimes (i n)
        (let ((pv (elt points (mod (- i 1) n)))
              (po (elt points (mod i n)))
              (pn (elt points (mod (+ i 1) n))))
          (cond ((line-contains-point-p** x1 y1 x2 y2 (point-x po) (point-y po))
                 (let ((vz-1 (geraden-gleichung x1 y1 x2 y2 (point-x pn) (point-y pn)))
                       (vz-2 (geraden-gleichung x1 y1 x2 y2 (point-x pv) (point-y pv))))
                   (cond ((or (and (> vz-1 0) (< vz-2 0))
                              (and (< vz-1 0) (> vz-2 0))
                              (and (= vz-1 0) (> vz-2 0))
                              (and (> vz-1 0) (= vz-2 0)))
                          (funcall fun (position->geraden-fktn-parameter x1 y1 x2 y2 (point-x po) (point-y po)) ) ))))
                ((line-contains-point-p** x1 y1 x2 y2 (point-x pn) (point-y pn))
                 nil)
                (t
                 (multiple-value-bind (k m) 
                     (geraden-schnitt/prim x1 y1 x2 y2 (point-x po) (point-y po) (point-x pn) (point-y pn))
                   (when (and k (<= 0 m 1)) ;moegliche numerische instabilitaet
                     (funcall fun k)))))))))
  
  (defun schnitt-gerade/polygon-prim (x1 y1 x2 y2 points)
    (let ((res nil))
  
negative.code:          (- (/ (+ (* DX1 (- Y1 Y2)) (* DY1 X2) (- (* DY1 X1))) quot)))) )) )
  
  (defun geraden-gleichung (x0 y0 x1 y1 px py)
    ;; ??? This somehow tries to calculate the distance between a point
    ;; and a line. The sign of the result depends upon the side the point
    ;; is on wrt to the line. --GB
    (- (* (- py y0) (- x1 x0))
       (* (- px x0) (- y1 y0))))
  
  (defun position->geraden-fktn-parameter (x0 y0 x1 y1 px py)
    (let ((dx (- x1 x0)) (dy (- y1 y0)))
  