Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Computer Graphics

(Lecture 7)
Representing General Curves
 We can represent any polyline with vertices and edges. What about
curves?
 Store control points in a list, find some way of smoothly interpolating
between them
 Methods to represent general curves:
 Raster graphics: aliasing, not scalable and memory intensive.
 Piecewise Linear Approximation: not smooth and looks awful without many
control points
 Trigonometric functions: difficult to manipulate and control, and
computationally expensive
 Higher order polynomials: relatively cheap to compute, and only slightly more
difficult to operate on than polylines
Representing General Curves: Splines
 Splines: parametric curves governed by control points or control vectors,
third or higher order
V0
V2 interpolating
approximating V3 spline V5
spline
polyline
V1 approximation V4

 Used for:
 Representing smooth shapes in 2D as outlines or in 3D using "patches"
parameterized with two variables: s and t
 Animation paths between keyframes
 Approximating "expensive" functions (polynomials are cheaper than log, sin, cos,
etc.)
Representing General Curves: Hermite Curves
 Polylines are linear (1st order polynomial) interpolations between points
 Given points P and Q, line between the two is given by the parametric equation:
𝑥 𝑡 = 1 − 𝑡 𝑃 + 𝑡𝑄, 0≤𝑡≤1
 1 − 𝑡 and t are called weighting functions of P and Q
 Splines are higher order polynomial interpolations between points
 Like linear interpolation, but with higher order weighting functions allowing better
approximations/smoother curves
 One representation - Hermite curves (Interpolating spline):
 Determined by two control points P and Q , an initial tangent vector v and a final tangent vector w.
𝛾 𝑡 = 2𝑡 3 − 3𝑡 2 + 1 𝑃 + −2𝑡 3 + 3𝑡 2 𝑄
 Satisfies: + 𝑡 3 − 2𝑡 2 + 𝑡 𝑣 + 𝑡 3 − 𝑡 2 𝑤
 𝛾 0 = 𝑃
 𝛾 1 = 𝑄 𝑃: 𝑡 = 0 𝑄: 𝑡 = 1
 𝛾′ 0 = 𝑣
𝛾 w

 𝛾 1 = 𝑤
v
Representing General Curves: Hermite Curves
 Polynomial splines have more complex Polynomial weighting
weighting functions than lines functions in Hermite
curve equation
 Coefficients for P and Q are now 3rd degree
polynomials
 At t = 0 1
 Coefficients of P is 1, all others 0 P’s Coefficient Q’s Coefficient
 Derivative of coefficient of v is 1, derivative of
all others is 0
 At t = 1 v’s coefficient w’s coefficient
 Coefficient of Q is 1, all others 0
 Derivative of coefficient of w is 1, derivative of t
all others 0 (0, 0) 1
 Can be chained together to make more
complex curves
Representing General Curves: Bezier Curves
 Bezier representation is similar to Hermite
 4 points instead of 2 points and 2 vectors (𝑃1 … 𝑃4 )
 Initial position P1, tangent vector is 𝑃2 − 𝑃1
 Final position P4, tangent vector is 𝑃4 − 𝑃3
 This representation allows a spline to be stored as a list of vertices
with some global parameters that describe the smoothness and
continuity
 Bezier splines are widely used (Adobe, Microsoft) for font
definition
Building 3D Primitives (remember lecture 3)
 Triangles are commonly used
 Many triangles used for a single object is a
triangular mesh
 The geometry tables: Vertex, edge and
polygon tables
 Each vertex listed once. v4 v7
 Triangles listed as ordered triplets of edges f8
f11
v8
f9
f10

in polygon table f0 v5
v6

Edges listed in counter clockwise order in


f2

polygon table. v0
f1
f3

v1 v2
Building 3D Primitives
 Splines used to describe boundaries of "patches" – these can be "sewn
together" to represent curved surfaces
3 3
𝑥 𝑠, 𝑡 = 1 − 𝑠 × 1−𝑡 × 𝑃1,1
3 2
+ 1−𝑠 × 3𝑡 1 − 𝑡 × 𝑃1,2 + ⋯
Revision
 Basic matrix operations
 Addition
 Subtraction
 Multiplication
 Inverse
 Homogeneous and normal
co-ordinates
2D Transformations
 Scaling adjusts the positions of all the points in an object by the same
factor and as a result it alters both the size and position of an object
 Scale around the origin or a point (ex: center point)???

 Examples (by drawing)

Why Matrix?????

You might also like