|
HDK
|
#include <knot.h>
Inheritance diagram for TsKnot:Public Member Functions | |
Construction and value semantics | |
Unlike splines, knots have a fixed value type from the time they are constructed. Knots are fairly small, so copying them is not particularly expensive. Move construction and assignment are supported, but this is only beneficial when there is custom data. | |
| TS_API | TsKnot () |
| Default constructor creates a double-typed knot. More... | |
| TS_API | TsKnot (TfType valueType) |
| Creates a knot with a specified value type. More... | |
| TS_API | TsKnot (TfType valueType, TsCurveType curveType) |
| TS_API | TsKnot (const TsKnot &other) |
| Default constructor creates a double-typed knot. More... | |
| TS_API | TsKnot (TsKnot &&other) |
| Default constructor creates a double-typed knot. More... | |
| TS_API | ~TsKnot () |
| Default constructor creates a double-typed knot. More... | |
| TS_API TsKnot & | operator= (const TsKnot &other) |
| Default constructor creates a double-typed knot. More... | |
| TS_API TsKnot & | operator= (TsKnot &&other) |
| Default constructor creates a double-typed knot. More... | |
| TS_API bool | operator== (const TsKnot &other) const |
| Default constructor creates a double-typed knot. More... | |
| TS_API bool | operator!= (const TsKnot &other) const |
| Default constructor creates a double-typed knot. More... | |
Knot time | |
| TS_API bool | SetTime (TsTime time) |
| TS_API TsTime | GetTime () const |
Interpolation mode | |
| TS_API bool | SetNextInterpolation (TsInterpMode mode) |
| Sets the interpolation mode of the spline segment following this knot. More... | |
| TS_API TsInterpMode | GetNextInterpolation () const |
| Sets the interpolation mode of the spline segment following this knot. More... | |
Knot value | |
| TS_API TfType | GetValueType () const |
| template<typename T > | |
| bool | IsHolding () const |
| TS_API bool | SetValue (VtValue value) |
| template<typename T > | |
| bool | SetValue (const T value) |
| TS_API bool | GetValue (VtValue *valueOut) const |
| template<typename T > | |
| bool | GetValue (T *valueOut) const |
Dual values | |
| TS_API bool | IsDualValued () const |
| TS_API bool | SetPreValue (VtValue value) |
| template<typename T > | |
| bool | SetPreValue (const T value) |
| TS_API bool | GetPreValue (VtValue *valueOut) const |
| template<typename T > | |
| bool | GetPreValue (T *valueOut) const |
| TS_API bool | ClearPreValue () |
Curve type | |
| |
| TS_API bool | SetCurveType (TsCurveType curveType) |
| TS_API TsCurveType | GetCurveType () const |
Pre-tangent | |
Tangents are expressed as width and slope. It is an error to read or write widths for Hermite knots.
| |
| TS_API bool | SetPreTanWidth (TsTime width) |
| TS_API TsTime | GetPreTanWidth () const |
| TS_API bool | SetPreTanSlope (VtValue slope) |
| template<typename T > | |
| bool | SetPreTanSlope (T slope) |
| TS_API bool | GetPreTanSlope (VtValue *slopeOut) const |
| template<typename T > | |
| bool | GetPreTanSlope (T *slopeOut) const |
| TS_API bool | SetPreTanAlgorithm (TsTangentAlgorithm algorithm) |
| TS_API TsTangentAlgorithm | GetPreTanAlgorithm () const |
| Get the pre-tangent algorithm. More... | |
Post-tangent | |
| TS_API bool | SetPostTanWidth (TsTime width) |
| TS_API TsTime | GetPostTanWidth () const |
| TS_API bool | SetPostTanSlope (VtValue slope) |
| template<typename T > | |
| bool | SetPostTanSlope (T slope) |
| TS_API bool | GetPostTanSlope (VtValue *slopeOut) const |
| template<typename T > | |
| bool | GetPostTanSlope (T *slopeOut) const |
| TS_API bool | SetPostTanAlgorithm (TsTangentAlgorithm algorithm) |
| TS_API TsTangentAlgorithm | GetPostTanAlgorithm () const |
| Get the post-tangent algorithm. More... | |
Computed Tangents | |
| TS_API bool | UpdateTangents (const std::optional< TsKnot > prevKnot, const std::optional< TsKnot > nextKnot, TsCurveType curveType=TsCurveTypeBezier) |
| Update tangent values algorithmically. More... | |
Custom data | |
Knots may have custom data: an arbitrary VtDictionary of key/value pairs. Custom data does not affect evaluation. It is only for clients' use. When knots are edited, Ts does not automatically alter any custom data. This means that, if splines are written out, edited by other clients that do not recognize a particular kind of custom data, and read back in, then that custom data may become outdated. | |
| TS_API bool | SetCustomData (VtDictionary customData) |
| TS_API VtDictionary | GetCustomData () const |
| TS_API bool | SetCustomDataByKey (const std::string &keyPath, VtValue value) |
| TS_API VtValue | GetCustomDataByKey (const std::string &keyPath) const |
Continuity queries | |
| TS_API bool | IsC0Continuous () const |
| Not yet implemented. More... | |
| TS_API bool | IsG1Continuous () const |
| Not yet implemented. More... | |
| TS_API bool | IsC1Continuous () const |
| Not yet implemented. More... | |
Protected Member Functions | |
| TsKnot (Ts_KnotData *data, TfType valueType, VtDictionary &&customData) | |
| Ts_KnotData * | _GetData () |
| const Ts_KnotData * | _GetData () const |
Friends | |
| class | TsSpline |
| class | TsKnotMap |
| class | TsRegressionPreventer |
A knot belonging to a TsSpline.
This class is non-templated, but can hold data for varying value types (double, float, and half). All knots in a spline must have the same value type.
| TS_API TsKnot::TsKnot | ( | ) |
Default constructor creates a double-typed knot.
| TS_API TsKnot::TsKnot | ( | TfType | valueType, |
| TsCurveType | curveType | ||
| ) |
Creates a knot with a specified value type and curve type.
| TS_API TsKnot::~TsKnot | ( | ) |
Default constructor creates a double-typed knot.
|
protected |
|
inlineprotected |
|
inlineprotected |
| TS_API bool TsKnot::ClearPreValue | ( | ) |
| TS_API TsCurveType TsKnot::GetCurveType | ( | ) | const |
| TS_API VtDictionary TsKnot::GetCustomData | ( | ) | const |
| TS_API TsInterpMode TsKnot::GetNextInterpolation | ( | ) | const |
Sets the interpolation mode of the spline segment following this knot.
| TS_API TsTangentAlgorithm TsKnot::GetPostTanAlgorithm | ( | ) | const |
Get the post-tangent algorithm.
Set the post-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPostTanWidth and SetPostTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
| bool TsKnot::GetPostTanSlope | ( | T * | slopeOut | ) | const |
Set the post-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPostTanWidth and SetPostTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
| TS_API TsTime TsKnot::GetPostTanWidth | ( | ) | const |
Set the post-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPostTanWidth and SetPostTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
| TS_API TsTangentAlgorithm TsKnot::GetPreTanAlgorithm | ( | ) | const |
Get the pre-tangent algorithm.
Set the pre-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPreTanWidth and SetPreTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
| bool TsKnot::GetPreTanSlope | ( | T * | slopeOut | ) | const |
Set the pre-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPreTanWidth and SetPreTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
| TS_API TsTime TsKnot::GetPreTanWidth | ( | ) | const |
Set the pre-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPreTanWidth and SetPreTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
| bool TsKnot::GetPreValue | ( | T * | valueOut | ) | const |
| TS_API TsTime TsKnot::GetTime | ( | ) | const |
| bool TsKnot::GetValue | ( | T * | valueOut | ) | const |
| TS_API bool TsKnot::IsC0Continuous | ( | ) | const |
Not yet implemented.
| TS_API bool TsKnot::IsC1Continuous | ( | ) | const |
Not yet implemented.
| TS_API bool TsKnot::IsDualValued | ( | ) | const |
| TS_API bool TsKnot::IsG1Continuous | ( | ) | const |
Not yet implemented.
| TS_API bool TsKnot::operator!= | ( | const TsKnot & | other | ) | const |
Default constructor creates a double-typed knot.
Default constructor creates a double-typed knot.
Default constructor creates a double-typed knot.
Default constructor creates a double-typed knot.
| TS_API bool TsKnot::SetCurveType | ( | TsCurveType | curveType | ) |
| TS_API bool TsKnot::SetCustomData | ( | VtDictionary | customData | ) |
| TS_API bool TsKnot::SetNextInterpolation | ( | TsInterpMode | mode | ) |
Sets the interpolation mode of the spline segment following this knot.
| TS_API bool TsKnot::SetPostTanAlgorithm | ( | TsTangentAlgorithm | algorithm | ) |
Set the post-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPostTanWidth and SetPostTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
Set the post-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPostTanWidth and SetPostTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
| bool TsKnot::SetPostTanSlope | ( | T | slope | ) |
Set the post-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPostTanWidth and SetPostTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
| TS_API bool TsKnot::SetPostTanWidth | ( | TsTime | width | ) |
Set the post-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPostTanWidth and SetPostTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
| TS_API bool TsKnot::SetPreTanAlgorithm | ( | TsTangentAlgorithm | algorithm | ) |
Set the pre-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPreTanWidth and SetPreTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
Set the pre-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPreTanWidth and SetPreTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
| bool TsKnot::SetPreTanSlope | ( | T | slope | ) |
Set the pre-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPreTanWidth and SetPreTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
| TS_API bool TsKnot::SetPreTanWidth | ( | TsTime | width | ) |
Set the pre-tangent algorithm.
When this knot is part of a spline, the tangent algorithm will be used to compute updated tangent values, potentially overriding explicit values set by SetPreTanWidth and SetPreTanSlope. The algorithm TsTangentAlgorithmNone is used by default meaning the explicitly set values will be used unless a different algorithm is set.
| bool TsKnot::SetPreValue | ( | const T | value | ) |
| TS_API bool TsKnot::SetTime | ( | TsTime | time | ) |
| TS_API bool TsKnot::UpdateTangents | ( | const std::optional< TsKnot > | prevKnot, |
| const std::optional< TsKnot > | nextKnot, | ||
| TsCurveType | curveType = TsCurveTypeBezier |
||
| ) |
Update tangent values algorithmically.
Update the pre- and post-tangent values exactly the way a TsSpline would update them if this knot were added to the spline between prevKnot and nextKnot. If there is no previous and/or next knot, you can pass std::nullopt to indicate that the optional value is empty.
If prevKnot is not empty, its time must be before this knot. Similarly if nextKnot is not empty, its time must be after this knot. If either condition is not met, a coding error will be emitted and no changes to the tangent values will be made.
The curveType argument should be TsCurveTypeHermite if the knot is intended to be added to a Hermite spline. The curve type may affect the tangent calculations. Specifically, tangent widths in Hermite splines are always 1/3 of the width of the segment they are in, even if the tangent algorithm is TsTangentAlgorithmNone.
True will be returned if either of the algorithms in this knot run successfully, even if no values change. False will be returned otherwise.
|
friend |