R
Rod Nibbe
The Line2D class has a boolean method, intersectsLine(Line2D line), that
tests if two Line2D objects intersect. Why do you suppose it's boolean
instead of, say, returning a Point2D object with the actual point of
intersection, or null if they don't intersect? The method has to compute
the intersection anyway, so why not return the result?
I realize it's relatively simple to do this in a separate method, of
course, but it just seemed so obvious that the caller might actually
want the point of intersection -- like me!
-RKN
tests if two Line2D objects intersect. Why do you suppose it's boolean
instead of, say, returning a Point2D object with the actual point of
intersection, or null if they don't intersect? The method has to compute
the intersection anyway, so why not return the result?
I realize it's relatively simple to do this in a separate method, of
course, but it just seemed so obvious that the caller might actually
want the point of intersection -- like me!
-RKN