Differences From Artifact [81dbefbd30f15e79]:
- File
_lib/geo/ccw.cpp
- 2011-02-23 09:21:16 - part of checkin [4fd800b3a8] on branch trunk - Copied from private svn repository. (user: kinaba) [annotate]
- File
lib/geo/ccw.cpp
- 2011-02-23 11:18:09 - part of checkin [23dfcca431] on branch trunk - renamed _lib to lib (user: kinaba) [annotate]
To Artifact [bec880bc3280bac9]:
- File
lib/geo/ccw.cpp
- 2014-10-04 14:48:03 - part of checkin [ba015e9217] on branch trunk - 634 (user: kinaba) [annotate]
12 12 b -= a; c -= a;
13 13 if( outer_prod(b,c) > 0 ) return +1; // counter clockwise
14 14 if( outer_prod(b,c) < 0 ) return -1; // clockwise
15 15 if( inner_prod(b,c) < 0 ) return +2; // c--[a--b] on line
16 16 if( norm(b) < norm(c) ) return -2; // [a--b]--c on line
17 17 return 0; // [a--c--b] on line
18 18 }
19 +
20 +
21 +// intersection of two line segments.
22 +bool cross(CMP p1, CMP p2, CMP P1, CMP P2) {
23 + return ccw(p1,p2,P1)*ccw(p1,p2,P2)<=0 && ccw(P1,P2,p1)*ccw(P1,P2,p2)<=0;
24 +}