Polygon operations?

Brett Heroux heroux at cemmva.cem.msu.edu
Fri Jan 11 13:15:57 AEST 1991


In article <4bWuKJW00VpMIo80Z=@andrew.cmu.edu>, sa1z+ at andrew.cmu.edu (Sudheer Apte) writes:
>
>I need (pointers to) a geometric modeller or other program that can do
>general 2-d polygon intersections, differences, additions, etc. based
>on any representation

Polygon intersection is usefully reduced to segment(line) intersections. I may
be able to find the code, if I can I'll e-mail, but the method goes:
Given: segment a from (x1,y1) to (x2,y2)
  and  segment b from (x3,y3) to (x4,y4)
Define: parametric equations a x = x1 + t(x2-x1) and y = y1 + t(y2-y1)
  and   "                  " b x = x3 + s(x4-x3) and y = y3 + s(y4-y3)
Find: s and t
If 0<s<1 and 0<t<1, the segments intersect, the polygons intersect.



More information about the Comp.lang.c mailing list