Reuse through View

(gldefun line-segment-leftof-distance
  ((ls line-segment) (p vector))
    (let ( (dx (deltax ls)) (dy (deltay ls)))
      ( ( dx * ( (y p) - (p1y ls) )
        - dy * ( (x p) - (p1x ls) ) )
        / (sqrt dx ^ 2 + dy ^ 2) ) ))

(gldefun t3 ((l ls1) (p consv))
  (leftof-distance (line-segment l) p))

(LAMBDA (L P)
  (LET ((DX (* (THIRD L) (COS (FOURTH L))))
        (DY (* (THIRD L) (SIN (FOURTH L)))))
    (/ (- (* DX (- (CDR P) (SECOND L)))
          (* DY (- (FIRST P)
                   (- (FIFTH L)
                      (* (THIRD L) (COS (FOURTH L)))))))
       (SQRT (+ (EXPT DX 2) (EXPT DY 2))))))

float lsdist (l, p)
  CLS1 l; CVECTOR p;
  {   float dx, dy;
      dx = l-> size * cos(l-> angle);
      dy = l-> size * sin(l-> angle);
      return (dx * (p-> y - l-> low)
               - dy * (p-> x - (l-> right
                       - l-> size * cos(l-> angle))))
             / sqrt(square(dx) + square(dy));  }

Contents    Page-10    Prev    Next    Page+10    Index