25 #ifndef PXR_BASE_TS_SPLINE_H
26 #define PXR_BASE_TS_SPLINE_H
89 explicit TsSpline(
const std::vector<TsKeyFrame> & keyFrames,
126 -std::numeric_limits<double>::infinity(),
127 std::numeric_limits<double>::infinity())));
153 std::vector<TsKeyFrame>
193 std::optional<TsKeyFrame>
195 bool flatTangents,
double tangentLength,
218 bool flatTangents,
double tangentLength,
235 bool flatTangents,
double tangentLength,
236 const std::vector<VtValue> &
values,
254 Breakdown(
const std::vector<double> & times,
255 const std::vector<TsKnotType> &
types,
256 bool flatTangents,
double tangentLength,
257 const std::vector<VtValue> & values,
276 std::optional<TsKeyFrame>
282 std::optional<TsKeyFrame>
288 std::optional<TsKeyFrame>
373 std::pair<TsExtrapolationType, TsExtrapolationType>
379 const std::type_info &
448 double timeScale,
double valueScale,
449 double tolerance )
const;
452 std::pair<VtValue, VtValue>
569 void _BreakdownMultipleValues(
const std::vector<double> ×,
570 TsKnotType type,
bool flatTangents,
double tangentLength,
571 const std::vector<VtValue> &values,
575 void _BreakdownMultipleKnotTypes(
const std::vector<double> ×,
576 const std::vector<TsKnotType> &types,
577 bool flatTangents,
double tangentLength,
578 const std::vector<VtValue> &values,
587 bool flatTangents,
double tangentLength,
590 typedef std::vector<std::pair<TsTime, VtValue>> _Samples;
594 void _BreakdownSamples(
598 double tangentLength,
604 bool _IsVarying(
double tolerance)
const;
611 std::shared_ptr<TsSpline_KeyFrames> _data;
TsExtrapolationType
Spline extrapolation types.
TS_API size_t count(const TsTime &t) const
TS_API size_t size() const
TS_API std::ostream & operator<<(std::ostream &out, const TsSpline &val)
TS_API TfType GetType() const
Held; splines hold values at edges.
TS_API bool IsTimeLooped(TsTime time) const
Is the given time in the "unrolled" region of a spline that is looping; i.e. not in the master region...
TS_API std::optional< TsKeyFrame > GetClosestKeyFrameBefore(TsTime targetTime) const
Finds the closest keyframe before the given time. Returns an empty value if no such keyframe exists...
TS_API bool ClearRedundantKeyFrames(const VtValue &defaultValue=VtValue(), const GfMultiInterval &intervals=GfMultiInterval(GfInterval(-std::numeric_limits< double >::infinity(), std::numeric_limits< double >::infinity())))
TS_API const_iterator upper_bound(const TsTime &t) const
GT_API const UT_StringHolder time
TS_API bool empty() const
std::vector< TsKeyFrame >::const_iterator const_iterator
TS_API bool IsEmpty() const
Returns whether there are any keyframes.
GLsizei const GLchar *const * string
TS_API const_iterator lower_bound(const TsTime &t) const
TS_API bool IsSegmentFlat(const TsKeyFrame &kf1, const TsKeyFrame &kf2) const
Returns true if the segment between the given (adjacent) key frames is flat.
TS_API std::vector< TsKeyFrame > GetKeyFramesInMultiInterval(const GfMultiInterval &) const
Returns the keyframes contained in the given GfMultiInterval.
TS_API iterator find(const TsTime &t)
TS_API bool IsVaryingSignificantly() const
Like IsVarying(), but for splines of type double, allows tiny value differences.
TS_API bool DoSidesDiffer(TsTime time) const
TS_API bool IsKeyFrameRedundant(const TsKeyFrame &keyFrame, const VtValue &defaultValue=VtValue()) const
Returns true if the given key frame is redundant.
TS_API void SwapKeyFrames(std::vector< TsKeyFrame > *swapInto)
TS_API bool empty() const
Return true if this spline has no KeyFrames.
TS_API const TsKeyFrameMap & GetRawKeyFrames() const
An ordered sequence of keyframes with STL-compliant API for finding, inserting, and erasing keyframes...
TS_API void SetExtrapolation(TsExtrapolationType left, TsExtrapolationType right)
Sets the spline's extrapolation type on each side.
TS_API VtValue Eval(TsTime time, TsSide side=TsRight) const
TS_API const TsKeyFrameMap & GetKeyFrames() const
const_reverse_iterator reverse_iterator
TS_API const_iterator find(const TsTime &t) const
std::vector< TsKeyFrame >::const_reverse_iterator const_reverse_iterator
TsKnotType
Keyframe knot types.
TS_API bool IsSegmentValueMonotonic(const TsKeyFrame &kf1, const TsKeyFrame &kf2) const
Returns true if the segment between the given (adjacent) key frames is monotonic (i.e. no extremes).
std::vector< TsValueSample > TsSamples
A sequence of samples.
TS_API bool CanSetKeyFrame(const TsKeyFrame &kf, std::string *reason=nullptr) const
TS_API const_reverse_iterator rbegin() const
Return a const_reverse_iterator pointing to the end of the spline.
TS_API VtValue EvalDerivative(TsTime time, TsSide side=TsRight) const
TS_API const_reverse_iterator rend() const
TS_API std::optional< TsKeyFrame > Breakdown(double x, TsKnotType type, bool flatTangents, double tangentLength, const VtValue &value=VtValue(), GfInterval *intervalAffected=nullptr)
Breakdown at time x.
TsKeyFrameMap::const_reverse_iterator const_reverse_iterator
TS_API std::pair< VtValue, VtValue > GetRange(TsTime startTime, TsTime endTime) const
Specifies the value of an TsSpline object at a particular point in time.
TS_API TsLoopParams GetLoopParams() const
Return an object describing all the looping parameters for this spline.
TS_API bool KeyFrameIsInLoopedRange(const TsKeyFrame &kf)
TS_API const_iterator begin() const
Return a const_iterator pointing to the beginning of the spline.
PXR_NAMESPACE_OPEN_SCOPE typedef double TsTime
The time type used by Ts.
TS_API GfInterval GetFrameRange() const
TS_API TsSpline()
Constructs a spline with no key frames and held extrapolation.
TS_API const std::type_info & GetTypeid() const
TS_API TsSamples Sample(TsTime startTime, TsTime endTime, double timeScale, double valueScale, double tolerance) const
Evaluates the value of the spline over the given time interval. When the returned samples are scaled ...
TS_API const_iterator end() const
TsSide
Dual-value keyframe side.
TS_API std::string GetTypeName() const
TS_API void SetKeyFrame(TsKeyFrame kf, GfInterval *intervalAffected=nullptr)
TS_API bool operator!=(const TsSpline &rhs) const
Inequality operator.
TS_API bool operator==(const TsSpline &rhs) const
Equality operator.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
GLenum GLsizei GLsizei GLint * values
Maintains the keyframes for a spline.
TS_API std::optional< TsKeyFrame > GetClosestKeyFrameAfter(TsTime targetTime) const
Finds the closest keyframe after the given time. Returns an empty value if no such keyframe exists...
TS_API size_t size() const
Returns the number of KeyFrames in this spline.
#define PXR_NAMESPACE_CLOSE_SCOPE
TS_API void BakeSplineLoops()
TS_API bool IsLinear() const
Returns whether spline represents a simple linear relationship.
TsKeyFrameMap::const_iterator const_iterator
GLsizei GLenum GLenum * types
TS_API bool IsVarying() const
Returns true if the value of the spline changes over time, whether due to differing values among keyf...
TS_API std::optional< TsKeyFrame > GetClosestKeyFrame(TsTime targetTime) const
Finds the keyframe closest to the given time. Returns an empty value if there are no keyframes...
TS_API void RemoveKeyFrame(TsTime time, GfInterval *intervalAffected=nullptr)
TS_API std::pair< TsExtrapolationType, TsExtrapolationType > GetExtrapolation() const
TS_API bool HasRedundantKeyFrames(const VtValue &defaultValue=VtValue()) const
Returns true if any of this spline's key frames are redundant.
TS_API VtValue EvalHeld(TsTime time, TsSide side=TsRight) const
TS_API void SetLoopParams(const TsLoopParams &)
Set the looping parameters for this spline.