Curves and Surfaces. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Similar documents
CS 4204 Computer Graphics

Picking and Curves Week 6

Until now we have worked with flat entities such as lines and flat polygons. Fit well with graphics hardware Mathematically simple

OUTLINE. Quadratic Bezier Curves Cubic Bezier Curves

EECS 487: Interactive Computer Graphics f

Today. B-splines. B-splines. B-splines. Computergrafik. Curves NURBS Surfaces. Bilinear patch Bicubic Bézier patch Advanced surface modeling

Computer Graphics. Curves and Surfaces. Hermite/Bezier Curves, (B-)Splines, and NURBS. By Ulf Assarsson

Bezier Curves, B-Splines, NURBS

Intro to Curves Week 4, Lecture 7

CS 536 Computer Graphics Intro to Curves Week 1, Lecture 2

3D Modeling: Surfaces

Outline. Properties of Piecewise Linear Interpolations. The de Casteljau Algorithm. Recall: Linear Interpolation

Outline. The de Casteljau Algorithm. Properties of Piecewise Linear Interpolations. Recall: Linear Interpolation

Curves and Surfaces 1

Rendering Curves and Surfaces. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Summer 2017 MATH Suggested Solution to Exercise Find the tangent hyperplane passing the given point P on each of the graphs: (a)

Intro to Curves Week 1, Lecture 2

Hardware-Accelerated Free-Form Deformation

Intro to Modeling Modeling in 3D

Curve Modeling (Spline) Dr. S.M. Malaek. Assistant: M. Younesi

2D Spline Curves. CS 4620 Lecture 13

Bias of Higher Order Predictive Interpolation for Sub-pixel Registration

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

Tu P7 15 First-arrival Traveltime Tomography with Modified Total Variation Regularization

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Curves and Surfaces Computer Graphics I Lecture 10

COMPOSITION OF STABLE SET POLYHEDRA

Design considerations

A sufficient condition for spiral cone beam long object imaging via backprojection

Central issues in modelling

Curves. Computer Graphics CSE 167 Lecture 11

Reading. 13. Texture Mapping. Non-parametric texture mapping. Texture mapping. Required. Watt, intro to Chapter 8 and intros to 8.1, 8.4, 8.6, 8.8.

Computer Graphics CS 543 Lecture 13a Curves, Tesselation/Geometry Shaders & Level of Detail

Computergrafik. Matthias Zwicker. Herbst 2010

CS-184: Computer Graphics

CSE 167: Introduction to Computer Graphics Lecture #13: Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

An introduction to interpolation and splines

Blended Deformable Models

Curves and Surfaces Computer Graphics I Lecture 9

Introduction to Computational Manifolds and Applications

Introduction to Computer Graphics

B-Splines and NURBS Week 5, Lecture 9

The Intersection of Two Ringed Surfaces and Some Related Problems

COMPUTER AIDED ENGINEERING DESIGN (BFF2612)

Curve and Surface Basics

Multiple-Choice Test Chapter Golden Section Search Method Optimization COMPLETE SOLUTION SET

2D Spline Curves. CS 4620 Lecture 18

Know it. Control points. B Spline surfaces. Implicit surfaces

Mathematician Helaman Ferguson combines science

CSE 167: Introduction to Computer Graphics Lecture 12: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

Curves D.A. Forsyth, with slides from John Hart

B-spline Curves. Smoother than other curve forms

Sung-Eui Yoon ( 윤성의 )

Fall CSCI 420: Computer Graphics. 4.2 Splines. Hao Li.

CS 153 Design of Operating Systems

CS452/552; EE465/505. Color Display Issues

Splines. Parameterization of a Curve. Curve Representations. Roller coaster. What Do We Need From Curves in Computer Graphics? Modeling Complex Shapes

The Free-form Surface Modelling System

Dgp _ lecture 2. Curves

Prof. Kozyrakis. 1. (10 points) Consider the following fragment of Java code:

Reading. 11. Texture Mapping. Texture mapping. Non-parametric texture mapping. Required. Watt, intro to Chapter 8 and intros to 8.1, 8.4, 8.6, 8.8.

Evaluating Influence Diagrams

CS770/870 Spring 2017 Curve Generation

POWER-OF-2 BOUNDARIES

Parametric curves. Reading. Curves before computers. Mathematical curve representation. CSE 457 Winter Required:

