HDK
|
#include <UT_Spline.h>
Static Public Member Functions | |
template<typename T > | |
static T | evalCubic (T kt, T dt, T iv, T im, T ov, T om, int order=0) |
template<typename T > | |
static T | evalQuintic (T kt, T dt, T iv, T im, T ia, T ov, T om, T oa, int order=0) |
static fpreal64 | getMonotoneSlopeFC (fpreal64 v_cur, fpreal64 t_cur, fpreal64 v_prev, fpreal64 t_prev, fpreal64 v_next, fpreal64 t_next) |
static fpreal64 | getMonotoneSlopePA (fpreal64 v_cur, fpreal64 t_cur, fpreal64 v_prev, fpreal64 t_prev, fpreal64 v_next, fpreal64 t_next) |
The Linear & Catmull-Rom splines expect a parametric coordinate for evaluation between 0 and 1. The Catmull-Rom spline requires additional key values at the beginning and end of the spline to evaluate the slopes of the Hermite spline properly.
The LinearSolve only works on scalar values. It will compute the parametric coordinate associated with the value passed in. This can be used to simulate non-uniform keys on the spline.
Definition at line 721 of file UT_Spline.h.
UT_Spline::UT_Spline | ( | ) |
UT_Spline::~UT_Spline | ( | ) |
|
inlinestatic |
Given the keys surrounding a channel segment, evaluate it as cubic hermite spline. This function assumes dt > 0. kt is [0,1] which maps over the dt time interval. The order
-th derivative with respect to kt is returned. In particular, for order == 0 (default), the value is returned.
Definition at line 840 of file UT_Spline.h.
|
inlinestatic |
Given the keys surrounding a channel segment, evaluate it as a quintic hermite spline. See evalCubic above.
Definition at line 864 of file UT_Spline.h.
bool UT_Spline::evaluate | ( | fpreal | t, |
fpreal32 * | result, | ||
int | size, | ||
UT_ColorType | interp_space, | ||
int | order = 0 |
||
) | const |
Evaluate the spline using the global basis. When interp_space is not UT_RGB, then values are treated as UT_RGBA and converted into the desired color space before being interpolated. The result is always returned as UT_RGBA.
If order == 0, the value is returned. If order == 1, the derivative with respect to t is returned.
bool UT_Spline::evaluate | ( | fpreal | t, |
fpreal64 * | result, | ||
int | size, | ||
UT_ColorType | interp_space, | ||
int | order = 0 |
||
) | const |
Evaluate the spline using the global basis. When interp_space is not UT_RGB, then values are treated as UT_RGBA and converted into the desired color space before being interpolated. The result is always returned as UT_RGBA.
If order == 0, the value is returned. If order == 1, the derivative with respect to t is returned.
bool UT_Spline::evaluateMulti | ( | fpreal | t, |
fpreal32 * | result, | ||
int | n, | ||
UT_ColorType | interp_space, | ||
int | knot_segment_hint = -1 , |
||
int | order = 0 |
||
) | const |
Evaluate the spline using multiple basis types depending on t. Also unlike evaluate(), evaluateMulti() doesn't require extra keys for Catmull-Rom on the ends. It always evaluates using a 0 slope at the ends.
If order == 0, the value is returned. If order == 1, the derivative with respect to t is returned.
bool UT_Spline::evaluateMulti | ( | fpreal | t, |
fpreal64 * | result, | ||
int | n, | ||
UT_ColorType | interp_space, | ||
int | knot_segment_hint = -1 , |
||
int | order = 0 |
||
) | const |
Evaluate the spline using multiple basis types depending on t. Also unlike evaluate(), evaluateMulti() doesn't require extra keys for Catmull-Rom on the ends. It always evaluates using a 0 slope at the ends.
If order == 0, the value is returned. If order == 1, the derivative with respect to t is returned.
|
inline |
Query the basis or knot length of the spline.
Definition at line 730 of file UT_Spline.h.
|
inline |
Definition at line 732 of file UT_Spline.h.
int64 UT_Spline::getMemoryUsage | ( | bool | inclusive | ) | const |
Return the amount of memory owned by this UT_Spline in bytes.
|
static |
Return monotone cubic Hermite slopes at the current knot given the previous and next knots. Fritsch-Carlson (local) method. It gives relatively good looking C1 curves but might not give a C2 solution even if it exists.
|
static |
Paul Kupan's method. Similar to Fritsch-Carlson method except it gives more visually pleasing results when the intervals next to the knot are uneven.
|
inline |
Definition at line 733 of file UT_Spline.h.
|
inline |
Definition at line 731 of file UT_Spline.h.
Given the position within the two knots and the first knot index number, normalize the position from knot-length domain to unit domain.
void UT_Spline::setAllBases | ( | UT_SPLINE_BASIS | b | ) |
Sets the spline's global basis to b, and also set the basis of every knot to b.
void UT_Spline::setBasis | ( | int | key, |
UT_SPLINE_BASIS | b | ||
) |
Set the basis for the given key index. This will also set the global basis.
|
inline |
Definition at line 735 of file UT_Spline.h.
Construction of the spline object. All values are initialized to 0. Warning, calling setSize() will clear all existing values.
Cubic splines may have a "tension". The tension defaults to 0.5 which results in Catmull-Rom splines.
Once the spline has been constructed, the values need to be set. It is possible to change values between evaluations.
Once the spline has been constructed, the values need to be set. It is possible to change values between evaluations.
fpreal UT_Spline::solveSpline | ( | fpreal | parm, |
const UT_Array< fpreal > & | knots, | ||
int * | parm_knot_segment = nullptr , |
||
int | order = 0 |
||
) | const |