next up previous contents index
Next: Statistics Up: Linear Algebra Previous: Points, Euclidean vectors

     
Line segments

A line is represented by a list (p v) where p is a point in the line and v is a unit vector defining the line orientation. A line segment is defined by a list (p q), where p and q are the extreme points of the line segment. Functions to manipulate line segments include:
(get-line p q dir key) //returns the line defined by p, q and dir.
                       // if q is provided then the unit vector is defined 
                       // as that from p to q.
                       // if q is not provided dir defines the unit vector.
(projection p line key) // returns the projection of point p into line l
(point-distance-to-line p line key) // distance from p to line
(point-distance-to-line-segment p p0 p1) // distance from p to (p1 p1)
(line-segment-distance-to-line p q line key)
                       // distance from (p q) to line

The argument key above plays the customary role of :key in most common lisp functions. Unfortunately, Rscheme does not provided keyword arguments in function definitions. Please check the source code in order to see how key is used in the functions above.



Emilio Remolina
2000-10-04