Contents

## 15: Final Project: Roller Coaster! CSE167: Computer Graphics Instructor: Ronen

Chiappetta, Ralph, News Assistant has reference to this Academic Journal, PHwiki organized this Journal 15: Final Project: Roller Coaster! CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006 Roller coasters Final project Build a roller coaster, with a car riding on it More open-ended than previous projects Be creative! We do have some specific capabilities/features well look as long as But well be impressed by style too!

This Particular University is Related to this Particular Journal

Final project More on your own than previous projects No base code though you may use base code from previous assignments Today Ill go over the key techniques Roller coaster steps (see web page as long as details) Make a piecewise-cubic curve Create coordinate frames along a piecewise-cubic curve will be used to orient along the path include a roll angle at each curve point, to adjust tilt Create a swept surface the actual track along the of the roller coaster Design in addition to build the roller coaster track Run a car on the track Step 1. Piecewise-Cubic Curve Specify as a series of points Will be used as long as the path of the roller coaster

Step 2. Coordinate Frames on curve Describes orientation along the path Step 2b. Tweak coordinate frames Control lean of coordinate frames Specify roll angle offset at each control point Step 3a. Sweep a cross section Define a cross section curve (piecewise-linear is OK) Sweep it along the path, using the frames

3b. Tessellate Construct triangles using the swept points (sweep more finely than this drawing, so itll be smoother) 4. Run a car on the track Step 1. Piecewise-Cubic Curve Specify as a series of points Will be used as long as the path of the roller coaster

Piecewise-Cubic Curve Requirements: Given an array of N points Be able to evaluate curve as long as any value of t (in 0 1) Curve should be C1-continuous Best approach: define a class, something like class Curve { Curve(int Npoints, Point3 points[]); Point3 Eval(float t); } Piecwise-Cubic Curves Three recommended best choices: Bézier segments Advantages: You did a Bézier segment in Project 5 Disadvantages: Some work to get C1 continuity Will discuss technique to do this B-Spline Advantages: simple, always C1 continuous Disadvantages: New thing to implement, doesnt interpolate Catmull-Rom spline Advantages: interpolates points Disadvantages: Less predictable than B-Spline. New thing to implement Piecewise Bézier curve review We have a Bézier segment function Bez(t,p0,p1,p2,p3) Given four points Evaluates a Bézier segment as long as t in 0 1 Implemented in Project 5 Now define a piecewise Bézier curve x(u) Given 3N+1 points p0, p3N Evaluates entire curve as long as u in 0 1 Note: In class 8, defined curve as long as u in 0 N Today will define it as long as u in 0 1

Piecewise Bézier curve: segments x0(t) x1(t) x2(t) x3(t) p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 Piecewise Bézier curve x(0.3) x(0.71) x(0.25) x(0.0) x(0.5) x(0.75) x(1.0) Piecewise Bézier curve 3N+1 points define N Bézier segments x(i/N)=p3i C0 continuous by construction G1 continuous at p3i when p3i-1, p3i, p3i+1 are collinear C1 continuous at p3i when p3i-p3i-1 = p3i+1-p3i p0 p0 p1 p2 P3 P3 p2 p1 p4 p5 p6 p6 p5 p4 C1 continuous C1 discontinuous

Tangent to piecewise Bézier curve Tangent to the piecewise curve same as the tangent to each segment (from Project 5) mathematically speaking, needs to be scaled in practice we often normalize anyway At the shared points, the tangents on the two sides might not agree Unless we arrange as long as C1 continuity Piecewise Bézier curves Inconveniences: Must have 4 or 7 or 10 or 13 or (1 plus a multiple of 3) points Not all points are the same Have to fiddle to keep curve C1-continuous Making a C1 Bézier curve A hack to construct a C1-continuous Bézier curve Actually, this is essentially implementing Catmull-Rom splines Instead, could just implement Catmull-Rom splines directly Same amount of work as implementing B-Spline Given M points: want a piecewise-Bézier curve that interpolates them Bézier segments interpolate their endpoints Need to construct the intermediate points as long as the segments

Auto-creation of intermediate points Given M original points Will have M-1 segments Will have N=3(M-1)+1 final points Auto-creation of intermediate points Need tangent directions at each original point Use direction from previous point to next point Auto-creation of intermediate points Introduce intermediate points Move off each original point in the direction of the tangent H in addition to le length = 1/3 distance between previous in addition to next points special-case the end segments. or as long as closed loop curve, wrap around

Auto-creation of intermediate points Resulting curve: Auto-creation of intermediate points Summary of algorithm: Given M originalPoints Allocate newPoints array, N = 3(M-1)+1 new points as long as each original point i p = originalPoints[i] v = originalPoints[i+1]-originalPoints[i-1] newPoints[3i-1] = p-v/6 newPoints[3i] = p newPoints[3i-1] = p+v/6 Of course, must be careful about start in addition to end of loop Can allow the curve to be a closed loop: wrap around the ends Other option B-spline Need at least 4 points, i.e. N+3 points B-spline curve uses given N+3 points as is Always C2 continuous no intermediate points needed Approximates rather than interpolates doesnt reach the endpoints not a problem as long as closed loops: wrap around. simple algorithm to compute (may need to extend matrix library to support Vector4)

Blending Functions Review Evaluate Bézier using Sliding window Window moves as long as ward by 3 units when u passes to next Bézier segment With 3N+1 points, N positions as long as window, ie. N segments Evaluate matrix in window: B-spline blending functions Still a sliding window Shift window by 1, not by 3 With N+3 points, N positions as long as window, i.e. N segments Tangent to B-spline Same as long as mulation, but use T vector ( in addition to scale by N)

Parallel Transport User specifies initial up vector as long as t=0 (or s=0) Construct an initial frame using the lookat method Compute subsequent up vectors incrementally Directly as long as each sample when sampling curve as long as tesselation; or In advance when defining the curve: Compute in addition to store up vector at each control point Use the stored up vectors as control points as long as an up vector spline Given the tangent in addition to an up vector at each point Can construct a frame using the lookat method None of our stored up vectors will be parallel to the tangent. Parallel Transport Done Enjoy your projects! Next class: guest lecture on game design

## Chiappetta, Ralph News Assistant

Chiappetta, Ralph is from United States and they belong to Arizona Republic and they are from Phoenix, United States got related to this Particular Journal. and Chiappetta, Ralph deal with the subjects like Local News; Regional News; Sports

## Journal Ratings by Greensboro College

This Particular Journal got reviewed and rated by Greensboro College and short form of this particular Institution is US and gave this Journal an Excellent Rating.