> >Hello,
> > I'm writing some routines for 2D polygons and I'd like some
> >pointer to where I can learn how to determine the endpoints of an
> >intersection of two line segments when they segments are colinear
> >(coincident) over some length.
> If two line segments are colinear and overlapping, the endpoints of the
> intersection(overlap) must be 2 of their 4 endpoints. You should
> create a 1D parameterization. Pretend one of the endpoints is the
> origin. Calculate the _signed_ distance of each of the other points
> from this origin. Now you have reduced the problem of determining if 2
> intervals overlap in 1D, which you can do simply by comparing these new
> coordinates.
> Jon
> (sorry if that wasn't terriby clear, but I'm in a rush just now)
If you've already determined that the lines are collinear, you can just
compare the X coordinates of the endpoints (or Y, of course, if the lines
have large or infinite slope) to determine whether the segments overlap
and if so how. The coordinates *are* a 1D parameterisation, after all.
I'm sure this is Joe's book, anyway.
Patrick
--
, author = "J. O'Rourke"
, title = "Computational Geometry in {C}"
, publisher = "Cambridge University Press"
, year = 1994
, note = "ISBN 0-521-44592-2/Pb \$24.95,
ISBN 0-521-44034-3/Hc \$49.95.
Cambridge University Press
40 West 20th Street
New York, NY 10011-4211
1-800-872-7423
346+xi pages, 228 exercises, 200 figures, 219 references.
C code and errata available by anonymous ftp from
grendel.csc.smith.edu (131.229.222.23),
in the directory /pub/compgeom; Third Printing: Dec. 1995"
Quote:}