CS 376Introduction to Computer Graphics
04 / 30 / 2007Last Lecture :(
Instructor: Michael Eckmann
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
Today’s Topics• Questions?• Radiosity discussion by Alex Danilevsky• Then you'll fill out evaluation forms for the course• Then I'll come back in the room and cover:
– Surfaces (bicubic polynomial surfaces)– Speedups for polynomial evaluation– quick comment on Shape Grammars
• probably no time for Fractal geometry
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
• Recall that we defined parametric cubic curves as Q(t) = T M G.• For surfaces we define a parametric cubic surface with two parameters,
hence Q(s,t)• for some particular value of s, say s
1, Q(s
1,t) is a parametric curve. Also,
for some particular value of t, say t1, Q(s,t
1) is a parametric curve.
• [ G1(t) ]
• Q(s,t) = S M G(t) = S M [ G2(t) ]
• [ G3(t) ]
• [ G4(t) ]
• where each Gi(t) is a parametric cubic . So, each G
i(t) = T M G
i
• The overall G(t) geometry matrix contains 16 geometry items (whereas for cubic curves, G contained 4 geometry items.)
Curve Surfaces
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
• Horner's rule for evaluating polynomials– consider the x-coordinate parametric cubic:
• x(t) = axt3 + b
xt2 + c
xt + d
x
• evaluated as is, operations used:– 6 multiplies and 3 adds
• if you use Horner's rule, x(t) can be rewritten as:• x(t) = [(a
xt + b
x)t + c
x]t + d
x
– 3 multiplies and 3 adds– for all 3 coordinates, then you have 9 multiplies and 9 adds
– we can do better
• Forward-difference calculations– generate successive values recursively by incrementing the previous
value– x
k+1 = x
k + Δx
k
– Δxk
is the forward difference
Speedups for polynomial evaluation
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
• Forward-difference calculations– generate successive values recursively by incrementing the previous
valuex
k+1 = x
k + Δx
k
– Δxk
is the forward difference– for parametric cubics if we divide our range of t into a set number of
fixed intervals of size δ thenx
k = x(t
k) and x
k+1 = x(t
k+1) where t
k+1 = t
k + δ k=0,1,...
xk = a
xtk3 + b
xtk2 + c
xtk + d
x
xk+1
= axtk+1
3 + bxtk+1
2 + cxtk+1
+ dx
= ax(t
k+δ)3 + b
x(t
k+δ)2 + c
x(t
k+δ) + d
x
Δxk = x
k+1- x
k = 3a
xδt
k2 + (3a
xδ2 + 2b
xδ)t
k + (a
xδ3 + b
xδ2 + c
xδ)
Notice that Δxk
is a quadratic polynomial in t
Speedups for polynomial evaluation
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
• we can do the same kind of thing but this is the second forward-difference
Δxk = Δx
k-1 + Δ
2x
k-1
– Δ2x
k-1 is the second forward difference
...Δ
2x
k-1 = 6a
xδt
k-1 + 6a
xδ3 + 2b
xδ2
Notice that Δ2x
k-1 is a linear polynomial in t
• we can do the same kind of thing but this is the third forward-difference
Δ2x
k-1 = Δ
2x
k-2 + Δ
3x
k-2
– Δ3x
k-2 is the third forward difference
...Δ
3x
k-2 = 6a
xδ3 which is a constant in t
Speedups for polynomial evaluation
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
x(t) = axt3 + b
xt2 + c
xt + d
x
Δxk = 3a
xδt
k2 + (3a
xδ2 + 2b
xδ)t
k + (a
xδ3 + b
xδ2 + c
xδ)
Δ2x
k-1 = 6a
xδt
k-1 + 6a
xδ3 + 2b
xδ2
Δ3x
k-2 = 6a
xδ3
• We need initial values for x and the first and second forward differenceswhen k = 0, t = 0 and we get the followingx
0 = d
x
Δx0 = a
xδ3 + b
xδ2 + c
xδ
Δ2x
0 = 6a
xδ3 + 2b
xδ2
and compute the first few x's and then
• to compute successive values of x it only takes 3 adds at each step:x
k+1 = x
k + Δx
k Δx
k = Δx
k-1 + Δ
2x
k-1
Δ2x
k-1 = Δ
2x
k-2 + Δ
3x
k-2
Speedups for polynomial evaluation
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
• To see the forward differences algorithm, see the handout with the two
algorithms (the first is brute force --- not even using Horner's rule).
• The brute force uses 11 multiplies and 10 additions.
• Horner's rule algorithm requires 9 multiplies and 10 additions.
• The forward differences algorithm only takes 9 additions (and 0 multiplies)
to calculate the next point coordinates (after some initialization that takes
some multiplies and adds.)
Speedups for polynomial evaluation
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
• See section 8-24 in our text. It's short. I suggest you read it and attend
Tim Gildea's presentation of his thesis "LSystem Viewer: Interactive
Visualization Software for Parametric DOL-Systems" which is
at 8pm, TONIGHT, Monday April 30th in Harder room 202.
• Two other students will present their work before Tim.
• 6:30 p.m. Kellen Affleck
• 7:15 p.m. Max Levine
• 8:00 p.m. Tim Gildea
Shape Grammars
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
• Up until now, we have only discussed objects (Euclidean shapes) being
described by equations. These methods are good for man-made objects
that are smooth and have regular shapes.
• Natural objects like mountains, clouds, terrain, trees, etc. have surface
shapes that aren't well described by equations. Instead these are better
described by “procedures”. Fractal methods are a way to make a
procedural description of a surface/object.
• Fractal objects have 2 important characteristics– infinite detail at every point– self-similarity between the parts to the overall features (see next slide)
• Fractal objects are specified by a procedure that does an operation
repeatedly.
Fractal Geometry
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
• Zooming in enough on an equation defined surface (Euclidean shape) will
reveal the limit to the level of detail in the shape.
• Zooming in on a Fractal object will reveal the “limitless” detail in the
shape.
• (I'll try to draw figure 8-67 in text pg 480.)
• Fractals are defined infinitely, but of course in graphics we will perform a
finite number of steps and hence our objects will have finite dimensions.
Fractal Geometry
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
• Self-similarity– entire object contains scaled down versions of itself as its subparts– each subpart is created by multiplying a scale factor by the whole
object– each subpart can use the same scale factor or different ones– random variations can be employed -> statistically self-similar
• used for trees, leaves, etc.
Fractal Geometry
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
• Fractal Dimension D– a description of the amount of variation in the structure of a fractal
object.• a line is 1 dimensional, a square is 2 dimensional• if we subdivide a line into N equal parts, each part is the original
scaled down by a factor of N = N1/1 = N1/d
• if we subdivide a square into N equal parts, each part is the original scaled down by a factor of sqrt(N) = N1/2 = N1/d
• if we subdivide the Koch snowflake into 4 equal parts, each part is the original scaled down by a factor of 3, hence 3 = 41/d = 41/1.26186
• The dimension of the Koch snowflake fractal = d = log(4)/log(3) which is approx. 1.2618595
• See the slide showing the Koch snowflake
Fractal Geometry
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
• For deterministic, self-similar fractals we have
• Fractal initiator– start shape
• Fractal generator– the pattern that subparts of the initiator are replaced by
• The generation of the fractal is deterministic because we always replace a
subpart of the initiator with the generator and we do this at each step
exactly the same way every time.
• Example on the board (figure 8-70).
Fractal Geometry
Michael Eckmann - Skidmore College - CS 376 - Spring 2007
• For statistically, self-similar fractals we could have– a Fractal initiator and – randomly choose a generator from a set of generators to be the pattern
to replace a subpart of the initiator at each step
• This is non-deterministic (won't get the same exact shape every time) due
to the random choice of generator.
• Instead of random generators, – random scalings could be done or – something else that is random to make the fractal non-deterministic.
• see figure 8-80 for an example.
Fractal Geometry
Top Related