8#ifndef PXR_BASE_TS_EVALUATOR_H
9#define PXR_BASE_TS_EVALUATOR_H
12#include "pxr/base/ts/evalCache.h"
13#include "pxr/base/ts/spline.h"
14#include "pxr/base/ts/types.h"
20PXR_NAMESPACE_OPEN_SCOPE
42 T
Eval(
const TsTime &time, TsSide side=TsRight)
const;
48 std::vector<std::shared_ptr<Ts_EvalCache<T> > > _segments;
65 if (spline.
size() > 1) {
70 if (kf.GetKnotType() == TsKnotBezier) {
79 _segments.reserve(spline.size() - 1);
89 if (iAfterTime == spline.end()) {
93 std::shared_ptr<Ts_EvalCache<T> > segmentCache =
94 Ts_EvalCache<T>::New(*splItr, *iAfterTime);
97 _segments.push_back(segmentCache);
111 if (!_segments.empty() && side == TsRight) {
115 if (time >= _spline.begin()->GetTime() &&
116 time <= _spline.rbegin()->GetTime()) {
120 if (
TF_VERIFY(sample != _spline.end())) {
127 size_t idx = sample - _spline.begin();
128 if (sample->GetTime() > time &&
TF_VERIFY(idx > 0)) {
134 return _segments[idx]->TypedEval(time);
141 if (!_spline.empty()) {
142 return _spline.Eval(time).template Get<T>();
146 return TsTraits<T>::zero;
149PXR_NAMESPACE_CLOSE_SCOPE
Opaque interface to a spline for evaluations using cached segments.
T Eval(const TsTime &time, TsSide side=TsRight) const
Evaluates the spline at the given time.
TsEvaluator()
Default constructor; falls back to empty spline.
Specifies the value of an TsSpline object at a particular point in time.
Represents a spline value object.
TS_API size_t size() const
\group Container API
TsKeyFrameMap::const_iterator const_iterator
Our iterators are simply iterators into the contained TsKeyFrameMap We only expose const iterators be...
#define TF_FOR_ALL(iter, c)
Macro for iterating over a container.
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
#define TRACE_FUNCTION()
Records a timestamp when constructed and a timespan event when destructed, using the name of the func...