Loading...
Searching...
No Matches
TsKnot Class Reference

A knot belonging to a TsSpline. More...

#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.
 
TS_API TsKnot (TfType valueType, TsCurveType curveType=TsCurveTypeBezier)
 Creates a knot with a specified value type.
 
TS_API TsKnot (const TsKnot &other)
 
TS_API TsKnot (TsKnot &&other)
 
TS_API ~TsKnot ()
 
TS_API TsKnot & operator= (const TsKnot &other)
 
TS_API TsKnot & operator= (TsKnot &&other)
 
TS_API bool operator== (const TsKnot &other) const
 
TS_API bool operator!= (const TsKnot &other) const
 
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.
 
TS_API TsInterpMode GetNextInterpolation () const
 
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

Each knot's curve type must match the curve type of the spline to which it belongs.

Knot objects are Bezier by default.

In a Hermite spline, tangent widths are determined automatically. They are always one-third of the width of the segment to which they belong.

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.

Note
Note that Maya uses tangents in a different format. TsConvertFromStandardTangent is a utility function that can convert a standard width and slope to values expected by Maya.
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
 
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
 
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.
 
TS_API bool IsG1Continuous () const
 Not yet implemented.
 
TS_API bool IsC1Continuous () const
 Not yet implemented.
 

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
 

Detailed Description

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.

See also
TsTypedKnot

Definition at line 39 of file knot.h.

Constructor & Destructor Documentation

◆ TsKnot() [1/2]

TS_API TsKnot ( )

Default constructor creates a double-typed knot.

◆ TsKnot() [2/2]

TS_API TsKnot ( TfType  valueType,
TsCurveType  curveType = TsCurveTypeBezier 
)

Creates a knot with a specified value type.

Member Function Documentation

◆ _GetData() [1/2]

Ts_KnotData * _GetData ( )
inlineprotected

Definition at line 290 of file knot.h.

◆ _GetData() [2/2]

const Ts_KnotData * _GetData ( ) const
inlineprotected

Definition at line 291 of file knot.h.

◆ GetPostTanSlope()

bool GetPostTanSlope ( T *  slopeOut) const

Definition at line 570 of file knot.h.

◆ GetPreTanSlope()

bool GetPreTanSlope ( T *  slopeOut) const

Definition at line 543 of file knot.h.

◆ GetPreValue()

bool GetPreValue ( T *  valueOut) const

Definition at line 508 of file knot.h.

◆ GetValue()

bool GetValue ( T *  valueOut) const

Definition at line 483 of file knot.h.

◆ IsC0Continuous()

TS_API bool IsC0Continuous ( ) const

Not yet implemented.

◆ IsC1Continuous()

TS_API bool IsC1Continuous ( ) const

Not yet implemented.

◆ IsG1Continuous()

TS_API bool IsG1Continuous ( ) const

Not yet implemented.

◆ IsHolding()

bool IsHolding

Definition at line 465 of file knot.h.

◆ SetNextInterpolation()

TS_API bool SetNextInterpolation ( TsInterpMode  mode)

Sets the interpolation mode of the spline segment following this knot.

◆ SetPostTanSlope()

bool SetPostTanSlope ( T  slope)

Definition at line 558 of file knot.h.

◆ SetPreTanSlope()

bool SetPreTanSlope ( T  slope)

Definition at line 531 of file knot.h.

◆ SetPreValue()

bool SetPreValue ( const T  value)

Definition at line 495 of file knot.h.

◆ SetValue()

bool SetValue ( const T  value)

Definition at line 471 of file knot.h.

Friends And Related Function Documentation

◆ TsKnotMap

friend class TsKnotMap
friend

Definition at line 279 of file knot.h.

◆ TsRegressionPreventer

friend class TsRegressionPreventer
friend

Definition at line 280 of file knot.h.

◆ TsSpline

friend class TsSpline
friend

Definition at line 278 of file knot.h.


The documentation for this class was generated from the following file: