The Essentials of CAGD Chapter 2: Lines and Planes Gerald Farin & Dianne Hansford CRC Press, Taylor & Francis Group, An A K Peters Book www.farinhansford.com/books/essentials-cagd c 2000 Farin & Hansford The Essentials of CAGD 1 / 27
Outline 1 Introduction to Lines and Planes 2 Linear Interpolation 3 Line Forms 4 Planes 5 Linear Pieces: Polygons 6 Linear Pieces: Triangulations 7 Working with Triangulations Farin & Hansford The Essentials of CAGD 2 / 27
Introduction to Lines and Planes A triangulation of the Stanford bunny Basics of lines and planes Building blocks of polygons and triangles Fundamental operation: Linear interpolation geometric building block for most geometry computation comprised of just addition and multiplication Farin & Hansford The Essentials of CAGD 3 / 27
Linear Interpolation Points p and q define a line How can we describe all points on this line? Imagine a particle x traversing the line starting at p at time t = 0 passing through q at time t = 1 Assume the speed of the particle is constant Location of x depends on the time t write x(t) Where is x(t) at any given time t? Know x(0) = p and x(1) = q Reasonable to expect x( 1 2 ) = 1 2 p+ 1 2 q x(t) = (1 t)p+tq Parametric form of a line or linear interpolation t called the parameter Farin & Hansford The Essentials of CAGD 4 / 27
Linear Interpolation Example p = [ ] 20 2 q = [ ] 10 10 At t = 1 3 : x( 1 3 ) = 2 3 p+ 1 [ ] 10 3 q = 2 Domain is the set of real numbers x(t) in the range of the map t is the preimage of x(t) Farin & Hansford The Essentials of CAGD 5 / 27
Linear Interpolation Linear interpolation is an affine map Ratios in preimage and image are the same Since t = (1 t) 0+t 1 ratio(0,t,1) = t and ratio(p,x(t),q) = t 1 t 1 t [ ] [ ] [ ] 0 t 1 Embed the 1D points 0,t,1 in 2D:,, 0 0 0 Determine scale, rotation, and translation to map [0, 1] onto [p, q] A and v [ ] t x = A +v 0 More work than x(t) = (1 t)p+tq not practical! Farin & Hansford The Essentials of CAGD 6 / 27
Linear Interpolation Parametric form easily extends to 3D 3D points p and q x(t) on line through them Parameter t can be any real number Not restricted to [0,1] Example 1 1 p = 1 q = 1 1 2 At t = 1: 3 x( 1) = 2p q = 1 4 Farin & Hansford The Essentials of CAGD 7 / 27
Linear Interpolation A straight line is infinite In many practical applications only need the finite part between p and q Referred to as a line segment Might want the line segment to be associated with [a,b] Let u be the parameter value associated with [a,b] Construct the affine map which takes u [a,b] to t [0,1] t = u a b a and 1 t = b u b a Parameter u is referred to as the global parameter t is the local parameter Process of changing intervals is called a parameter transformation Farin & Hansford The Essentials of CAGD 8 / 27
Linear Interpolation Example p = [ ] 1900 1K q = [ ] 2000 100K What is the data point for the year 1990? The year 1990 is a global parameter The local parameter for the line through p and q: The data point for 1990: t = 1990 1900 2000 1900 = 9 10 x( 9 10 ) = 1 10 p+ 9 10 q = [ ] 1990 90100 Farin & Hansford The Essentials of CAGD 9 / 27
Line Forms Parametric form: x(t) = (1 t)p+tq Explicit form: y = ax +b (a is the slope, b is the y-intercept) Parametric form is more general Example: line through points [ ] 0 0 and [ ] 0 1 Cannot be expressed in explicit form Parametric form has natural 3D extension Explicit form does not Farin & Hansford The Essentials of CAGD 10 / 27
Line Forms Convert explicit to parametric Choose any two points on the line For example: corresponding to x = 0 and x = 1 [ ] [ ] x(t) 0 x(t) = = (1 t) +t y(t) b [ 1 a+b ] Parametric form can be written as x(t) = p+t(q p) Direction of the line: v = q p and v perpendicular to v Point normal form: v [x p] = 0 [ ] x Let x = then point normal form transformed to y Implicit form: ax +by = c Farin & Hansford The Essentials of CAGD 11 / 27
Line Forms Example Implicit line 3x 2y = 1 [ ] [ ] 1 1 p 1 = p 1 2 = 1 Sketch the implicit line: Find one point [ on] the line: p 1 3 Vector v = 2 v = [ ] 2 3 or v = [ ] 2 3 Farin & Hansford The Essentials of CAGD 12 / 27
Planes Plane: 3D analog to a 2D line Defined by three noncollinear points p,q,r Any point x of the form is in that plane x = up+vq+wr with u +v +w = 1 Volume of the tetrahedron: vol(p,q,r,x) = 1 6 1 1 1 1 p q r x Vanishes since last column is a linear combination of the first three Tetrahedron with zero volume is a plane x is in the plane spanned by p,q,r Farin & Hansford The Essentials of CAGD 13 / 27
Planes Since w = 1 u v x = up+vq+wr = r+u(p r)+v(q r) Point vector form of a plane (still in parametric form) Implicit form: n = [p r] [q r] is orthogonal (normal) to the plane Any point x in the plane must satisfy Point normal form: n[x r] = 0 After some algebra this is transformed to x ax +by +cz = d where x = y z Best form for testing if x lies in the plane Farin & Hansford The Essentials of CAGD 14 / 27
Planes Example Given: three points p = 1 0 q = 0 1 r = 1 1 1 1 0 Find: implicit plane through points Compute: a normal vector to the plane: 1 n = [p r] [q r] = 1 1 1 1 x 1 y 1 = 0 1 z x +y +z = 2 Farin & Hansford The Essentials of CAGD 15 / 27
Linear Pieces: Polygons In many applications objects formed by linear or planar pieces 2D case: line segments pieced together to form polygons Polygon given by a set of points p 1,...,p N Line segment connects p i to p i+1 Points called vertices Line segments called edges Polygons may be open or closed Farin & Hansford The Essentials of CAGD 16 / 27
Linear Pieces: Polygons Closed polygons classified as convex or nonconvex Convexity tests: Rubberband test Convex hull: area enclosed by rubberband Line segment inclusion test Farin & Hansford The Essentials of CAGD 17 / 27
Linear Pieces: Triangulations Most fundamental entity in computer graphics: triangles Most rendering boils down to determining how a triangular facet interacts with the lighting model CAD/CAM has historically used triangles as a centerpiece geometric entity for computations such as tool paths and finite element analysis (FEM) The reason: computations are very simple and fast Farin & Hansford The Essentials of CAGD 18 / 27
Linear Pieces: Triangulations Triangulations can be generated through the use of laser digitizers Scan an object using laser rays Scanning generates x,y,z coordinates of points Software creates triangulation Resulting triangulations tend to be large (100K + triangles) Digital Michelangelo (2B triangles) Farin & Hansford The Essentials of CAGD 19 / 27
Linear Pieces: Triangulations Triangulation: a set of triangles connecting a set of points in 2D or 3D A triangulation must satisfy the following conditions: 1. The vertices of the triangles consist of the given points 2. The interiors of any two triangles do not intersect 3. If two triangles are not disjoint, then they share a vertex or have a coinciding edge 4. All triangles are oriented consistently such that their normals point outward Farin & Hansford The Essentials of CAGD 20 / 27
Linear Pieces: Triangulations Many possibilities for a data structure might include A point list containing the coordinates of the vertices A triangle list containing triples of pointers into the point list Each triple indicates the vertices of a triangle A neighbor list containing triples of pointers into the triangle list i th triple indicates the triangles neighboring the i th triangle j th entry in a triple corresponds to neighbor opposite the j th vertex If there is no neighbor, then this is marked by an entry 1 Application optimal data structure Bad example: STL (Stereo Lithography Language) Data points listed multiply Each triangle is given explicitly by its vertices No neighbor information is given Farin & Hansford The Essentials of CAGD 21 / 27
Linear Pieces: Triangulations Point list: p 0,p 1,p 2,p 3,p 4,p 5,p 6 The triangle and neighbor lists: triangle vertices neighbors 0 1,6,4 5, 1,2 1 5,0,3, 1,3, 1 2 1,2,6 4,0, 1 3 5,3,6 5,4,1 4 2,5,6 3,2, 1 5 4,6,3 3, 1,0 Farin & Hansford The Essentials of CAGD 22 / 27
Working with Triangulations Decimation: Reduction in size of a triangulation Triangulation too dense for efficient representation Remove as many triangles as possible while staying as close to the initial triangulation Maintain a valid triangulation Basic idea: if the triangles part of a plane then replace by fewer triangles Planarity check uses a tolerance Farin & Hansford The Essentials of CAGD 23 / 27
Working with Triangulations Edge Collapse Decimation: Reduce the number of triangles by collapsing an edge Marked edge in previous Sketch is collapsed to its midpoint Have reduced the number of triangles Maintained a valid triangulation Repeat while acceptable changes to the geometry possible Farin & Hansford The Essentials of CAGD 24 / 27
Working with Triangulations Star p of a point p: Set of all triangles having p as a vertex p 6 consists triangles 0,2,3,4,5 Farin & Hansford The Essentials of CAGD 25 / 27
Working with Triangulations Flatness test: when is the geometry around an edge flat enough so that it can be collapsed? Edge collapse with a plane-based flatness test: Triangulation edge p and q Can we collapse it? Check if all triangles formed by p q are sufficiently planar Form plane: centroid point and average normal All points within a given tolerance to this plane? Yes: collapse edge Farin & Hansford The Essentials of CAGD 26 / 27
Working with Triangulations Multiresolution representation: Fine to coarse triangulations Application: transmission through the internet Farin & Hansford The Essentials of CAGD 27 / 27