department of computer science drexel university · 2019. 10. 24. · computer graphics intro to...
TRANSCRIPT
![Page 1: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/1.jpg)
1
CS 430Computer Graphics
Intro to CurvesWeek 4, Lecture 7
David Breen, William Regli and Maxim PeysakhovDepartment of Computer Science
Drexel University
![Page 2: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/2.jpg)
2
Outline
• Introduction to 2D curves• Functional representations• Parametric cubic curves• Introduction to Bézier curves • Continuity
![Page 3: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/3.jpg)
3
Example Application: Font Design and Display
• Curved objects are everywhere
• There is always need for:– mathematical fidelity– high precision– artistic freedom and
flexibility– physical realism
Pics/Math courtesy of G. Farin @ ASU
![Page 4: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/4.jpg)
4
Example Application: Graphic Design and Arts
Courtesy of http://www.pilot3d.com
![Page 5: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/5.jpg)
5
Example Application: Tool Path Generation
Pics/Math courtesy of G. Farin @ ASUvia M. Wagner @ ASU
![Page 6: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/6.jpg)
6
Example Application: Motion Planning
![Page 7: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/7.jpg)
7
Functional Representations
• Explicit Functions:– representing one variable with another– fine if only one x value for each y value– Problem: what if I have a sphere?
• Multiple values …. (not used in graphics)
Pics/Math courtesy of Dave Mount @ UMD-CP
![Page 8: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/8.jpg)
8
Functional Representations
• Implicit Functions:– curves/surfaces represented as “the zeros”– good for rep. of (n-1)D objects in nD space– Sphere example:– What class of function?
• polynomial: linear combo of integer powers of x,y,z• algebraic curves & surfaces: rep’d by implicit
polynomial functions• polynomial degree: total sum of powers,
i.e. polynomial of degree 6:
Pics/Math courtesy of Dave Mount @ UMD-CP
![Page 9: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/9.jpg)
9
• Parametric Functions:– 2D/3D curve: two functions of one parameter
(x(u), y(u)) (x(u), y(u), z(u))– 3D surface: three functions of two parameters
(x(u,v), y(u,v), z(u,v))– Example: Sphere
Note: rep. notalgebraic, but isparametric
Functional Representations
![Page 10: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/10.jpg)
10
Functional Representations
• Which is best??– It depends on the application– Implicit is good for
• computing ray/surface intersection• point inclusion (inside/outside test)• mass & volume properties
– Parametric is good for• subdivision, faceting for rendering• Surface & area properties• popular in graphics
![Page 11: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/11.jpg)
11
Issues in Specifying/Designing Curves/Surfaces
• Note: the internal mathematical representation can be very complex– high degree polynomials– hard to see how parameters relate to shape
• How do we deal with this complexity?– Use curve control points and either
• Interpolate• Approximate
![Page 12: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/12.jpg)
12
Points to Curves
• The Lagrangian interpolating polynomial– n+1 points, the unique polynomial of degree n– curve wiggles thru each control point– Issue: not good if you want smooth or flat curves
• Approximation of control points– points are weights that tug on the curve or surface
Pics/Math courtesy of Dave Mount @ UMD-CP
![Page 13: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/13.jpg)
13
Warning, Warning, Warning:Pending Notation Abuse
• t and u are used interchangeably as a parameterization variable for functions
• Why?– t historically is “time”, certain parametric functions
can describe “change over time” (e.g. motion of a camera, physics models)
– u comes from the 3D world, i.e. where two variables describe a B-spline surface
• u and v are the variables for defining a surface
• Choice of t or u depends on the text/reference
![Page 14: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/14.jpg)
14
Parametric Curves
• General rep:
• Properties:– individual functions are single-
valued– approximations are done with
piecewise polynomial curves– Each segment is given by two
cubic polynomials (x,y) in parameter t
– Concise representation1994 Foley/VanDam/Finer/Huges/Phillips ICG
![Page 15: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/15.jpg)
15
Cubic Parametric Curves
• Balance between– Complexity– Control– Wiggles– Amount of computation– Non-planar
![Page 16: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/16.jpg)
16
Parametric Curves
• Cubic Polynomials that define a parametric curve segment
are of the form
• Notice we restrict the parametert to be
![Page 17: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/17.jpg)
17
Parametric Curves
• If coefficients are represented as a matrix
and
then:
1994 Foley/VanDam/Finer/Huges/Phillips ICG
![Page 18: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/18.jpg)
18
• Q(t) can be defined with four constraints– Rewrite the coefficient matrix C as
where M is a 4x4 basis matrix, and G is a four-element constraint matrix (geometry matrix)
• Expanding gives:
Q(t) is a weighted sum of the columns of the geometry matrix, each of which represents a point or vector in 3-space
Parametric Curves
1994 Foley/VanDam/Finer/Huges/Phillips ICG
![Page 19: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/19.jpg)
19
Parametric Curves
• Multiplying out Q(t) = Gx·M·T gives
(i.e. just weighted sums of the elements)• The weights are cubic polynomials in t
(called the blending functions, B=MT), Q(t) = Gx · B
• M and G matrices vary by curve – Hermite, Bézier, spline, etc.
![Page 20: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/20.jpg)
20
Some Types of Curves
• Hermite– def’d by two end
points and two tangent vectors
• Bézier– two end points plus
two control points for the tangent vectors
• Splines– Basis Splines– def’d w/ 4 control points– Uniform, nonrational
B-splines– Nonuniform, nonrational
B-splines– Nonuniform, rational
B-splines (NURBS)
![Page 21: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/21.jpg)
21
Convex Hulls
• The smallest convex container of a set of points
• Both practically and theoretically useful in a number of applications
Pics/Math courtesy of G. Farin @ ASU
![Page 22: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/22.jpg)
22
Bézier Curves
• Pierre Bézier @ Rénault ~1960
• Basic idea– four points– Start point P0
– End point P3
– Tangent at P0, P0 P1
– Tangent at P3, P2 P3
Pics/Math courtesy of G. Farin @ ASU
![Page 23: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/23.jpg)
23
Bézier Curves
An Example:• Geometry matrix is
where Pi are control points for the curve
• Basis Matrix is
1994 Foley/VanDam/Finer/Huges/Phillips ICG
convex hull
![Page 24: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/24.jpg)
24
Bézier Curves
• The general representation of a Bézier curve is
whereGB - Bézier Geometry MatrixMB - Bézier Basis Matrix
which is (multiplying out):
1994 Foley/VanDam/Finer/Huges/Phillips ICG
convex hull
![Page 25: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/25.jpg)
25
Bernstein Polynomials (1911)
• The general form for the i-th Bernstein polynomial for a degree k Bézier curve is
• Some properties of BPs– Invariant under transformations– Form a partition of unity, i.e. summing to 1– Low degree BPs can be written as high degree BPs– BP derivatives are linear combo of BPs– Form a basis for space of polynomials w/ deg≤k
![Page 26: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/26.jpg)
26
Bernstein Polynomials• For those that forget combinatorics
• Note: k does not have to be 3!
![Page 27: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/27.jpg)
27
Joining Bézier Segments: The Bernstein Polynomials
• Cubic Bernstein blending functions
• Observe: the coefficients are just rows in Pascal’s triangle
Pics/Math courtesy of Dave Mount @ UMD-CP
![Page 28: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/28.jpg)
28
Joining Bézier Segments: The Bernstein Polynomials
• Observe
The Four Bernstein polynomials– also defined by
• These represent the blending proportions among the control points
Pics/Math courtesy of Dave Mount @ UMD-CP
![Page 29: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/29.jpg)
29
Joining Bézier Segments: The Bernstein Polynomials
• The four cubic Bernstein polynomials
• Observe:– at t=0, only BB1 is >0
• curve interpolates P1
– at t=1, only BB4 is >0• curve interpolates P4
Pics/Math courtesy of Dave Mount @ UMD-CP
![Page 30: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/30.jpg)
30
General Form of Bezier Curve
![Page 31: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/31.jpg)
31
Properties of Bézier Curves
• Affine invariance• Invariance under affine
parameter transformations• Convex hull property
– curve lies completely within original control polygon
• Endpoint interpolation• Intuitive for design
– curve mimics the control polygon
Pics/Math courtesy of G. Farin @ ASU
![Page 32: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/32.jpg)
32
Issues with Bézier Curves
• Creating complex curves may (with lots of wiggles) requires many control points– potentially a very high-degree polynomial
• Bézier blending functions have global support over the whole curve– move just one point, change whole curve
• Improved Idea: link (C1) lots of low degree (cubic) Bézier curves end-to-end
![Page 33: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/33.jpg)
33
ContinuityTwo types:• Geometric Continuity, Gi:
– endpoints meet– tangent vectors’ directions are equal
• Parametric Continuity, Ci:– endpoints meet– tangent vectors’ directions are equal– tangent vectors’ magnitudes are equal
• In general: C implies G but not vice versa
![Page 34: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/34.jpg)
34
Parametric Continuity
• Continuity (recall from the calculus):– Two curves are Ci continuous at a point p iff the
i-th derivatives of the curves are equal at p
Pics/Math courtesy of Dave Mount @ UMD-CP
![Page 35: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/35.jpg)
35
Continuity
• What are the conditions for C0 and C1
continuity at the joint of curves xl and xr?– tangent vectors at end points equal– end points equal
xl xr1994 Foley/VanDam/Finer/Huges/Phillips ICG
![Page 36: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/36.jpg)
36
Continuity
• The derivative of is the parametric tangent vector of the curve:
1994 Foley/VanDam/Finer/Huges/Phillips ICG
![Page 37: Department of Computer Science Drexel University · 2019. 10. 24. · Computer Graphics Intro to Curves Week 4, Lecture 7 David Breen, William Regli and Maxim Peysakhov Department](https://reader036.vdocuments.us/reader036/viewer/2022071006/5fc3a84ce6a976220c03b29b/html5/thumbnails/37.jpg)
37
Continuity• In 3D, compute this for each component of
the parametric function– For the x component:
• Similar for the y and z components.
1994 Foley/VanDam/Finer/Huges/Phillips ICG
xl xr