Chapter 10: Curves and Surfaces Part 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 1 Mohan Sridharan Based on Slides.

Slides:



Advertisements
Similar presentations
Splines I – Curves and Properties
Advertisements

Lecture Notes #11 Curves and Surfaces II
Lecture 10 Curves and Surfaces I
Dr. S.M. Malaek Assistant: M. Younesi
08/30/00 Dinesh Manocha, COMP258 Hermite Curves A mathematical representation as a link between the algebraic & geometric form Defined by specifying the.
1 Curves and Surfaces. 2 Representation of Curves & Surfaces Polygon Meshes Parametric Cubic Curves Parametric Bi-Cubic Surfaces Quadric Surfaces Specialized.
Slide 127 October 1999CS Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to in Hearn & Baker Splines can be 2D.
Curves Locus of a point moving with one degree of freedom
Designing Parametric Cubic Curves Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Geometric Modeling Surfaces Mortenson Chapter 6 and Angel Chapter 9.
Drawing Parametric Curves Jean-Paul Mueller. Curves - The parametric form of a curve expresses the value of each spatial variable for points on the curve.
Bezier and Spline Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Modelling: Curves Week 11, Wed Mar 23
RASTER CONVERSION ALGORITHMS FOR CURVES: 2D SPLINES 2D Splines - Bézier curves - Spline curves.
Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Bezier and Spline Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
COEN Computer Graphics I
Designing Parametric Cubic Curves
1 Representing Curves and Surfaces. 2 Introduction We need smooth curves and surfaces in many applications: –model real world objects –computer-aided.
Curve Surfaces June 4, Examples of Curve Surfaces Spheres The body of a car Almost everything in nature.
Computer Graphics Lecture 13 Curves and Surfaces I.
Curve Modeling Bézier Curves
Bresenham’s Algorithm. Line Drawing Reference: Edward Angel’s book: –6 th Ed. Sections 6.8 and 6.9 Assuming: –Clipped (to fall within the window) –2D.
Curves and Surfaces CSE3AGR - Paul Taylor Polynomials of Degree n Degree is equal to the highest exponent of a term. Higher exponents result in.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
A D V A N C E D C O M P U T E R G R A P H I C S CMSC 635 January 15, 2013 Spline curves 1/23 Curves and Surfaces.
CS 376 Introduction to Computer Graphics 04 / 23 / 2007 Instructor: Michael Eckmann.
V. Space Curves Types of curves Explicit Implicit Parametric.
Introduction to virtual engineering Óbuda University John von Neumann Faculty of Informatics Institute of Intelligent Engineering Systems Lecture 3. Description.
Introduction to Computer Graphics with WebGL
Spline Representations
Intro to 3D Models Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Picking and Curves Week 6 David Breen Department of Computer Science Drexel University Based on material from Ed Angel, University of New Mexico CS 480/680.
Curves.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Angel: Interactive.
Curves & surfaces 2 & 3 dimension representation.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Curves and Surfaces Chapter 10. CS 480/680 2Chapter 9 -- Hierarchical Models Introduction: Introduction: Until now we have worked with flat entities such.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
Basic Theory (for curve 02). 1.3 Parametric Curves  The main aim of computer graphics is to display an arbitrary surface so that it looks real.  The.
Representation of Curves & Surfaces Prof. Lizhuang Ma Shanghai Jiao Tong University.
Rendering Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Angel:
11/6/ :55 Graphics II Introduction to Parametric Curves and Surfaces Session 2.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Parametric Curves & Surfaces Greg Humphreys University of Virginia CS 445, Spring.
Splines I – Curves and Properties based on: Michael Gleicher Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
Computing & Information Sciences Kansas State University Lecture 31 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 32 of 42 Wednesday, 11.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 10.
Designing Parametric Cubic Curves 1. 2 Objectives Introduce types of curves ­Interpolating ­Hermite ­Bezier ­B-spline Analyze their performance.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Graphics CSCI 343, Fall 2015 Lecture 34 Curves and Surfaces III.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
Object Modeling: Curves and Surfaces CEng 477 Introduction to Computer Graphics.
Introduction to Parametric Curve and Surface Modeling.
Computer Graphics Lecture 37
University of New Mexico
University of New Mexico
University of New Mexico
Designing Parametric Cubic Curves
© University of Wisconsin, CS559 Spring 2004
Curves and Surfaces Ed Angel
Implicit Functions Some surfaces can be represented as the vanishing points of functions (defined over 3D space) Places where a function f(x,y,z)=0 Some.
UNIT-5 Curves and Surfaces.
Introduction to Computer Graphics with WebGL
Introduction to Parametric Curve and Surface Modeling
Curves and Surfaces (I)
Designing Parametric Cubic Curves
Presentation transcript:

Chapter 10: Curves and Surfaces Part 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides by Edward Angel and Dave Shreiner

Objectives Introduce types of curves and surfaces: – Explicit. – Implicit. – Parametric. – Strengths and weaknesses. Discuss Modeling and Approximations: – Conditions. – Stability. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

Escaping Flatland Until now we have worked with flat entities such as lines and polygons: – Fit well with graphics hardware. – Mathematically simple. The world is not composed of flat entities: – Need curves and curved surfaces. – May only have need at the application level. – Implementation can render them approximately with flat primitives. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

Modeling with Curves E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley data points approximating curve interpolating data point

What Makes a Good Representation? There are many ways to represent curves and surfaces. Want a representation that is: – Stable. – Smooth. – Easy to evaluate. – Must we interpolate or can we just come close to data? – Do we need derivatives? E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

Explicit Representation Dependent variables in terms of independent variables. Familiar form of curve in 2D: y=f(x) Coordinate system dependent. Cannot represent all curves (special cases): – Vertical lines and circles. Extension to 3D : – y=f(x), z=g(x) – The form z = f(x, y) defines a surface. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley x y x y z

Implicit Representation Two dimensional curve(s): f(x, y)=0 Much more robust (less coordinate system dependent): – All lines ax+by+c=0; Circles x 2 +y 2 -r 2 =0 Divides space into points that belong to curve and those that do not. Three dimensions f(x, y, z)=0 defines a surface: – Intersect two surface to get a curve. In general, difficult to solve for points that satisfy constraints. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

Algebraic Surface E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Sum of polynomials in the variables: Quadric surface (spheres, disks, cones): 2  i + j + k (at most 10 terms) Intersection of quadrics with lines provides at most two intersection points. Can solve intersection of quadrics with a ray by reducing problem to solving a quadratic equation.

Parametric Curves Separate equation for each spatial variable in terms of an independent variable/parameter (u). x=x(u) y=y(u) z=z(u) For u max  u  u min we trace out a curve in two or three dimensions: E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Locus of points: p(u)=[x(u), y(u), z(u)] T p(u) p(u min ) p(u max )

Selecting Functions Usually we can select “good” functions: – Not unique for a given spatial curve. – Approximate or interpolate known data. – Want functions that are easy to evaluate. – Want functions that are easy to differentiate: Computation of normals. Connecting pieces (segments). – Want functions that are smooth. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

Parametric Lines E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley p(u)=(1-u)p 0 +up 1 We can normalize u to be over the interval (0,1). Line connecting two points p 0 and p 1 : Ray from p 0 in the direction d: p(0) = p 0 p(1)= p 1 p(u)=p 0 +ud p(0) = p 0 p(1)= p 0 +d d

Parametric Surfaces Surfaces require 2 parameters: x=x(u,v) y=y(u,v) z=z(u,v) p(u,v) = [x(u,v), y(u,v), z(u,v)] T Want same properties as curves: – Smoothness. – Differentiability. – Ease of evaluation. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley x y z p(u,0) p(1,v) p(0,v) p(u,1)

Surface Normals We can differentiate with respect to u and v to obtain the normal at any point p. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

Parametric Planes E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Point-vector form: p(u,v)=p 0 +uq+vr n = q x r Three-point form: q r p0p0 n p0p0 n p1p1 p2p2 q = p 1 – p 0 r = p 2 – p 0

Parametric Sphere E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley x(u,v) = r cos  sin  y(u,v) = r sin  sin  z(u,v) = r cos  360       0  constant: circles of constant longitude.  constant: circles of constant latitude. differentiate to show n = p

Curve Segments After normalizing u, each curve is written as: p(u)=[x(u), y(u), z(u)] T, 1  u  0 Classical numerical methods design a single global curve. In computer graphics and CAD, it is better to design small connected curve segments. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley p(u) q(u) p(0) q(1) join point p(1) = q(0)

Parametric Polynomial Curves E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley If N=M=K, we need to determine 3(N+1) coefficients. Equivalently we need 3(N+1) independent conditions. Noting that the curves for x, y and z are independent, we can define each independently in an identical manner. We will use the form where p can be any of x, y, z:

Why Polynomials? Easy to evaluate. Continuous and differentiable everywhere: – Must worry about continuity at join points including continuity of derivatives. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley p(u) q(u) join point p(1) = q(0) but p’(1)  q’(0)

Cubic Parametric Polynomials N=M=L=3, balances ease of evaluation and flexibility in design: Four coefficients to determine for each of x, y and z. Seek four independent conditions for various values of u resulting in 4 equations in 4 unknowns for each of x, y and z. – Conditions are a mixture of continuity requirements at the join points and conditions for fitting the data. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

Cubic Polynomial Surfaces E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley General equations are of the form: where: p is any of x, y or z. Need 48 coefficients (3 independent sets of 16) to determine a surface patch. p(u,v)=[x(u,v), y(u,v), z(u,v)] T

Objectives Introduce the types of curves: – Interpolating. – Hermite. – Bezier. – B-splines. Analyze their performance. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

