0% found this document useful (0 votes)
30 views

Lectures - 11 - 12 - Curve - and Surface - Representation

This document discusses various techniques for representing curves and surfaces in computer graphics, including: 1) Parametric curves defined by a parameter that describes the position on the curve. Common representations include Hermite, Bezier, and spline curves. 2) Implicit surfaces defined by a function of x, y, and z equal to zero. Quadric and metaball surfaces are discussed. 3) Hermite curves specifically, which are cubic polynomials defined by two endpoints and two tangent vectors at each endpoint. The coefficients of the Hermite curve can be found using one of two cases based on the tangent specifications.

Uploaded by

Hassan .Y
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Lectures - 11 - 12 - Curve - and Surface - Representation

This document discusses various techniques for representing curves and surfaces in computer graphics, including: 1) Parametric curves defined by a parameter that describes the position on the curve. Common representations include Hermite, Bezier, and spline curves. 2) Implicit surfaces defined by a function of x, y, and z equal to zero. Quadric and metaball surfaces are discussed. 3) Hermite curves specifically, which are cubic polynomials defined by two endpoints and two tangent vectors at each endpoint. The coefficients of the Hermite curve can be found using one of two cases based on the tangent specifications.

Uploaded by

Hassan .Y
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 47

COMPUTER GRAPHICS

Curves and Surfaces


INTRODUCTION

• We need smooth curves and surfaces in many applications:


– model real world objects
– Computer-Aided Design (CAD)
– high quality fonts
– data plots
– artists sketches

2
INTRODUCTION
• Most common representation for surfaces:
– polygon mesh
Polygons are used in computer graphics to compose
images that are three-dimensional in appearance
– parametric surfaces
– quadric surfaces
• Solid modeling

3
TYPES OF CURVES / SURFACES
• Explicit:
y = mx + b z = A x + By + C

For each point value X we have a value of y; Simply compute and Plot

• Implicit: By solving an equation

Ax + By + C = 0 (x – x0)2 + (y – y0)2 – r2 = 0

• Parametric: finding X,Y using a parameter. Describe the position on the

curve by a parameter

x = x0 + (x1 – x0)tLecture 5
10/10/2008 x = x0 + rcos 4
IMPLICIT SURFACES
• Functions in the form of F(x,y,z) = 0
– i.e. Quadric functions

2 2 2
Sphere: f(x,y,z) = x + y + z = 0 molecular modeling

Lecture 5 5
METABALLS
• Each metaball is defined as a function in n-dimensions (e.g., for three
dimensions, f ( x , y , z ) Three-dimensional metaballs tend to be most
common, with two-dimensional implementations popular as well).

6
METABALLS
• One type of implicit surface
• Also known as blobby objects
• Negative volume to produce hollows
• Can be used to model smooth surfaces, liquid

Lecture 5 7
QUADRIC SURFACES

• Reasons to use them:


– easy to compute normal
– easy to test point inclusion
– easy to compute z given x and y
– easy to compute intersections of one surface with another

8
PARAMETRIC CUBIC CURVES

• Parametric representation:
– x = x(t), y = y(t), z = z(t)
• overcomes problems with explicit and implicit forms and
Parametric curves are very flexible.
• Parameter count gives the object’s dimension.
(x(t,v), y(t,v), z(t,v))2 : D surface
• Coord functions independent.
– a curve is approximated by a piecewise polynomial curve

9
PARAMETRIC CUBIC
CURVES
• Why cubic?
– lower-degree polynomials give too little flexibility in controlling the
shape of the curve
– higher-degree polynomials can introduce unwanted wiggles and require
more computation
– lowest degree that allows specification of endpoints and their derivatives
– lowest degree that is not planar in 3D

10
PARAMETRIC CUBIC CURVES

• General form:
3 2
x (t )  a x t  bx t  c x t  d x
3 2
y (t )  a y t  by t  c y t  d y
3 2
z (t )  a z t  bz t  c z t  d z
3 2
T  [t t t 1] 0< t <1
Transmission
parameter
11
PARAMETRIC CUBIC CURVES
3 2
T  [t t t 1]
ax ay az 
b by bz  
C  x

 cx cy cz 
 
d x dy d z 
12
PARAMETRIC CUBIC CURVES

Q(t )  [ x(t ) y (t ) z (t )] 

T C  T  M G
13
SPECIFYING CURVES
• Control Points:
– A set of points that influence the curve’s shape.
• Interpolating curve:
– Curve passes through all of control points.
• Approximating Curves:
– Curve can miss some control points.
• Control polygon:
– Control points merely influence shape.

10/10/2008 Lecture 5 14
INTERPOLATION VS. APPROXIMATION

INTERPOLATING APPROXIMATING
PARAMETRIC CUBIC
CURVES
• Kinds of continuity:
– G0: two curve segments join together
– G1: directions of tangents are equal at the joint
– C1: directions and magnitudes of tangents are equal at
the joint
– Cn: directions and magnitudes of n-th derivative are
equal at the joint

