Professional Documents
Culture Documents
Bezier Curve Paper-3
Bezier Curve Paper-3
A Bezier curve in its most common form is a simple cubic equation that can be
used in any number of useful ways. Originally developed by Pierre Bézier in
the 1970's for CAD/CAM operations, it became the underpinnings of the entire
Adobe PostScript drawing model. If you're a regular user of Adobe Illustrator,
Macromedia Freehand or Fontographer, any number of spline-based 3D
programs, etc., you've probably used Bézier curves.
It can also be used for animation. These pages are a simple introduction to how
to implement Béziers for motion control: how to choose curves and control
points, and how to calculate movement along the curve. I've provided a sample
Shockwave movie you can try out, download, and grub around in the code of.
The Math Behind the Bézier Curve
A cubic Bezier curve is defined by four points. Two are endpoints. (x0,y0) is the
origin endpoint. (x3,y3) is the destination endpoint. The points (x1,y1) and (x2,y2)
are control points.
Two equations define the points on the curve. Both are evaluated for an
arbitrary number of values of t between 0 and 1. One equation yields values for
x, the other yields values for y. As increasing values for t are supplied to the
equations, the point defined by x(t),y(t) moves from the origin to the
destination. This is how the equations are defined in Adobe's PostScript
references.
x1 = x0 + c x / 3
x2 = x1 + (cx + bx) / 3
x3 = x0 + cx + bx + ax
y1 = y0 + c y / 3
y2 = y1 + (cy + by) / 3
y3 = y0 + cy + by + ay
cx = 3 (x1 - x0)
bx = 3 (x2 - x1) - cx
ax = x3 - x0 - cx - bx
cy = 3 (y1 - y0)
by = 3 (y2 - y1) - cy
ay = y3 - y0 - cy - by
Now, simply by knowing coördinates for any four points, you can create the
equations for a simple Bézier curve.
Loops
By grossly distorting the values for origin, destination, and control points, it's
possible to create curves that approximate parabolas, arcs, and even loops.
(Remember when you're programming that you don't have to limit your control
points to valid stage locations!)
Take some time to experiment with our Shockwave Bézier demo (requires
Shockwave for Director 5). Put Béziers to work for you today!
Straight Lines
This example shows a straight line animation using a Bézier curve. As you can
see, the control points lie approximately 1/3 of the distance from their
associated endpoint to the other endpoint. This creates a smooth movement
from origin to destination. It would probably be simpler to animate this
movement with another method, though.
This animation, on the other hand, might be a little bit harder. As you can see
from the spacing of the iterated points, the dot starts moving, slows down, then
speeds up to twice its previous speed before stopping. If you look closely,
you'll see that the green and red control points are almost touching, about 1/3 of
the way from the origin to the destination.
Bézier curve equations are constructed in such a way that when the value for t
is 0.333...., the most influential of the four defining points will be x1,y1.
Likewise, at 0.666..., x2,y2 will hold sway.
Because of their (dare I say it?) flexibility, Bézier's equations are ideal for
creating smoothly animated acceleration and deceleration sequences, as well as
semi-complex curves.
Simple Curves
This example shows the default curve iterated by the sample movie. The small
black square moves from the origin point x0,y0 (large green dot) to the
destination point x3,y3 (large red dot), successively coming under the influence
of the control points: first the small green dot x1,y1, then the small red dot x2,y2.
The movement along this curve is fairly steady. There are 50 points along the
curve, with t increasing by 0.02 each iteration.
The curve's slope (or direction) at the origin is tangent to the line between x0,y0
and x1,y1. The same holds true for the slope at the destination and the line
between x2,y2 and x3,y3.
The length of the line between each endpoint and its associated control point
determines the speed of the movement along segments of the curve, as we'll see
when we look at how you can use Bézier curves to create straight-line
animations with acceleration and deceleration.
Stiffness Method
Introduction
Where
A = Cross section area of the member
E = Elasticity modulus
L = Length of the member
C = cos(θ )
S = sin(θ )
k = Member stiffness method
(2)
Where
A = Cross section area of the element
E = Elasticity modulus
I = Moment of inertia
L = Length of the element
C = cos(θ )
S = sin(θ )
k = Element stiffness method
Where
K = Global stiffness matrix
k = Local element matrix
N = Total number of element
e = Index
Where
F = Global force matrix
f = Local force matrix
N = Total number of element
e = Index
Where
d = Displacement matrix