Next: Line segments
Up: Linear Algebra
Previous: Intervals
Points, Euclidean vectors
A point (i.e. an element of R2) is represented by a list (x y)
. An n-dimensional Euclidean vector is represented by a list with n elements. The following function are provided to manipulate points and vectors:
(zero-vector? v) // true iff v = 0
(equal-vectors p q)
(equal-points p q)
(norm l) // euclidean norm of vector l
(distance p q) // euclidean distance between p and q
(unit-vector v) // v/|v|
(vect-less v1 v2) // v1 - v2
(vect-plus v1 v2) // v1 + v2
(vect-times a v) // a*v
(rth->xy r th) // returns (x,y) associated with polar coordinates (r,th)
(point-angle-2pi p) // angle in [0,2pi) associated with the point p
(point-angle+pi-pi p) // angle in [-pi,pi) associated with the point p
(get-point P1 P2 d) // returns a point d units apart from P2
// in the direction of the vector P1P2
Emilio Remolina
2000-10-04