Game Development Reference
In-Depth Information
10. Our first task is to convert the curve from functional the form y = f(x) into parametric
form (x(t), y(t)). We will assume that x is a linear function of t, so we solve x(t) = mt + b
given x(0) = −0.9683 and x(1) = 4.2253. This gives us x(t) = 5.1936t − 0.9683. The x-
coordinates of the Bezier control points are easily determined using the results of Exercise 6.
We chose x to be a linear function of t because we assumed it had constant horizontal
velocity, so the x-coordinates of the control points are spaced evenly at t = 1/3 and
t = 2/3. Summarizing all four control points, we have
x 0 = x(0) = −0.968,
x 1 = x(1/3) = 5.1936(1/3)−0.9683 = 0.763,
x 2 = x(2/3) = 5.1936(2/3)−0.9683 = 2.494,
x 3 = x(1) = 4.225.
The x-coordinates were trivial in this problem; all the real work was in the y-coordinates.
Plugging x(t) into our functional form, we have
y = −0.364x 2 + 1.145x + 2.110
= −0.364(5.1936t−0.9683) 2 + 1.145(5.1936t−0.9683) + 2.110
= −9.818t 2 + 9.608t + 0.660,
which is a perfectly valid 1D cubic curve in monomial form. We convert this to Bezier form
by using Equations (13.20)-(13.23):
y 0 = c 0 = 0.660,
y 1 = c 0 + (1/3)c 1 = 0.660 + (1/3)(9.608) = 3.863,
y 2 = c 0 + (2/3)c 1 + (1/3)c 2 = 0.660 + (2/3)(9.608) + (1/3)(−9.818) = 3.793,
y 3 = c 0 + c 1 + c 2 + c 3 = 0.660 + 9.608 + (−9.818) + 0 = 0.450.
Notice that the two middle y-coordinates are nearly equal, since the starting and ending
points we have chosen make our parabola slightly asymmetric.
Putting all this together, our four Bezier control points are
b 0 = (−0.968, 0.660),
b 1 = (0.763, 3.863),
b 2 = (2.494, 3.793),
b 3 = (4.225, 0.450).
11.
(a) For the first control point, we do regular de Casteljau using 0.2 for each round.
b 0 = 0.80 b 0 + 0.20 b 1 = 0.80(3, 5) + 0.20(6, 1) = (3.60, 4.20)
b 1 = 0.80 b 1 + 0.20 b 2 = 0.80(6, 1) + 0.20(0, 3) = (4.80, 1.40)
b 2 = 0.80 b 2 + 0.20 b 3 = 0.80(0, 3) + 0.20(5, 5) = (1.00, 3.40)
b 0 = 0.80 b 0 + 0.20 b 1 = 0.80(3.60, 4.20) + 0.20(4.80, 1.40) = (3.84, 3.64)
b 1 = 0.80 b 1 + 0.20 b 2 = 0.80(4.80, 1.40) + 0.20(1.00, 3.40) = (4.04, 1.80)
b
0 = 0.80 b 0 + 0.20 b 1 = 0.80(3.84, 3.64) + 0.20(4.04, 1.80) = (3.88, 3.27)
Search WWH ::




Custom Search