16
PIECEWISE CURVE SEGMENTS
• We can represent an arbitrary length curve as a series of
curves pieced together.
• But we will want to control how these curves fit together …

10/10/2008 Lecture 5 18
EXAMPLE
• The curves Q1 Q2 Q3 join at point P
• Q1 and Q2 have equal tangent vectors at P and hence C1 and G1
continuous
• Q1 and Q3 have tangent vectors in the same direction but Q3
has twice magnitude, so they are only G1 continuous at P
PARAMETRIC CUBIC
CURVES
• Major types of curves:
– Hermit
• defined by two endpoints and two tangent vectors
– Bezier
• defined by two endpoints and two other points that control the
endpoint tangent vectors
– Splines
• several kinds, each defined by four points
• uniform B-splines, non-uniform B-splines, ß-splines

20
HERMITE CURVES

• A cubic polynomial
• defined by two endpoints and two tangent vectors
• Polynomial can be specified by the position of, and
gradient at, each endpoint of curve.
• The idea is to derive a curve that is smooth enough
. The cubic interpolation spline is obtained by
fitting the input points with a piecewise cubic
polynomial curve that passes every control point.

10/10/2008 Lecture 5 21
HERMITE CURVES
• A cubic polynomial
• defined by two endpoints and two tangent vectors

• Polynomial can be specified by the position


of, and gradient at, each endpoint of curve.
• Determine: x = X(t) in terms of x0, x0’, x1, x1’
Now:
X(t) = a3t3 + a2t2 + a1t + a0
and X/(t) = 3a3t2 + 2a2t + a1

10/10/2008 Lecture 5 22
HERMITE CURVES
•  

0< t <1

10/10/2008 Lecture 5 23
HERMITE CURVES
•  

10/10/2008 Lecture 5 24
FINDING HERMITE COEFFICIENTS USING CASE1

T  [t 3 t2 t 1]

25

10/10/2008 Lecture 5
FINDING HERMITE COEFFICIENTS
USING CASE1
•  

10/10/2008 Lecture 5 26
FINDING HERMITE COEFFICIENTS
USING CASE1
Substituting for t at each endpoint:
x0 = X(0) = a0 x0’= X/(0) = a1
x1 = X(1) = a3 + a2 + a1 + a0 x1’= X/(1) = 3a3 + 2a2+ a1
Using the inverse matrix the solution for a3, a2, a1 , and a0 is:
a0 = x0 a1 = x0’
a2 = -3x0 – 2x0’+ 3x1 – x1’ a3 = 2x0 + x0’ - 2x1 + x1’

10/10/2008 Lecture 5 27
HERMITE BASIS (BLENDING) FUNCTIONS
CASE 1

2 1  2 1   x0 
 3  2 3  1  x '

X (t )  t 3 t 2 t 1  
0 1 0
 0 
0   x1 
  
1 0 0 0   x1 ' 
 (2t 3  3t 2  1)x0  (t 3  2t 2  t )x0 '(2t 3  3t 2 )x1  (t 3  t 2 )x1 '
THE HERMITE MATRIX: M H
CASE 1
The resultant polynomial can be expressed in matrix form:
X(t) = tTMHq ( q is the control vector)

We can now define a parametric polynomial for each coordinate


required independently, ie. X(t), Y(t) and Z(t)

10/10/2008 Lecture 5 29
FINDING HERMITE COEFFICIENTS
USING CASE2

•  

Lecture 5 30
FINDING HERMITE COEFFICIENTS
USING CASE2

•  

Lecture 5 31
HERMITE BASIS (BLENDING) FUNCTIONS
CASE 2

 2 2 1 1   x0 
 3 3  2  1  x 

X (t )  t 3 t 2 t 1  
0 0 1
 1 
0   x0 '
  
1 0 0 0   x1 ' 
 (2t 3  3t 2  1)x0  (2t 3  3t 2 )x1  (t 3  2t 2  t )x0 ' (t 3  t 2 )x1 '
THE HERMITE MATRIX: M H
CASE 2
The resultant polynomial can be expressed in matrix form:
X(t) = tTMHq ( q is the control vector)

We can now define a parametric polynomial for each


coordinate required independently, ie. X(t), Y(t) and Z(t)

10/10/2008 Lecture 5 33
HERMITE BASIS (BLENDING) FUNCTIONS

X (t )  (2t 3  3t 2  1)x0  (t 3  2t 2  t )x0 '(2t 3  3t 2 )x1  (t 3  t 2 )x1 '

The hermite blending function in


both cases is the same
x0 x1
The graph shows the shape of the
four basis functions – often called
blending functions.
They are labelled with the elements
of the control vector that they
weight.
x0'
Note that at each end only position
is non-zero, so the curve must touch
the endpoints x1 /
10/10/2008 Lecture 5 34
FAMILY OF HERMITE CURVES.
y(t)
Note :
Start points on left.