Design Criteria Criteria for designing parametric polynomials: – Local control of shape. – Smoothness and continuity. – Ability to evaluate derivatives. – Stability. – Ease of rendering. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

Matrix-Vector Form E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Define Then

Interpolating Curve E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley p0p0 p1p1 p2p2 p3p3 Cubic interpolating polynomial: an example of the cubic parametric polynomial. Given four data (control) points p 0, p 1,p 2, p 3 determine cubic p(u) which passes through them. Must find: c 0,c 1,c 2, c 3

Interpolation Equations E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Apply the interpolating conditions at u=0, 1/3, 2/3, 1. p 0 = p(0) = c 0 p 1 = p(1/3) = c 0 +(1/3)c 1 +(1/3) 2 c 2 +(1/3) 3 c 2 p 2 = p(2/3) = c 0 +(2/3)c 1 +(2/3) 2 c 2 +(2/3) 3 c 2 p 3 = p(1) = c 0 +c 1 +c 2 +c 3 or in matrix form with p = [p 0 p 1 p 2 p 3 ] T p=Ac

Interpolation Matrix E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Solving for c we find the interpolation matrix: Note that M I does not depend on input data and can be used for each segment in x, y, and z. c=MIpc=MIp

Interpolating Multiple Segments E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley use p = [p 0 p 1 p 2 p 3 ] T use p = [p 3 p 4 p 5 p 6 ] T Derive a set of cubic interpolating curves, each specified with four control points. Get C 0 continuity at join points but not C 1 continuity of derivatives!

Blending Functions E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Study smoothness of interpolating polynomial curves by rewriting the equation for p(u): p(u) = u T c = u T M I p = b(u) T p where b(u) = [b 0 (u) b 1 (u) b 2 (u) b 3 (u)] T is an array of blending polynomials such that: p(u) = b 0 (u)p 0 + b 1 (u)p 1 + b 2 (u)p 2 + b 3 (u)p 3 b 0 (u) = -4.5(u-1/3)(u-2/3)(u-1) b 1 (u) = 13.5u (u-2/3)(u-1) b 2 (u) = -13.5u (u-1/3)(u-1) b 3 (u) = 4.5u (u-1/3)(u-2/3)

Blending Functions These functions are not smooth: – Hence the interpolation polynomial is not smooth! – Lack of smoothness because curves have to pass through control points. – More pronounced for higher degree polynomials. – Also lack derivative continuity at joint points. – Limited use in CG applications. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

Cubic Interpolating Patch E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Need 16 conditions to determine the 16 coefficients c ij Choose at u, v = 0, 1/3, 2/3, 1

Matrix Form E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Define v = [1 v v 2 v 3 ] T C = [c ij ] P = [p ij ] p(u,v) = u T Cv If we observe that for constant u (v), we obtain interpolating curve in v (u), we can show: C=M I PM I p(u,v) = u T M I PM I T v

Blending Patches E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Each b i (u)b j (v) is a blending patch. We can therefore build and analyze surfaces from our knowledge of curves.

Other Types of Curves and Surfaces How to get around the limitations of the interpolating form? – Lack of smoothness. – Discontinuous derivatives at join points. We have four conditions (for cubics) applied to each segment: – Use them other than for interpolation. – Need only come close to the data! E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

Hermite Form E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley p(0)p(1) p’(0) p’(1) Use two interpolating conditions and two derivative conditions per segment. Ensures continuity and first derivative continuity between segments.

Equations E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Interpolating conditions are the same at ends: p(0) = p 0 = c 0 p(1) = p 3 = c 0 +c 1 +c 2 +c 3 Differentiating we find p’(u) = c 1 +2uc 2 +3u 2 c 3. Evaluating at end points: p’(0) = p’ 0 = c 1 p’(1) = p’ 3 = c 1 +2c 2 +3c 3

Matrix Form E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Solving, we find c = M H q where M H is the Hermite matrix.

Blending Polynomials E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley p(u) = b(u) T q These functions are smooth, but the Hermite form is not used directly in Computer Graphics and CAD. We usually have control points but not derivatives. However, the Hermite form is the basis of the Bezier form.

Parametric and Geometric Continuity We can require the derivatives of x, y and z to be continuous at join points (C 0 and C 1 parametric continuity). Alternately, we can only require that the tangents of the resulting curve be continuous, i.e., proportional but different magnitudes (G 1 geometry continuity). The latter gives more flexibility as we have need satisfy only two conditions rather than three at each join point. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

Example Here the p and q have the same tangents at the ends of the segment. Curves have different derivatives (same direction, different magnitude). Generate different Hermite curves. This techniques is used in drawing applications. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley

Higher Dimensional Approximations The techniques for both interpolating and Hermite curves can be used with higher dimensional parametric polynomials. For interpolating form, the resulting matrix becomes increasingly more ill- conditioned and the resulting curves less smooth and more prone to numerical errors. In both cases, there is more work in rendering the resulting polynomial curves and surfaces. E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley