02.02.2013 Views

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Flash</strong> <strong>MX</strong> <strong>2004</strong> <strong>Games</strong><br />

Figure B.9 Piecewise curve fitting<br />

The curve we will use is<br />

y = h0 ∗ K1 + h1 ∗ K2 + h2 ∗ T1 + h3 ∗ T2<br />

where h0 <strong>to</strong> h3 are the hermite coefficients:<br />

h0 = 2t 3 − 3t 2 + 1<br />

h1 = 3t 2 − 2t 3<br />

h2 = t 3 − 2t 2 + t<br />

h3 = t 3 − t 2<br />

and T1 and T2 are the smoothing parameters. If S1 and S2 are defined as:<br />

then<br />

S1 = (K2.time − K1.time)/(K2.time − K0.time)<br />

S1 = (K2.time − K1.time)/(K3.time − K1.time)<br />

T1 = S1 ∗ ((1 − K1.tn)(1 + K1.bs)(1 + K1.ct)(K1.value − K0.value)<br />

+ (1 − K1.tn)(1 − K1.bs)(1 − K1.ct)(K2.value − K1.value))<br />

T2 = S2 ∗ ((1 − K2.tn)(1 + K2.bs)(1 − K1.ct)(K2.value − K1.value)<br />

+ (1 − K2.tn)(1 − K2.bs)(1 + K2.ct)(K3.value − K2.value))<br />

If the curve section is between K0 and K1, then<br />

406<br />

T1 = 0.5 ∗ (K2.value − K1.value) ∗ ((1 − K1.tn)(1 + K1.bs)(1 + K1.ct)<br />

+ (1 − K1.tn)(1 − K1.bs)(1 − K1.ct))

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!