Flutter Engine
The Flutter Engine
|
Public Member Functions | |
FwDCubicEvaluator (const SkPoint points[4]) | |
void | restart (int divisions) |
bool | done () const |
SkPoint | next () |
const SkPoint * | getCtrlPoints () const |
Evaluator to sample the values of a cubic bezier using forward differences. Forward differences is a method for evaluating a nth degree polynomial at a uniform step by only adding precalculated values. For a linear example we have the function f(t) = m*t+b, then the value of that function at t+h would be f(t+h) = m*(t+h)+b. If we want to know the uniform step that we must add to the first evaluation f(t) then we need to substract f(t+h) - f(t) = m*t + m*h + b - m*t + b = mh. After obtaining this value (mh) we could just add this constant step to our first sampled point to compute the next one.
For the cubic case the first difference gives as a result a quadratic polynomial to which we can apply again forward differences and get linear function to which we can apply again forward differences to get a constant difference. This is why we keep an array of size 4, the 0th position keeps the sampled value while the next ones keep the quadratic, linear and constant difference values.
Definition at line 84 of file SkPatchUtils.cpp.
|
inlineexplicit |
Receives the 4 control points of the cubic bezier.
Definition at line 92 of file SkPatchUtils.cpp.
|
inline |
Check if the evaluator is still within the range of 0<=t<=1
Definition at line 119 of file SkPatchUtils.cpp.
|
inline |
Definition at line 135 of file SkPatchUtils.cpp.
|
inline |
Call next to obtain the SkPoint sampled and move to the next one.
Definition at line 126 of file SkPatchUtils.cpp.
|
inline |
Restarts the forward differences evaluator to the first value of t = 0.
Definition at line 102 of file SkPatchUtils.cpp.