Geometric Primitives Code and Examples
230 likes | 248 Vues
This lecture focuses on geometric primitives, including cross products, determining areas of polygons, and segment intersection tests. It also covers additional primitives and their properties.
Geometric Primitives Code and Examples
E N D
Presentation Transcript
AMS 345/CSE 355 Computational Geometry Joe Mitchell Lecture: Geometric Primitives Code/figures from [O’Rourke]: Computational Geometry in C: Chap 1
Cross Products c b a
Cross Products c=(2,2) b=(2,1) a d=(0,-1) • Example: • ab × ac = [2,1] × [2,2] = (2*2-2*1) = 1 • ab × ad = [2,1] × [0,-1] = (2*(-1)-0*1) = -2
b c a
Proper Segment Intersection Fact: ab and cd properly intersect if and only if (1) points a and b are on opposite sides of line cd, AND (2) c and d are on opposite sides of line ab
Between b c a b c a
Diagonalie Test if segment ab, joining vertices a and b, forms a “diagonalie” = an interior or exterior diagonal for P. Check: does the segment ab avoid intersecting all edges of P, except those that share endpoints with ab? a a b b a b
InCone b a0 a1 a b a a1 a0
Additional Primitives ConvexVertex(a,P) – returns T iff a is a convex vertex of P RaySegIntersectProp RayRayIntersectProp RaySegIntersect, RayRayIntersect SegSegShareEndptOnly SegSegT-Intersect PointInTriangle SegInPolygon Etc, etc