19-11-2012, 11:25 AM
Computer Graphics for Scientists and Engineers
Computer Graphics.ppt (Size: 1.01 MB / Downloads: 33)
Introduction
Representing Curves
A number of small line-segments joined
Interpolation
Parametric equations
Types of curve we study
Natural Cubic Splines and Bezier Curves
Derivation
Implementation
Why have curves ?
Representation of “irregular surfaces”
Example: Auto industry (car body design)
Artist’s representation
Clay / wood models
Digitizing
Surface modeling (“body in white”)
Scaling and smoothening
Tool and die Manufacturing
Curve representation
Problem: How to represent a curve easily and efficiently
“Brute force and ignorance” approaches:
storing a curve as many small straight line segments
doesn’t work well when scaled
inconvenient to have to specify so many points
need lots of points to make the curve look smooth
working out the equation that represents the curve
difficult for complex curves
moving an individual point requires re-calculation of the entire curve
The need for smoothness
So far, mostly polygons
Can approximate any geometry, but
Only approximate
Need lots of polygons to hide discontinuities
Storage problems
Math problems
Normal direction
Texture coordinates
Not very convenient as modeling tool
Gets even worse in animation
Almost always need smooth motion
Geometric modeling
Representing world geometry in the computer
Discrete vs. continuous again
At least some part has to be done by a human
Will see some automatic methods soon
Reality: humans are discrete in their actions
Specify a few points, have computer create something which “makes sense”
Examples: goes through points, goes “near” points
Requirements
Want mathematical smoothness
Some number of continuous derivatives of P
Local control
Local data changes have local effect
Continuous with respect to the data
No wiggling if data changes slightly
Low computational effort
Polynomial parametric equations
To represent a straight line - linear parametric equation (i.e. one where the highest power of t was 1).
For curves, we need polynomial equations. Why? Because the graphs of polynomial equations wiggle!
Natural Cubic Spline
spline, n. 1 A long narrow and relatively thin piece or strip of wood, metal, etc. 2 A flexible strip of wood or rubber used by draftsmen in laying out broad sweeping curves, as in railroad work.
A natural spline defines the curve that minimizes the potential energy of an idealized elastic strip.
A natural cubic spline defines a curve, in which the points P(u) that define each segment of the spline are represented as a cubic P(u) = a0 + a1u + a2u2 + a3u3
Where u is between 0 and 1 and a0, a1, a2 and a3 are (as yet) undetermined parameters.
We assume that the positions of n+1 control points Pk, where k = 0, 1,…, n are given, and the 1st and 2nd derivatives of P(u) are continuous at each interior control point.
De Casteljau algorithm
Can compute any point on the curve in a few iterations
No polynomials, pure geometry
Repeated linear interpolation
Repeated order of the curve times
The algorithm can be used as definition of the curve
Bezier Curves - properties
Not all of the control points are on the line
Some just attract it towards themselves
Points have “influence” over the course of the line
“Influence” (attraction) is calculated from a polynomial expression
(show demo applet)
Bezier Curve Properties
The first and last control points are interpolated
The tangent to the curve at the first control point is along the line joining the first and second control points
The tangent at the last control point is along the line joining the second last and last control points
The curve lies entirely within the convex hull of its control points
The Bernstein polynomials (the basis functions) sum to 1 and are everywhere positive
They can be rendered in many ways
E.g.: Convert to line segments with a subdivision algorithm
Longer Curves
A single cubic Bezier or Hermite curve can only capture a small class of curves
At most 2 inflection points
One solution is to raise the degree
Allows more control, at the expense of more control points and higher degree polynomials
Control is not local, one control point influences entire curve
Alternate, most common solution is to join pieces of cubic curve together into piecewise cubic curves
Total curve can be broken into pieces, each of which is cubic
Local control: Each control point only influences a limited part of the curve
Interaction and design is much easier
Geometric Continuity
Derivative continuity is important for animation
If an object moves along the curve with constant parametric speed, there should be no sudden jump at the knots
For other applications, tangent continuity might be enough
Requires that the tangents point in the same direction
Referred to as G1 geometric continuity
Curves could be made C1 with a re-parameterization
The geometric version of C2 is G2, based on curves having the same radius of curvature across the knot
What is the tangent continuity constraint for a Bezier curve?