What's a hermite spline without derivates? I suggest we add getSlope() or something like it to the interface/superclass; thoughts?
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@360 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -53,6 +53,19 @@ public class HermiteFunc extends InterpFunc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get the derivate of this function at a point. */
|
||||||
|
public function getSlope (t :Number) :int
|
||||||
|
{
|
||||||
|
if (t >= 1 || t < 0) { // cope with a funny startOffset
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
var tt :Number = t*t;
|
||||||
|
|
||||||
|
return int((_p0 - _p1) * (6*tt - 6*t) +
|
||||||
|
_m0 * (3*tt - 4*t + 1) +
|
||||||
|
_m1 * (3*tt - 2*t));
|
||||||
|
}
|
||||||
|
|
||||||
/** The coefficient for the spline that interpolates the beginning point value. */
|
/** The coefficient for the spline that interpolates the beginning point value. */
|
||||||
protected var _p0 :Number;
|
protected var _p0 :Number;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user