Roller Coaster Physics
Roller Coaster Physics
- a point mass moving on a spline
- frictionless with gravity
- energy conservation law applies
We can always compute the magnitude of the velocity of any given point!
Motion on a spline
Problem: our mass point moves on a parametric function where is a function of time .
We know the initial position of the point and its velocity at any time .
Can we compute the position of the point at arbitrary time ?
Arc-length Parameterization
Arc-length is the distance from the initial position along the curve.
We need to reparameterization to arc-length.
is monotonically increasing!
But the integral cannot be evaluated analytically, not even for polynomials.
We need to compute integral numerically.
Chord Length Approximation
Sample the curve and estimate the arc length by computing the linear distance through the sequence of samples.
If curvature is high, the error between the chord and the curve can become too large.
Solution: Adaptive sampling!
If adding a new sample at the midpoint changes total length above give tolerance, add it.
Repeat until there is no more point to add.
General Numerical Integration Methods
We use error rate to evaluate integration methods.
If an error rate is , it means that if a sampling interval is reduced to 1/2, the error rate will decrease to 1/4.
- Trapezoidal rule: piecewise linear, error rate
- Simson's rule: piecewse quadratic, error rate
- Gaussian quadrature rule: used for prodcution
Adaptive sampling can be also used!
Only polynomials up to the fourth order are used, higher order don't reduce the error rate.
Computing inverse
Given arc-length , determine the original parameter .
Since is monotonically increasing, so is .
We can formulate as a root finding problem.
Bisection algorithm may be used, (since s(u) is monotonically increasing) but Newton-Raphson iteration is faster.
Simulating mass point on a spline
Assume we know at any , and initial point is .
We simulate the point with constant time step .
can be computed by root finding .
Camera movement along a Spline
Frenet frame
Well-defined and continuous as long as and do not vanish.
- tangent vector
- binormal vector
- normal vector
Problem: if spline is straight line, (i.e. curvature is 0) do vanish.
Continuous Frenet Frame?
We can use this:
This is not frenet frame, and eventually frame will be disorted, but anyway it's continuous.
Unit Quaternion Splines
A curve is constructed as affine combination of control points.
Similiary, we can construct a curve on unit quaternion space if an affine combination of unit quaternions is defined.
Recall) we already know one affine combination: slerp!
Problem: Quaternion doesn't match with tanget of the spline.
Solution: Fix tangent vector and project to , or make orthogonal matrix with modified vectors.
Affine Combination in
Problems:
- Ambiguity
- Antipodal equivalence
- Spherical structure
- Unstable
- e.g. let's just average and projection to . If average results near the center of the sphere, projection will vary a lot.
Solution? We'll assume that we're computing affine combination only for points that are close to each other.
Re-normalization
Just treat unit quaternions as 4D vectors, then project the affine combination to .
Pros: simple, efficient
Cons: Linear precision doesn't holds. i.e. Re-normalization of is not for linear function .
Multi-Linear Method
Evaluate n-point weight sum as a sequence of slerps.
Recall)
e.g. Let's calculate .
Quaternion Bezier Curve
Recall) De Casteljau Algorithm evaluates a point on a Bezier curve by recursively interpolating control points.
We use De Casteljau Algorithm on quaternions, but instead of interpolation, we use slerp.
Pros: Simple, intuitive, inherit good properties of slerp (e.g. coordinate-invariance)
Cons: Algebraically complicated, need ordering because slerp is not associative.
Linearization by exp/log
log maps quaternion to vector!
Problem: log are used with rotation, not ment to use with orientation..
This depends on the choice of the reference frame.
Functional Optimization
View affine combination as a certain energy function?
To minimize , should hold.
In unit quaternion space, we use spherical (geodesic) distance
Now we just have to find root of with numerical methods!
Pros: COOL! Theoretically rigorous
Cons: Need numerical iterations, computationally demanding.