x(t)

10/10/2008 Lecture 5 35
DISPLAYING HERMITE CURVES.
• Simple :
– Select step size to suit.
– Plug x values into the geometry matrix.
– Evaluate P(t)  x value for current position.
– Repeat for y & z independently.
– Draw line segment between current and previous point.
• Joining curves:
– Coincident endpoints for C0 continuity
– Align tangent vectors for C1 continuity
.
10/10/2008 Lecture 5 36
BÉZIER CURVES
• Hermite cubic curves are difficult to model –
need to specify point and gradient.
• More intuitive to only specify points.
• Pierre Bézier (an engineer at Renault) specified 2
endpoints and 2 additional control points to
specify the gradient at the endpoints.
• Can be derived from Hermite matrix:
– Two end control points specify tangent

10/10/2008 Lecture 5 37
BÉZIER CURVES P2
Note the Convex Hull has been shown
as a dashed line – used as a bounding P4
extent for intersection purposes.
P1
P3
P3

P4
P1

P2

10/10/2008 Lecture 5 38
BÉZIER MATRIX
• The cubic form is the most popular
X(t) = tTMBq (MB is the Bézier matrix)
• With n=4 and r=0,1,2,3 we get:

• Similarly for Y(t) and Z(t)

10/10/2008 Lecture 5 39
BÉZIER BLENDING FUNCTIONS
This is how they look –
The functions sum to 1 at q0 q3
any point along the curve.
q1 q2
Endpoints have full weight
The weights of each
function is clear and the
labels show the control
points being weighted.

10/10/2008 Lecture 5 40
JOINING BEZIER CURVES
• G1 continuity is provided at the endpoint when
• P2 – P3 = k (Q1 – Q0)
• if k=1, C1 continuity is obtained
EXAMPLE
• The coordinates of four control points relative to a
curve are given by
P1(2,2,0), P2(2,3,0), P3(3,3,0) and P4(3,2,0)
• Write down the equations of Bezier curve
• Also, find the coordinate pixels of the curve for (t =0,
t=0.25, t=0.5, t=0.75, and t= 1) step = 0.25
• Also, plot the Bezier curve?
P= P0(1-t)3 + 3P1t(1-t)2 + 3P2t2(1-t) + P3t3

• Generating Bezier curve requires for control


points (each point represents (x,y,z)
• P1(2,2,0)  X1 = 2, Y1=2, Z1=0
• P2(2,3,0)  X2 = 2, Y2=3, Z2=0
• P3(3,3,0)  X3= 3, Y3=3, Z3=0
• P4(3,2,0)  X4 = 3, Y4=2, Z4=0
P= P4t3 + 3P3t2(1-t) + 3P2t(1-t)2 + P1(1-t)3

• Parametric equations of Bezier curve are


• P=P4t3 + 3P3t2(1-t) + 3P2t(1-t)2 + P1(1-t)3
 X=X4t3 + 3X3t2(1-t) + 3X2t(1-t)2 + X1(1-t)3
 Y=Y4t3 + 3Y3t2(1-t) + 3Y2t(1-t)2 + Y1(1-t)3
 Z=Z4t3 + 3Z3t2(1-t) + 3Z2t(1-t)2 + Z1(1-t)3

• X=X4t3 + 3X3t2(1-t) + 3X2t(1-t)2 + X1(1-t)3


 X=3t3 + (3)(3)t2(1-t) + (3)(2)t(1-t)2 + 2(1-t)3
• Y=Y4t3 + 3Y3t2(1-t) + 3Y2t(1-t)2 + Y1(1-t)3
 Y=(2)t3 +(3)(3)t2(1-t) + (3)(3)t(1-t)2 +2(1-t)3
 Y=2t3 + 9t2(1-t) + 9t(1-t)2 + 2(1-t)3

• Z=X4t3 + 3Z3t2(1-t) + 3Z2t(1-t)2 + Z1(1-t)3


 Z=0
• X=3t3 + 9t2(1-t) + 6t(1-t)2 + 2(1-t)3
• Y=2t3 + 9t2(1-t) + 9t(1-t)2 + 2(1-t)3
• Z= 0
1 0.75 0.5 0.25 0 t
3 2.84 2.5 2.156 2 X
2 2.56 2.75 2.56 2 Y
0 0 0 0 0 Z

• Note the step size is 0.25; where 0≤t≤1


• for (t =0, t=0.25, t=0.5, t=0.75, and t= 1)
TESSELLATION
• We need to compute the triangles on the surface
• The simplest way is do uniform tessellation, which samples
points uniformly in the parameter space
• Adaptive tessellation – adapt the size of triangles to the
shape of the surface;i.e., more triangles where the surface bends
more
– On the other hand, for flat areas we do not need many triangles

14/10/2008 Lecture 6 47

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy