8.7 - Bezier Path Orientation¶
Consider a race car speeding around a race track. Not only is the car changing location, it is also changing orientation as it follows the race track. The speed of an object along a Bezier defined curve is a vector which has a magnitude and a direction. We can use the direction of the speed vector to control the orientation of an object as it follows the path.
Every object has a local coordinate system that is defined by three orthogonal axes. The speed vector of a Bezier parametric equation can be used to set one of the axes of a local coordinate system. To solve for the other two axes we need one more vector, which must be arbitrarily specified by an animator. Please note that this was also true of a virtual camera. To calculate a local coordinate system for a camera we made the animator specify which direction was “up”.
With reference to lesson 7.6, if we know the desired orientation and location of an object, the transformation matrix needed to place the object in the scene is straightforward: the local coordinate system axes become the first three columns, while the location fills in the fourth column like this:
uy
uz
0
vx
vy
vz
0
nx
ny
nz
0
tx
ty
tz
1
Eq1
where the vector, <ux,uy,uz>
is “to the right” of the object,
the vector, <vx,vy,vz>
, is pointing “up”, and
the vector, <nx,ny,nz>
is pointing away from the
“front” of the object.
The following WebGL program modifies the orientation of a model based on
the direction of the path’s speed vector. We arbitrarily align the speed vector
with the n
axis of the local coordinate system and specify that
the “up direction” is in the y-axis direction. The local coordinate system
is calculated by taking cross-products of these vectors to create three
orthogonal axes. The location is calculated from the Bezier equation.
Please experiment with the following WebGL program and study the code.
Use a parametric equation to calculate points along a path.
Intermediate points influence acceleration and deceleration.
speed : ---
acceleration : ---
frames per second : ---
current frame 0 : 0 120
animation: start frame: end frame:
Show path
Scale <p1-p0> 1.0 : 0.0 3.0
---
Summary
The first derivative of the Bezier equation produces a speed vector. This vector can be used to define a local coordinate system that aligns the animated model with the path of motion.
Glossary¶
- Bezier parametric equation
- A function of one variable,
t
, that calculates changes along a “path”. - Speed vector
- The first derivative of an equation of motion. Speed always has a direction and a magnitude.
Self Assessment¶
-
Q-193: The names
- relative to the object, to the right.
- Correct.
- relative to the object, up.
- Incorrect. "Up" is in the v direction.
- relative to the object, forward (away from the front).
- Incorrect. "Forward" is in the n direction.
u
, v
and n
are used to define a local
coordinate system for an object (either a model or a camera.) In reference
to the object, which direction does the u
vector point.
-
Q-194: If
- n x u (cross product of n and u)
- Correct. Using the "right-hand-rule," align your thumb with n, your index finder with u, and your middle finder will point in the direction of v.
- u x n (cross product of u and n)
- Incorrect. This calculates -v because the order of the cross-product is wrong.
- v x n (cross product of v and n)
- Incorrect. You can't use v to calculate v.
- u x v (cross product of u and v)
- Incorrect. You can't use v to calculate v.
u
and n
are known, how can v
be calculated.
-
Q-195: How can you make an object move more slowly along a path – without changing the path’s location?
- increase the number of frames used for the motion.
- Correct. Speed is distance divided by time. Increasing the time lowers the speed.
- adjust the intermediate control points.
- Incorrect. This will change the speed and acceleration but also the path's location.
- adjust the starting and ending control points.
- Incorrect. This will change the speed and acceleration but also the path's location.
- make the path non-linear.
- Incorrect. Not relevant.