Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 161 Today’s class Curve fitting Evaluators Surfaces.

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
Jehee Lee Seoul National University
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.
Q about GL to render polygon glBegin(GL_TRIANGLES) glVertex3f(0,0,0); glVertex3f(1,1,0); glVertex3f(1,0,0); glVertex3f(0,1,0); glEnd();
MIT EECS 6.837, Durand and Cutler Curves & Surfaces.
MIT EECS 6.837, Durand and Cutler Curves & Surfaces.
1 Lecture 13 Modeling Curved Lines and Surfaces. 2 Types of Surfaces Ruled Surfaces B-Splines and Bezier Curves Surfaces of Revolution.
Cubic Bezier and B-Spline Curves
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.
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.
Curve Surfaces June 4, Examples of Curve Surfaces Spheres The body of a car Almost everything in nature.
Splines III – Bézier Curves
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.
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
19/13/ :20 UML Graphics II Parametric Curves and Surfaces Session 3.
Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 16.
V. Space Curves Types of curves Explicit Implicit Parametric.
Introduction to Computer Graphics with WebGL
Spline Representations
Numerical Computation
Review of Interpolation. A method of constructing a function that crosses through a discrete set of known data points.
Bézier Algorithms & Properties Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, March 3, 2004.
Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 1 2D Spline Curves CS 465 Lecture 15.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
INTERPOLATION & APPROXIMATION. Curve algorithm General curve shape may be generated using method of –Interpolation (also known as curve fitting) Curve.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric Curves.
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.
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.
Bézier Curves & Surfaces Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, March 1, 2004.
L5 – Curves in GIS NGEN06 & TEK230: Algorithms in Geographical Information Systems by: Sadegh Jamali (source: Lecture notes in GIS, Lars Harrie) 1 L5-
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.
Parametric Curves & Surfaces
Computing & Information Sciences Kansas State University Lecture 31 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 32 of 42 Wednesday, 11.
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.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
Splines Sang Il Park Sejong University. Particle Motion A curve in 3-dimensional space World coordinates.
CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann.
Computing & Information Sciences Kansas State University Lecture 30 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 30 of 42 Wednesday, 09.
Rendering Bezier Curves (1) Evaluate the curve at a fixed set of parameter values and join the points with straight lines Advantage: Very simple Disadvantages:
Curves University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
Introduction to Parametric Curve and Surface Modeling.
© University of Wisconsin, CS559 Spring 2004
Introduction to Parametric Curve and Surface Modeling
CS5500 Computer Graphics May 11, 2006
Representation of Curves & Surfaces
Parametric Curves.
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
Three-Dimensional Object Representation
Introduction to Parametric Curve and Surface Modeling
Overview June 9- B-Spline Curves June 16- NURBS Curves
Presentation transcript:

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 161 Today’s class Curve fitting Evaluators Surfaces

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 162 Curved lines Parametric form: P(t)=(x(t), y(t)) for 0  t  1 An arbitrary curve can be built up from different sets of parametric functions for different parts of the curve Continuity between sections  zero order - curves meet  first order - tangents are same at meeting point  second order - curvatures are same at meeting point

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 163 Curved lines (cont.) Control points describe a curve in an interactive environment If displayed curve passes through the control points the curve is said to interpolate the control points If displayed curve passes near the control points the curve is said to approximate the control points

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 164 Blending functions Given n sample points: (x 0, y 0 ) through (x n-1, y n-1 ) Construct P(t) as a sum of terms, one term for each point:  x(t) =  x i B i (t)  y(t) =  y i B i (t) The functions B i (t) are called blending functions For each value of t they determine how much the i th sample point contributes to the curve

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 165 Interpolation For each sample point we would like B i (t)=1 and B j (t)=0 (j  i) for some value of t This implies the curve P(t) will pass through each sample point We want to arrange the blending functions such that each sample point has complete control of the curve in succession

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 166 Lagrange interpolation Consider the case n=4 Want first point to have complete control at t=-1, second point at t=0, third point at t=1, and fourth point at t=2 Note the middle region has 0  t  1 The blending functions are:

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 167 Drawing the curve Vary t in small increments between 0 and 1 This will interpolate the curve between 2 nd and 3 rd control points To handle entire curve (more than 4 control points) draw curve between 2 nd and 3 rd points as above, then step up one control point and repeat for middle set For very first set of 4 control points will need to evaluate between t=-1 and t=0 For very last set of 4 control points will need to evaluate between t=1 and t=2

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 168 Program for curve fitting curves.cpp is available online Program does three curve fitting techniques  Lagrange interpolation  Bézier curves  Uniform cubic B-spline Examine general program set-up and interpolation routine now

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 169 de Casteljau algorithm Consider 4 points p 0, p 1, p 2 and p 3 First generation in-betweens: Second generation in-betweens: Third generation in-betweens:

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1610 Bézier curves By direct substitution and expansion is called the Bézier curve for the points p 0, p 1, p 2 and p 3 Blending functions: At t=0, B 0 =1 and B 1 =B 2 =B 3 =0 At t=1, B 0 =B 1 =B 2 =0 and B 3 =1 B 1 has a maximum at 1/3, B 2 at 2/3

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1611 Observations on Bézier curves Pass through p 0 and p 3 only Can generate closed curves by specifying first and last control points to be the same A single control point can be specified two or more times if you want that point to exert more control of the curve in its region

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1612 Complicated Bézier curves More than 4 control points Piece together using smaller order curves with fewer control points Match endpoints for zero-order continuity At the endpoints, the tangent to the curve is along the line that connects the endpoint to the adjacent control point; obtain first-order continuity by picking collinear control points (last two of one section with first two of next section - with the endpoints the same)

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1613 Revisit program for curve fitting Examine Bézier curve fitting routine in curves.cpp

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1614 Splines An m th degree spline function is a piecewise polynomial of degree m that has continuity of derivatives of order m-1 at each knot Define the blending functions as shifted versions of the spline function: B i (t)=B(t-i)

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1615 Cubic splines Given p 0, p 1, …, p n, 0  t  n Divide into n subintervals [t 0, t 1 ], [t 1, t 2 ], …, [t n-1, t n ] Approximate points p i by a curve P(t) which consists of a polynomial of degree 3 in each subinterval Points t i are called knots

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1616 Uniform cubic B-spline A cubic spline defined on equally spaced knots that is non-zero on the smallest possible interval

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1617 Observations on cubic B- splines At each point at most 4 B-splines are not zero At a knot only 3 consecutive points affect the curve, with weights 1/6, 2/3, and 1/6 so curve is approximating If a control point is specified 3 times then curve goes through point as 1/6+2/3+1/6=1

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1618 Revisit program for curve fitting Examine B-spline fitting routine in curves.cpp

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1619 Bernstein polynomials The Bernstein polynomial of degree n (order n + 1) is given by: Recall the Bézier curve function: Observe that it can be written:

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1620 Evaluators An OpenGL mechanism for specifying a curve or surface using only the control points Use Bernstein polynomials as the blending functions Can describe any polynomial or rational polynomial splines or surfaces to any degree, including:  B-splines  NURBS  Bézier curves and surfaces

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1621 Defining an evaluator glMap1d (GL_MAP1_VERTEX_3, 0.0, STEPS, 3, 4, &points[j][0]);  one-dimensional evaluator (a curve)  specifies x,y,z coordinates (need glEnable(GL_MAP1_VERTEX_3); )  parameter variables goes 0.0 to STEPS  3 indicates number of values to advance in the data between one control point and the next  4 is the order of the spline (degree + 1)  &points[j][0] is a pointer to first control point’s data

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1622 Evaluating a map glEvalCoord1d (i); evaluates a map at a given value of the parameter variable Value of i should be between 0.0 and STEPS

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1623 Example program evaluator.cpp is an example program using an evaluator It does a fit of the same data that the curve fitting program did

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1624 Surfaces The same curve fitting techniques can be extended to surfaces by applying the methods in two dimensions For example, the Utah teapot is formally defined as a series of 32 bicubic Bézier patches using 306 control points

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1625 Defining a 2-D evaluator glMap2d (GL_MAP2_VERTEX_3, 0.0, 1.0, 12, 4, 0.0, 1.0, 3, 4, coords);  two-dimensional evaluator (a surface)  specifies x,y,z coordinates (need glEnable(GL_MAP2_VERTEX_3); )  u parameter variables goes 0.0 to 1.0  12 indicates number of values to advance in the data between one control point and the next in the u direction  4 is the order of the spline (degree + 1)  The next four parameters handle the same information for the v direction  coords is a pointer to the array of control points

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1626 Set up a 2-D mesh glMapGrid2d (STEPS, 0.0, 1.0, STEPS, 0.0, 1.0); Specifies linear grid mappings between the integer grid coordinates and the floating-point evaluation map coordinates STEPS specifies the number of partitions in the u direction 0.0, 1.0 specify the u values for the first and last grid values The next 3 parameters repeat the information for the v direction

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1627 Compute the 2-D mesh glEvalMesh2 (GL_FILL, 0, STEPS, 0, STEPS); First parameter describes the type of mesh:  GL_POINT for points  GL_LINE for lines  GL_FILL for polygons Next parameters specify first and last integer grid values for the two directions

Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 1628 teapot.cpp The teapot.cpp program shows the use of a two-dimensional OpenGL evaluator to produce the teapot