CSE 694A: Lab 2
Due Wednesday, Oct. 8
LAB 2: Path following with ease-in/ease-out
PRELIMINARY NOTES
Use the main routine and support routines from lab 1.
ASSIGNMENT
Write a program to animate a cube that follows a curved path through a given set of points starting from a stopped position, accelerating to some maximum speed and then decelerating to a stop at the initial position.
The coordinates of the points to be interpolated can be hardcoded in your lab.
Use at least 8 non-coplanar points.
The initialization part of this lab will:
- set coefficient matrices for beginning segment, interior segments, and end segment.
- For each segment, loop through points, summing linear distances to create a table of parametric value and summed linear distance to approximate arc length and the computed point. Compute at least 200 points per segment.
The simulation part of this lab will:
- increment a time value, t, that goes from zero to one as the curve is traversed
- apply an ease function, s = ease(t), using constant acceleration assumption
- search the table created by the initialization routine for the entries s is between
- compute the fraction that s is between the two entries.
- use the computed fraction to interpolate between the points recorded in the table, u = table(s)
- evaluate the interpolation function to produce a point along the curve, p = P(u)
Display the interpolated points using small cubes
NOTES
- You can use any cubic interpolation method discussed in class.
Catmul-Rom or Blended Parabolas are recommended because these interpolate (as opposed to approximate) the given points and don't require any additional information (such as tangents) to control the interpolation.
- you need to control the speed of the cube somehow. This can be done by setting an appropriate delta-t. Another way to do it is to fix the delta-t and use a delay variable that gets updated first and only when it flips back to zero does t get incremented; speed is controlled by setting the value at which the delay variable flips to zero.
Debug Suggestions
- get one interior segment working, then add the beginning and then the ending segments
- get interpolation working first, then constant speed (equal-distance increments), then ease-in
- write your program so it's easy to set the number of interpolated positions per segment; start with a low number to test your code