Curve Representation ME761A Instructor in Charge Prof. J. Ramkumar Department of Mechanical Engineering, IIT Kanpur

Curves and Surface I. Angel Ch.10

Lecture IV Bézier Curves

Curves and Curved Surfaces. Adapted by FFL from CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

Rational Bezier Surface

The extra single-cycle adders

For each question, indicate whether the statement is true or false by circling T or F, respectively.

Curves & Surfaces. Last Time? Progressive Meshes. Selective Refinement. Adjacency Data Structures. Mesh Simplification. Mesh Simplification

Parametric curves. Brian Curless CSE 457 Spring 2016

Augmenting the edge connectivity of planar straight line graphs to three

On the Computational Complexity and Effectiveness of N-hub Shortest-Path Routing

Bézier Splines. B-Splines. B-Splines. CS 475 / CS 675 Computer Graphics. Lecture 14 : Modelling Curves 3 B-Splines. n i t i 1 t n i. J n,i.

Triangle-Free Planar Graphs as Segments Intersection Graphs

10.2 Solving Quadratic Equations by Completing the Square

Objects 2: Curves & Splines Christian Miller CS Fall 2011

LECTURE #6. Geometric Modelling for Engineering Applications. Geometric modeling for engineering applications

ABSOLUTE DEFORMATION PROFILE MEASUREMENT IN TUNNELS USING RELATIVE CONVERGENCE MEASUREMENTS

Lecture 25: Bezier Subdivision. And he took unto him all these, and divided them in the midst, and laid each piece one against another: Genesis 15:10

Ma Lesson 18 Section 1.7

Application of Gaussian Curvature Method in Development of Hull Plate Surface

CHAPTER 1 Graphics Systems and Models 3

CS130 : Computer Graphics Curves. Tamar Shinar Computer Science & Engineering UC Riverside

Review Multicycle: What is Happening. Controlling The Multicycle Design

Multi-lingual Multi-media Information Retrieval System

VALLIAMMAI ENGINEERING COLLEGE

CS 475 / CS Computer Graphics. Modelling Curves 3 - B-Splines

Lecture 10. Diffraction. incident

Image Denoising Algorithms

Real-time mean-shift based tracker for thermal vision systems

CSE 167: Introduction to Computer Graphics Lecture #11: Bezier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

Geometry. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

11/1/13. Polygon Meshes and Implicit Surfaces. Shape Representations. Polygon Models in OpenGL. Modeling Complex Shapes

Computer Graphics Curves and Surfaces. Matthias Teschner

Modeling 3D Objects: Part 2

Transcription:

Crves and Srfaces CS 57 Interactive Compter Graphics Prof. David E. Breen Department of Compter Science E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22

Objectives Introdce types of crves and srfaces - Explicit - Implicit - Parametric - Strengths and weaknesses Discss Modeling and Approximations - Conditions - Stability E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 2

Escaping Flatland Until now we have worked with flat entities sch as lines and flat polygons - Fit well with graphics hardware - Mathematically simple Bt the world is not composed of flat entities - Need crves and crved srfaces - May only have need at the application level - Implementation can render them approximately with flat primitives E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22

Modeling with Crves data points approximating crve interpolating data point E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 4

What Makes a Good Representation? There are many ways to represent crves and srfaces Want a representation that is - Stable - Smooth - Easy to evalate - Mst we interpolate or can we jst come close to data? - Do we need derivatives? E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 5

Explicit Representation Most familiar form of crve in 2D y=f(x) Cannot represent all crves - Vertical lines - Circles Extension to D - y=f(x), z=g(x) - The form z = f(x,y) defines a srface E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 y z x y x 6

Implicit Representation Two dimensional crve(s) g(x,y)= Mch more robst - All lines ax+by+c= - Circles x 2 +y 2 -r 2 = Three dimensions g(x,y,z)= defines a srface - Intersect two srface to get a crve In general, we cannot exactly solve for points that satisfy the eqation E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 7

Algebraic Srface i j k x i y j z k = Qadric srface 2 i+j+k At most terms Can solve intersection with a ray by redcing problem to solving qadratic eqation E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 8

Parametric Crves Separate eqation for each spatial variable x=x() y=y() z=z() For max min we trace ot a crve in two or three dimensions p( min ) p() p()=[x(), y(), z()] T p( max ) E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 9

