80 likes | 183 Views
CS 3388 3D Triangles. [online only]. Enemy Territory: Quake Wars . TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A A A A. Defining a Triangle. non-collinear. collinear. Three non-collinear points
E N D
CS 33883D Triangles [online only] Enemy Territory: Quake Wars TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAA
Defining a Triangle non-collinear collinear • Three non-collinear points • Or, equivalently, point + two non-zero, non-parallel vectors • In 3D, triangle uniquely defines plane (2-flat) b a “degenerate triangle” c ¢b ¢a c plane that triangle “lives in” y set of all possible triangles set of all possible planes many-to-one z x
Collinearity Tests • Test if 2D points collinear: • Test if 3D points collinear: b a c remember, determinant related to area, so det=0 means area of triangle=0 memorize this WARNING: floating point not precise, so must check if ¼ 0 in practice! (annoying)
Front, or Back? • Do we care which way a triangle is ‘facing’? • yes! shading, backface culling • Def’n: front-facingiff points counter- clockwise when viewed from front • Front-facing normal is here • Try it: a b n (front-facing) ¡n c will talk about these more later on a and (0,0,1) is towards eye! b c
Plane Equations from Triangle • Parametric plane from triangle: • Parametric triangle? Already got one! p(1,1) ¢b c ¢a p(2,0)
Plane Equations from Triangle • Implicit plane from triangle: a b n Need normal n orthogonal to all vectors in plane, so choose c = distance of plane from origin (0,0) Need d so that is satisfied for points in plane, so substitute p=c (whatever form you find easier)
Ray-Plane Intersection (Implicit) n r ¢r p
Ray-Plane Intersection (Parametric) c ¢a ¢b r ¢r p