CS133
Computational Geometry
Computational Geometry Primitives
1
CS133 Computational Geometry Computational Geometry Primitives 1 - - PowerPoint PPT Presentation
CS133 Computational Geometry Computational Geometry Primitives 1 Point Representation A point in the 2D Cartesian space is represented as a vector from the origin to the point = , p p y O x 2 Line Segment Representation
1
2
p p x y O
3
p2 p1
4
5
6
A point in π 2 or π 3 precedes a point in π 4 or π 1 Two points in the same half are
their angle Two points with the same angle are assumed to be equal
Return π¦1 < 0? -1 : +1
Return -1
Return +1
Return π§1 < 0?-1 : +1
7
+1: π2 precedes π1 0: On the same angle
8
9
10
Return βrightβ
Return βleftβ
11
Return false
12
Return true // intersected in a point
Return true // Lines are coincident
13
14
15
16