Another geometry question.

In article <37E1E260.AEBDB...@primus.com.au>, Arash <tprod...@primus.com.au>
writes:

Quote
>Does anyone know how to use vector math to calculate
>1.) weather or not 2 line segments intersect

Its not vector math but the answer to this problem I referred to in my response
to "Geometry Help Needed" is an elegant solution using checks of clockwise-ity.

Basically one takes one line (Pt1 to Pt2) and taking each end of the other line
(Pt3 to Pt4) one finds the rotation (clockwise or anti-clockwise) when moving
from Pt1 via Pt 3 to Pt2, and when moving from Pt1 via Pt4 to Pt2.

This check is done for the line Pt1 to Pt2 via the points Pt3 and Pt4, and also
for the line Pt3 to Pt4 via the points Pt1 and Pt2.

If the two checks both result in opposite signs of rotations then the lines
intersect.

The rotation sign is obtained by comparing slopes from Pt1 to Pt3 with that
from Pt1 to Pt2, and similarly for the others.

This algorithm is implemented in C++ in Win32 help. Enter "Alternative" in help
Find, and choose the "Alternative to PtInRegion() for Hit-Testing" topic.

Alan Lloyd
alangll...@aol.com