Selecting Fnctions Usally we can select good fnctions - not niqe for a given spatial crve - Approximate or interpolate known data - Want fnctions which are easy to evalate - Want fnctions which are easy to differentiate Comptation of normals Connecting pieces (segments) - Want fnctions which are smooth E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22

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

Parametric Srfaces Srfaces reqire 2 parameters x=x(,v) y=y(,v) z=z(,v) p(,v) = [x(,v), y(,v), z(,v)] T Want same properties as crves: - Smoothness - Differentiability - Ease of evalation y p(,v) z p(,) p(,) x p(,v) E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 2

E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 Normals We can differentiate with respect to and v to obtain the normal at any point p = v v v v ) /, z( ) /, y( ) /, x( ), p( = v v v v v v v v ) /, z( ) /, y( ) /, x( ), p( v v v = ), ( ), p( p n

Parametric Planes n point-vector form p(,v)=p +q+vr r n = q x r p q n three-point form p 2 q = p p r = p 2 p p p E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 4

Parametric Sphere x(,v) = r cos θ sin φ y(,v) = r sin θ sin φ z(,v) = r cos φ 6 θ 8 φ θ constant: circles of constant longitde φ constant: circles of constant latitde differentiate to show n = p E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 5

Crve Segments After normalizing, each crve is written p()=[x(), y(), z()] T, In classical nmerical methods, we design a single global crve In compter graphics and CAD, it is better to design small connected crve segments p() join point p() = q() p() q() q() E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 6

Parametric Polynomial Crves N i j x( ) = cxi y( ) = cyj z( ) = czk i= M j= L k = If N=M=K, we need to determine (N+) coefficients Eqivalently we need (N+) independent conditions Noting that the crves for x, y and z are independent, we can define each independently in an identical manner p( ) = We will se the form where p can be any of x, y, z L k = c k k k E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 7

Why Polynomials Easy to evalate Continos and differentiable everywhere - Mst worry abot continity at join points inclding continity of derivatives p() q() join point p() = q() bt p () q () E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 8

Cbic Parametric Polynomials N=M=L=, gives balance between ease of evalation and flexibility in design p( ) = k = c k For coefficients to determine for each of x, y and z Seek for independent conditions for varios vales of reslting in 4 eqations in 4 nknowns for each of x, y and z - Conditions are a mixtre of continity reqirements at the join points and conditions for fitting the data k E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 9

Cbic Polynomial Srfaces p(,v)=[x(,v), y(,v), z(,v)] T where p(, v) = p is any of x, y or z cij i= j= i v j Need 48 coefficients ( independent sets of 6) to determine a srface patch E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 2

Designing Parametric Cbic Crves CS 57 Interactive Compter Graphics Prof. David E. Breen Department of Compter Science E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 2

Objectives Introdce the types of crves - Interpolating - Hermite - Bezier - B-spline Analyze their performance E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 2 2

2 E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 Matrix-Vector Form c k k k = = ) p( = c c c c 2 c = 2 define c c T T = = ) p( then

Interpolating Crve p p p p 2 Given for data (control) points p, p,p 2, p determine cbic p() which passes throgh them Mst find c,c,c 2, c E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 2 4

2 5 E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 Interpolation Eqations apply the interpolating conditions at =, /, 2/, p =p()=c p =p(/)=c +(/)c +(/) 2 c 2 +(/) c p 2 =p(2/)=c +(2/)c +(2/) 2 c 2 +(2/) c p =p()=c +c +c 2 +c or in matrix form with p = [p p p 2 p ] T p=ac = 2 2 2 2 2 A

Interpolation Matrix Solving for c we find the interpolation matrix MI = A = 5.5 9 4.5 9 22.5.5 4.5 8.5 4.5 4.5 c=m I p Note that M I does not depend on inpt data and can be sed for each segment in x, y, and z E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 2 6

Blending Fnctions Rewriting the eqation for p() p()= T c= T M I p = b() T p where b() = [b () b () b 2 () b ()] T is an array of blending polynomials sch that p() = b ()p + b ()p + b 2 ()p 2 + b ()p b () = -4.5(-/)(-2/)(-) b () =.5 (-2/)(-) b 2 () = -.5 (-/)(-) b () = 4.5 (-/)(-2/) E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 2 7

Blending Fnctions These fnctions are not smooth - Hence the interpolation polynomial is not smooth E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 2 8

Interpolating Mltiple Segments se p = [p p p 2 p ] T se p = [p p 4 p 5 p 6 ] T Get continity at join points bt not continity of derivatives E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 2 9

E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 Interpolating Patch v c v p j j ij i o i = = = ), ( Need 6 conditions to determine the 6 coefficients c ij Choose at,v =, /, 2/,

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

2 E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 Blending Patches p v b b v p ij j j i o i ) ( ) ( ), ( = = = Each b i ()b j (v) is a blending patch Shows that we can bild and analyze srfaces from or knowledge of crves

Other Types of Crves and Srfaces How can we get arond the limitations of the interpolating form - Lack of smoothness - Discontinos derivatives at join points We have for conditions (for cbics) that we can apply to each segment - Use them other than for interpolation - Need only come close to the data E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22

Hermite Form p () p() Use two interpolating conditions and two derivative conditions per segment p() p () Ensres continity and first derivative continity between segments E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 4

Eqations Interpolating conditions are the same at ends p() = p = c p() = p = c +c +c 2 +c p() = c + +c +c 2 2 +c Differentiating we find p () = c +2c 2 + 2 c Evalating at end points p () = p = c p () = p = c +2c 2 +c E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 5

6 E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 Matrix Form c q = = 2 p' p' p p Solving, we find c=m H q where M H is the Hermite matrix = 2 2 2 MH

7 E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 Blending Polynomials p() = b() T q + + + = 2 2 2 2 2 2 2 ) b( Althogh these fnctions are smooth, the Hermite form is not sed directly in Compter Graphics and CAD becase we sally have control points bt not derivatives However, the Hermite form is the basis of the Bezier form

Parametric and Geometric Continity We can reqire the derivatives of x, y,and z to each be continos at join points (parametric continity) Alternately, we can only reqire that the tangents of the reslting crve be continos (geometry continity) The latter gives more flexibility since we need to satisfy only two conditions rather than three at each join point E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 8

Parametric Continity Continity (recall from the calcls): - Two crves are C i continos at a point p iff the i-th derivatives of the crves are eqal at p 9 Pics/Math cortesy of Dave Mont @ UMD-CP

Example Here the p and q have the same tangents at the ends of the segment bt different derivatives Generate different Hermite crves This techniqes is sed in drawing applications E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 4

Bezier and Spline Crves and Srfaces CS 57 Interactive Compter Graphics Prof. David E. Breen Department of Compter Science E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 4 2

Objectives Introdce the Bezier crves and srfaces Derive the reqired matrices Introdce the B-spline and compare it to the standard cbic Bezier E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 4

Bezier s Idea In graphics and CAD, we do not sally have derivative data Bezier sggested sing the same 4 data points as with the cbic interpolating crve to approximate the derivatives in the Hermite form E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 4 4

Approximating Derivatives p located at =/ p p 2 p 2 located at =2/ p p p'() / p p2 p'() / slope p () slope p () p p E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 4 5

Eqations Interpolating conditions are the same p() = p = c p() = p = c +c +c 2 +c Approximating derivative conditions p () = (p - p ) = c p () = (p - p 2 ) = c +2c 2 +c Solve for linear eqations for c=m B p E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 4 6

4 7 E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 Bezier Matrix = 6 MB p() = T M B p = b() T p blending fnctions

Blending Fnctions # ( ) & % 2( ( ) b() = % ( % 2 ( ) ( % ( $ ' Note that all zeros are at and which forces the fnctions to be smooth over (,) E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 4 8

Cbic Bezier Crve Mltiplying it all ot gives p() = (-) p + (-) 2 p + 2 (-) p 2 + p E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 4 9

Bernstein Polynomials The blending fnctions are a special case of the Bernstein polynomials d! k d k bkd ( ) = ( ) k!( d k)! These polynomials give the blending polynomials for any degree Bezier form - All zeros at and - For any degree they all sm to - They are all between and inside (,) E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 5

Convex Hll Property The properties of the Bernstein polynomials ensre that all Bezier crves lie within the convex hll of their control points Hence, even thogh we do not interpolate all the data, we cannot be too far away Bezier crve p p 2 convex hll p p E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 5

General Form of Bezier Crve p() = k i= p i+! # " k i $ &( ) k i i % 52

Analysis Althogh the Bezier form is mch better than the interpolating form, its derivatives are not continos at join points Can we do better? - Go to higher order Bezier More work Derivative continity still only approximate Spported by OpenGL - Apply different conditions Tricky withot letting order increase E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 5 4

B-Splines Basis splines: se the data at p=[p i-2 p i- p i p i- ] T to define crve only between p i- and p i Allows s to apply more continity conditions to each segment For cbics, we can have continity of fnction, first and second derivatives at join points Cost is times as mch work for crves - Add one new point each time rather than three For srfaces, we do 9 times as mch work E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 5 5

5 6 E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 Cbic B-spline = 6 4 MS p() = T M S p = b() T p

5 7 E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 Blending Fnctions + + + = 2 2 2 6 4 ) ( 6 ) b( convex hll property

B-splines: Knot Selection Instead of working with the parameter space t, se tmin t t t2... tm t The knot points - joint points between crve segments, Q i - Each has a knot vale - m- knots for m+ points 59 max 994 Foley/VanDam/Finer/Hges/Phillips ICG

Splines and Basis If we examine the cbic B-spline from the perspective of each control (data) point, each interior point contribtes (throgh the blending fnctions) to for segments We can rewrite p() in terms of the data points as p( ) = B ( ) i defining the basis fnctions {B i ()} p i E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 6

6 E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 Basis Fnctions 2 2 2 2 ) ( ) ( ) ( 2) ( ) ( 2 + + < + + < < < < + + = i i i i i i i i i i b b b b Bi In terms of the blending polynomials

62 ) ( ) ( ) ( otherwise, if, ) (,,,, t B t t t t t B t t t t t B t t t t B d k k d k d k d k k d k k d k k k k + + + + + + + + + = " # $ < = B-splines: Cox-deBoor Recrsion Cox-deBoor Algorithm: defines the blending fnctions for spline crves (not limited to deg ) - crves are weighted avgs of lower degree crves Let denote the i-th blending fnction for a B- spline of degree d, then: ) (, t B d i

B-spline Blending Fnctions B k, t) ( B k, (t) B k, t 2 ( B k, t ( is a step fnction that is in the interval spans two intervals and is a piecewise linear fnction that goes from to (and back) ) spans three intervals and is a piecewise qadratic that grows from to /4, then p to /4 in the middle of the second interval, back to /4, and back to ) is a cbic that spans for intervals growing from to /6 to 2/, then back to /6 and to B-spline blending fnctions 6 Pics/Math cortesy of Dave Mont @ UMD-CP

B-spline Blending Fnctions for 2 nd Degree Splines Note: can t define a polynomial with these properties (both and nonzero for ranges) Idea: sbdivide the parameter space into intervals and bild a piecewise polynomial - Each interval gets different polynomial fnction 64 Pics/Math cortesy of Dave Mont @ UMD-CP

Generalizing Splines We can extend to splines of any degree Data and conditions do not have to be given at eqally spaced vales (the knots) - Nonniform and niform splines - Can have repeated knots Can force spline to interpolate points Cox-deBoor recrsion gives method of evalation E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 6 5

NURBS Nonniform Rational B-Spline crves and srfaces add a forth variable w to x,y,z - Can interpret as weight to give more importance to some control data - Can also interpret as moving to homogeneos coordinate Reqires a perspective division - NURBS act correctly for perspective viewing Qadrics are a special case of NURBS E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 6 6

Easy to acqire Easy to render Isses with D mesh Harder to model with Error prone - split faces, holes, gaps, etc formats 67

BRep Data Strctres Winged-Edge Data Strctre (Weiler) Vertex - n edges Edge - 2 vertices - 2 faces Face - m edges 68 Pics/Math cortesy of Dave Mont @ UMD-CP

BRep Data Strctre Vertex strctre - X,Y,Z point - Pointers to n coincident edges Edge strctre - 2 pointers to end-point vertices - 2 pointers to adjacent faces - Pointer to next edge - Pointer to previos edge Face strctre - Pointers to m edges 69

Biparametric Srfaces Biparametric srfaces - A generalization of parametric crves - 2 parameters: s, t (or, v) - Two parametric fnctions 7

Bicbic Srfaces Recall the 2D crve: - G: Geometry Matrix - M: Basis Matrix - S: Polynomial Terms [s s 2 s ] For D, we allow the points in G to vary in D along t as well: 7

Observations Abot Bicbic Srfaces For a fixed t, is a crve Gradally incrementing t to t 2, we get a new crve The combination of these crves is a srface are D crves 72

Bicbic Srfaces Each is, where Transposing, we get 7

Bicbic Srfaces Sbstitting into, we get Q(s, t) The g, etc. are the control points for the Bicbic srface patch: 74

Bicbic Srfaces Writing ot gives 75

Bézier Patches Bézier Srfaces (similar definition) 77

Bezier Patches Using same data array P=[p ij ] as with interpolating form p(, v) = i= j= bi( ) b j ( v) p ij = T M B PM T B v Patch lies in convex hll E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 7 8

Blending Fnctions # ( ) & % 2( ( ) b() = % ( % 2 ( ) ( % ( $ ' Note that all zeros are at and which forces the fnctions to be smooth over (,) E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 7 9

Normals For rendering we need the normals if we want to shade - Can compte from parametric eqations p(, v) p(, v) n = v - Can se vertices of corner points to determine E. Angel and D.Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 8

Bézier Srfaces C and G continity can be achieved between two patches by setting the 4 bondary control points to be eqal G continity achieved when crosswise CPs are colinear 8

Bézier Srfaces: Example Utah Teapot Utah Teapot modeled with 6 D control points that define 2 Bézier patches with G continity 82

Rendering Crves and Srfaces CS 57 Interactive Compter Graphics Prof. David E. Breen Department of Compter Science E. Angel and D.Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 8

Objectives Introdce methods to draw crves - Approximate with lines - Finite Differences Derive the recrsive method for evalation of Bezier crves and srfaces Learn how to convert all polynomial data to data for Bezier polynomials E. Angel and D.Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 8 4

Every Crve is a Bezier Crve We can render a given polynomial sing the recrsive method if we find control points for its representation as a Bezier crve Sppose that p() is given as an interpolating crve with control points q p()= T M I q There exist Bezier control points p sch that p()= T M B p Eqating and solving, we find p=m B - M I E. Angel and D.Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 8 5

8 6 E. Angel and D.Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 Matrices Interpolating to Bezier B-Spline to Bezier = 6 5 2 2 6 5 M M I B = 4 4 2 2 4 4 M M S B

Example These three crves were all generated from the same original data sing Bezier recrsion by converting all control point data to Bezier control points Bezier Interpolating B Spline E. Angel and D.Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 8 7

Evalating Polynomials Simplest method to render a polynomial crve is to evalate the polynomial at many points and form an approximating polyline For srfaces we can form an approximating mesh of triangles or qadrilaterals Use Horner s method to evalate polynomials p()=c +(c +(c 2 +c )) - mltiplications/evalation for cbic E. Angel and D.Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 8 8

The de Castelja Algorithm Basic case, with two points: Plotting a crve via repeated linear interpolation - Given a seqence of control points - Simple case: Mapping a parameter to the line 92 Pics/Math cortesy of Dave Mont @ UMD-CP

The de Castelja Algorithm The complete soltion from the algorithm for three iterations: Final Vale 9 Pics/Math cortesy of Dave Mont @ UMD-CP

The de Castelja Algorithm The soltion after for iterations: 94 Pics/Math cortesy of Dave Mont @ UMD-CP

The de Castelja Algorithm Inpt: Iteratively set: and p,p,p 2...p n R, t R p ir (t) = ( t)p i(r ) (t) + t p (i+)(r ) (t) p i (t) = p i # % r =,...,n $ &% i =,...,n r p n (t) Then is the point with parameter vale t on the Bézier crve defined by the p i s 95

De Castelja: Arc Segment Animation 96 Animated by Max Peysakhov @ Drexel University

De Castelja: Cbic Crve Animation 97 Animated by Max Peysakhov @ Drexel University

Sbdivision Common in many areas of graphics, CAD, CAGD, vision Basic idea - primitives def d by control polygons - set of control points is not niqe more than one way to compte a crve - sbdivision refines representation of an object by introdcing more control points Allows for local modification Sbdivide to pixel resoltion 98 Pics/Math cortesy of G. Farin @ ASU

Bézier Crve Sbdivision Sbdivision allows display of crves at different/adaptive levels of resoltion Rendering systems (OpenGL, ActiveX, etc) only display polygons or lines Sbdivision generates the lines/facets that approximate the crve/srface - otpt of sbdivision sent to renderer 99

decastelja Recrsion We can se the convex hll property of Bezier crves to obtain an efficient recrsive method that does not reqire any fnction evalations - Uses only the vales at the control points Based on the idea that any polynomial and any part of a polynomial is a Bezier polynomial for properly chosen control data E. Angel and D.Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22

Splitting a Cbic Bezier p, p, p 2, p determine a cbic Bezier polynomial and its convex hll Consider left half l() and right half r() E. Angel and D.Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22

l() and r() Since l() and r() are Bezier crves, we shold be able to find two sets of control points {l, l, l 2, l } and {r, r, r 2, r } that determine them E. Angel and D.Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 2

Convex Hlls {l, l, l 2, l } and {r, r, r 2, r }each have a convex hll that that is closer to p() than the convex hll of {p, p, p 2, p } This is known as the variation diminishing property. The polyline from l to l (= r ) to r is an approximation to p(). Repeating recrsively we get better approximations. E. Angel and D.Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22

Efficient Form l = p r = p l = ½(p + p ) r = ½(p 2 + p ) l 2 = ½(l + ½( p + p 2 )) r = ½(r 2 + ½( p + p 2 )) l = r = ½(l 2 + r ) Reqires only shifts and adds! E. Angel and D.Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 5

Drawing Parametric Crves Two basic ways: Iterative evalation of x(t), y(t), z(t) for incrementally spaced vales of t - can t easily control segment lengths and error Recrsive Sbdivision via de Castelja, that stops when control points get sfficiently close to the crve - i.e. when the crve is nearly a straight line 6

Drawing Parametric Crves via Recrsive Sbdivision Idea: stop sbdivision when segment is flat enogh to be drawn w/ straight line Crve Flatness Test: - based on the convex hll - if d 2 and d are both less than some ε, then the crve is declared flat d 2 d 7

8 FYI: Compting the Distance from a Point to a Line Line is defined with two points Basic idea: - Project point P onto the line - Find the location of the projection 2 2 ) ( ) ( ) ( ) ( ) ( ), d( y y x x y x y x y x x x y y L P + + + =

The Algorithm: Drawing Parametric Crves via Recrsive Sbdivision DrawCrveRecSb(crve,e) - If straight(crve,e) then DrawLine(crve) - Else SbdivideCrve(crve,LeftCrve,RightCrve) DrawCrveRecSb(LeftCrve,e) DrawCrveRecSb(RightCrve,e) 9

Biparametric Patch (,v) pair maps to a D point on patch E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22

Bezier Patches _ Using same data array P=[p ij ] as with interpolating form p(, v) = Patch lies in convex hll i= j= bi () b j (v) p ij = T T MBPM B v E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22

Bézier Patches Expanding the smmation p(, v) = i= j= bi () b j (v) p ij = b () b (v) p + b () b (v) p + b () b 2 (v) p 2 + b () b (v) p + b () b (v) p + etc. 2

Bezier Blending Fnctions # ( ) & % 2( ( ) b() = % ( % 2 ( ) ( % ( $ ' Note that all zeros are at and which forces the fnctions to be smooth over (,) E. Angel and D. Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22

Faceting 4

Faceting 5

Utah Teapot Most famos data set in compter graphics Widely available as a list of 6 D vertices and the indices that define 2 Bezier patches E. Angel and D.Shreiner: Interactive Compter Graphics 6E Addison-Wesley 22 6

Bezier Srface: Example Increased facet resoltion Rendered 7

Sggestions for HW7 Write a fnction that takes control points and a (,v) pair and retrns a D point on patch. Use formla or de Castelja Algorithm to compte point Compte an array of points that lie on the patch with a doble loop that increments throgh and v, from to This wold be an (n+) x (n+) array, where n is the nmber of qads in the and v direction 8

Sggestions for HW7 Use a doble loop to iterate throgh i & j = to n- For each (i, j) pair yo define two triangles. The first has vertices ([i,j], [i+, j], [i, j+]). The 2nd triangle is defined with vertices [i+, j], [i+, j+], [i, j+]). Now yo have a mesh defined like an SMF model. Modify yor HW6 code to render it. 9

Sggestions for HW7 Implement the interface that allows the ser to change n (the resoltion of the mesh), and select and move the control points When these vales are changed by the ser, yo'll need to regenerate the mesh Flip normals that face away from the eye point, so both sides of the mesh are shaded 2