A directed line segment in the plane can be represented as a pair of vectors -- the vector running from the origin to the start-point of the segment, and the vector running from the origin to the end-point of the segment. Use your vector representation from exercise 2.46
to define a representation for segments with a constructor
There are no comments yet.
You must log in to post a comment.Login
(define vect1 (make-vect 1.0 2.5)) (define vect2 (make-vect 0.0 5.0)) (define segment (make-segment vect1 vect2)) (check-equal? (start-segment segment) vect1) (check-equal? (end-segment segment) vect2)