Introduction to Computer Graphics with WebGL

Slides:



Advertisements
Similar presentations
Lecture Notes #11 Curves and Surfaces II
Advertisements

Lecture 10 Curves and Surfaces I
ICS 415 Computer Graphics Bézier Splines (Chapter 8)
Overview June 9- B-Spline Curves June 16- NURBS Curves June 30- B-Spline Surfaces.
CS 445/645 Fall 2001 Hermite and Bézier Splines. Specifying Curves Control Points –A set of points that influence the curve’s shape Knots –Control points.
© University of Wisconsin, CS559 Spring 2004
B-Spline Blending Functions
1 Curves and Surfaces. 2 Representation of Curves & Surfaces Polygon Meshes Parametric Cubic Curves Parametric Bi-Cubic Surfaces Quadric Surfaces Specialized.
Splines II – Interpolating Curves
Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 161 Today’s class Curve fitting Evaluators Surfaces.
Rational Bezier Curves
Modeling of curves Needs a ways of representing curves: Reproducible - the representation should give the same curve every time; Computationally Quick;
1 Lecture 13 Modeling Curved Lines and Surfaces. 2 Types of Surfaces Ruled Surfaces B-Splines and Bezier Curves Surfaces of Revolution.
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.
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
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Curves Week 13, Mon 24 Nov 2003.
Bezier and Spline Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
COEN Computer Graphics I
Chapter 10: Curves and Surfaces Part 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Designing Parametric Cubic Curves
Curve Surfaces June 4, Examples of Curve Surfaces Spheres The body of a car Almost everything in nature.
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.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
(Spline, Bezier, B-Spline)
V. Space Curves Types of curves Explicit Implicit Parametric.
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.
1 Bezier Curves and Surfaces © Jeff Parker, Nov 2011.
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 445/645 Fall 2001 Splines/Film/Animation. Final Exam Thursday, December 13 th from 7 – 10 p.m. –Room Olsson 011 You may use one sheet of notes (8.5.
Splines IV – B-spline Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
Parametric Surfaces Define points on the surface in terms of two parameters Simplest case: bilinear interpolation s t s x(s,t)x(s,t) P 0,0 P 1,0 P 1,1.
Geometric Modelling 2 INFO410 & INFO350 S Jack Pinches
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
Representation of Curves & Surfaces Prof. Lizhuang Ma Shanghai Jiao Tong University.
Curves: ch 4 of McConnell General problem with constructing curves: how to create curves that are “smooth” CAD problem Curves could be composed of segments.
Rendering Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Angel:
11/26/02(C) University of Wisconsin Last Time BSplines.
Parametric Curves CS 318 Interactive Computer Graphics John C. Hart.
(c) 2002 University of Wisconsin
Slide 129 October 1999CS Computer Graphics (Top Changwatchai) Bézier Curves - Results of Derivation Tangents at endpoints are equal to endpoint slopes.
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.
1 CS 430/536 Computer Graphics I B-Splines and NURBS Week 5, Lecture 9 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing.
CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Curves University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
CS552: Computer Graphics Lecture 19: Bezier Curves.
Object Modeling: Curves and Surfaces CEng 477 Introduction to Computer Graphics.
Introduction to Parametric Curve and Surface Modeling.
© University of Wisconsin, CS559 Spring 2004
Representation of Curves & Surfaces
University of New Mexico
© University of Wisconsin, CS559 Fall 2004
Rendering Curves and Surfaces
Designing Parametric Cubic Curves
© University of Wisconsin, CS559 Spring 2004
UNIT-5 Curves and Surfaces.
Introduction to Parametric Curve and Surface Modeling
Designing Parametric Cubic Curves
Type to enter a caption. Computer Graphics Week 10 Lecture 2.
Overview June 9- B-Spline Curves June 16- NURBS Curves
Presentation transcript:

Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Objectives Introduce the Bezier curves and surfaces Derive the required matrices Introduce the B-spline and compare it to the standard cubic Bezier Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Bezier’s Idea (http://fr.wikipedia.org/wiki/Courbe_de_Bézier) In graphics and CAD, we do not usually have derivative data Bezier suggested using the same 4 data points as with the cubic interpolating curve to approximate the derivatives in the Hermite form Bezier worked for Renault as an engineer (from 1933 to 1975) ; He developed UNISURF in 1971. Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

Approximating Derivatives p2 located at u=2/3 p1 located at u=1/3 slope p’(1) slope p’(0) p3 p0 u Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Equations Interpolating conditions are the same p(0) = p0 = c0 p(1) = p3 = c0+c1+c2+c3 Approximating derivative conditions p’(0) = 3(p1- p0) = c0 p’(1) = 3(p3- p2) = c1+2c2+3c3 Solve four linear equations for c and we obtain c=MBp Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Bezier Matrix p(u) = uT c = uT MBp = b(u)T p blending functions Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Blending Functions Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Bernstein Polynomials The blending functions are a special case of the Bernstein polynomials These polynomials give the blending polynomials for any degree Bezier form All zeros of the functions are at 0 and 1 For any degree they all sum to 1 They are all between 0 and 1 inside (0,1) Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

Convex Hull Property The properties of the Bernstein polynomials ensure that all Bezier curves lie in the convex hull of their control points Hence, even though we do not interpolate all the data, we cannot be too far away p1 p2 convex hull Bezier curve p3 p0 Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Bezier Patches Using same data array P=[pij] as with interpolating form Patch lies in convex hull Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Analysis Although the Bezier form is much better than the interpolating form, we STILL have that the derivatives are not continuous at join points Need to align controls points to achieve continuity (see 3rd example in http://www.doc.ic.ac.uk/~dfg/AndysSplineTutorial/Beziers.html) Can we do better? Go to higher order Bezier More work Derivative continuity still only approximate Apply different conditions Tricky without letting order increase Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 B-Splines Splines : http://en.wikipedia.org/wiki/Flat_spline Basis splines: use the data at p=[pi-2 pi-1 pi pi+1]T to define curve only between pi-1 and pi Allows us to apply more continuity conditions to each segment For derivation, see pages 545-547 of reference manual Cost is 3 times as much work for curves Add one new point each time rather than three For surfaces, we do 9 times as much work Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

Cubic B-spline p(u) = uTMSp = b(u)Tp Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Cubic B-spline Example : http://www.siggraph.org/education/materials/HyperGraph/modeling/splines/demoprog/curve.html (select B-spline and create 5 points…) Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

Blending Functions p(u) = uTMSp = b(u)Tp convex hull property Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Joining B-Splines http://www.vis.uni-stuttgart.de/~kraus/LiveGraphics3D/cagd/chap8fig3b.html Move the knots to see the effects Middle knots can change the shape of 4 segments End knots affects 1, 2 or 3 segments Superimposing the first three knots forces the curve to begin at that position Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

B-Spline Patches defined over only 1/9 of region Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Splines and Basis If we examine the cubic B-spline from the perspective of each control (data) point, each interior point contributes (through the blending functions) to four segments We can rewrite p(u) in terms of the data points as defining the basis functions {Bi(u)} Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Splines and Basis Let us study the 4th point of the curve shown in http://www.vis.uni-stuttgart.de/~kraus/LiveGraphics3D/cagd/chap8fig3b.html For the leftmost segment, b3(u) multiplies that point. For the next segment, b2(u) multiplies that point. For the 3rd, it is b2(u). For the 4th, it is b0(u). Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

Basis Functions In terms of the blending polynomials (see link on slide 16) Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 To start a B-spline: We can repeat the first node 3 times We can use a phantom control point (see Figure 5.4 in http://www.doc.ic.ac.uk/~dfg/AndysSplineTutorial/BSplines.html - move P1 or P5 to see the effect) We do similarly, at the end of a B-spline. (try repeating last node in http://www.vis.uni-stuttgart.de/~kraus/LiveGraphics3D/cagd/chap8fig3b.html) Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

Generalizing Splines We can extend to splines of any degree Data and conditions do not have to be given at equally spaced values (the knots) Nonuniform and uniform splines Can have repeated knots Can force spline to interpolate points Cox-deBoor recursion gives method of evaluation http://en.wikipedia.org/wiki/Non-uniform_rational_B-spline Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

NURBS Nonuniform Rational B-Spline curves and surfaces add a fourth variable w to x,y,z Can interpret as weight to give more importance to some control data Can also interpret as moving to homogeneous coordinate Requires a perspective division NURBS act correctly for perspective viewing Quadrics are a special case of NURBS Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 NURBS First, we note that B-spline basis functions can be computed using recurrence relations : http://ibiblio.org/e-notes/Splines/Basis.htm (t0, t1, …ti, tn+k) are called the “knots” and can be selected to fit particular needs Equal spacing of the knots generates “regular” B-spline functions Uneven spacing generates NURBS (in the “second to last” figure of the link above, try moving knots above the basis functions). Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009

Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 NURBS http://www.mactech.com/articles/develop/issue_25/schneider.html Figure 7 : uniform basis functions Figure 10 : non-uniform basis functions (obtained by modifying uniform basis functions – using the knots…) In NURBS, repeating 3 times the first and the last three knots brings the curve right on the first and last control points (see slides 18 and 39 in http://www.uqac.ca/daudet/Cours/Infographie/DOCUMENTS/repertoire435/L-09_BSplines_NURBS.pdf Try it using a java applet in http://www.vis.uni-stuttgart.de/~kraus/LiveGraphics3D/cagd/chap8fig3b.html Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009