HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
spline.h
Go to the documentation of this file.
1 //
2 // Copyright 2024 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 
8 #ifndef PXR_BASE_TS_SPLINE_H
9 #define PXR_BASE_TS_SPLINE_H
10 
11 #include "pxr/pxr.h"
12 #include "pxr/base/ts/api.h"
13 #include "pxr/base/ts/splineData.h"
14 #include "pxr/base/ts/knotMap.h"
15 #include "pxr/base/ts/knot.h"
16 #include "pxr/base/ts/types.h"
18 #include "pxr/base/ts/eval.h"
19 #include "pxr/base/vt/traits.h"
20 #include "pxr/base/vt/value.h"
21 #include "pxr/base/gf/interval.h"
22 #include "pxr/base/tf/type.h"
23 
24 #include <string>
25 #include <memory>
26 #include <iosfwd>
27 
29 
30 class VtDictionary;
31 
32 
33 /// A mathematical description of a curved function from time to value.
34 ///
35 /// This class is <b>STILL IN DEVELOPMENT.</b>
36 ///
37 /// Splines are are supported only for floating-point scalar value types.
38 /// This class is non-templated, but can hold data for varying value types
39 /// (double, float, and half). All knots in a spline must have the same value
40 /// type.
41 ///
42 /// Splines are defined by <i>knots</i>. The curve passes through each knot,
43 /// and in between, the shape of the curve is controlled by <i>tangents</i>
44 /// specified at the knots.
45 ///
46 /// Splines typically have Bezier or Hermite curve segments with controllable
47 /// tangents; linear and <i>held</i> (flat) interpolation are also supported.
48 /// Outside of the time span of knots, the <i>extrapolation</i> of the curve can
49 /// be specified.
50 ///
51 /// The main service provided by splines is <i>evaluation</i>: determining the
52 /// curve's value at a given time.
53 ///
54 /// Splines are copy-on-write. Copying a spline object is cheap; the copy will
55 /// point to the same data on the heap. Copying, and then modifying one of the
56 /// copies, will incur the cost of duplicating the data, including all the
57 /// knots.
58 ///
59 class TsSpline
60 {
61 public:
62  /// \name Construction and value semantics
63  ///
64  /// This is a lightweight class that wraps a shared pointer. It is intended
65  /// to be used as a value type, and copied freely. Move semantics are not
66  /// implemented; there would be no benefit.
67  ///
68  /// @{
69 
70  /// Default constructor creates a spline without a value type. The value
71  /// type becomes established when the first knot is added.
72  TS_API
73  TsSpline();
74 
75  /// Creates a spline with a specified value type.
76  TS_API
77  TsSpline(TfType valueType);
78 
79  TS_API
80  TsSpline(const TsSpline &other);
81 
82  TS_API
83  TsSpline& operator=(const TsSpline &other);
84 
85  TS_API
86  bool operator==(const TsSpline &other) const;
87 
88  TS_API
89  bool operator!=(const TsSpline &other) const;
90 
91  /// @}
92  /// \name Value types
93  /// @{
94 
95  TS_API
96  static bool IsSupportedValueType(TfType valueType);
97 
98  TS_API
99  TfType GetValueType() const;
100 
101  template <typename T>
102  bool IsHolding() const;
103 
104  TS_API
105  void SetTimeValued(bool timeValued);
106 
107  TS_API
108  bool IsTimeValued() const;
109 
110  /// @}
111  /// \name Curve types
112  /// @{
113 
114  TS_API
115  void SetCurveType(TsCurveType curveType);
116 
117  TS_API
118  TsCurveType GetCurveType() const;
119 
120  /// @}
121  /// \name Extrapolation
122  /// @{
123 
124  TS_API
125  void SetPreExtrapolation(
126  const TsExtrapolation &extrap);
127 
128  TS_API
130 
131  TS_API
133  const TsExtrapolation &extrap);
134 
135  TS_API
137 
138  /// @}
139  /// \name Inner loops
140  ///
141  /// Loop params are only valid when all of the following are true:
142  ///
143  /// - protoEnd > protoStart.
144  /// - At least one of numPreLoops or numPostLoops is nonzero and positive.
145  /// - There is a knot at protoStart.
146  ///
147  /// Any loop params may be set, and will be stored. Whenever the above
148  /// conditions are not met, the stored params will be ignored.
149  ///
150  /// To determine if loop params are currently valid, call HasInnerLoops.
151  ///
152  /// To disable inner loops, call
153  /// <code>SetInnerLoopParams(TsLoopParams())</code>.
154  ///
155  /// @{
156 
157  TS_API
158  void SetInnerLoopParams(
159  const TsLoopParams &params);
160 
161  TS_API
163 
164  /// @}
165  /// \name Knots
166  /// @{
167 
168  TS_API
169  void SetKnots(
170  const TsKnotMap &knots);
171 
172  TS_API
173  bool CanSetKnot(
174  const TsKnot &knot,
175  std::string *reasonOut = nullptr) const;
176 
177  /// <b>Incompletely implemented</b>; \p affectedIntervalOut is not yet
178  /// populated.
179  TS_API
180  bool SetKnot(
181  const TsKnot &knot,
182  GfInterval *affectedIntervalOut = nullptr);
183 
184  /// Returns the spline's knots. These are the original knots; if inner or
185  /// extrapolating loops are present, this set of knots does not reflect
186  /// that.
187  TS_API
188  TsKnotMap GetKnots() const;
189 
190  /// \overload
191  /// Get the spline's knots that affect the specified time interval.
192  ///
193  /// Return a TsKnotMap containing the knots that affect the time
194  /// interval. This may include knots outside the time interval if they
195  /// affect the curve inside the time interval. For example, if there
196  /// are knots at times 10, 20, and 30. Calling \c GetKnots with a
197  /// \c timeInteval of [15 .. 25] may return all 3 knots since the
198  /// knots at 10 and 30 may affect the shape of the spline at times
199  /// that are inside the \c timeInterval.
200  TS_API
201  TsKnotMap GetKnots(const GfInterval& timeInterval) const;
202 
203  /// Retrieves a copy of the knot at the specified time, if one exists. This
204  /// must be an original knot, not a knot that is echoed due to looping.
205  /// Returns true on success, false if there is no such knot.
206  TS_API
207  bool GetKnot(
208  TsTime time,
209  TsKnot *knotOut) const;
210 
211  /// @}
212  /// \name Removing knots
213  /// @{
214 
215  TS_API
216  void ClearKnots();
217 
218  /// <b>Incompletely implemented</b>; \p affectedIntervalOut is not yet
219  /// populated.
220  TS_API
221  void RemoveKnot(
222  TsTime time,
223  GfInterval *affectedIntervalOut = nullptr);
224 
225  /// <b>Not yet implemented.</b>
226  TS_API
227  bool ClearRedundantKnots(
228  VtValue defaultValue = VtValue(),
229  const GfInterval &interval = GfInterval::GetFullInterval());
230 
231  /// @}
232  /// \name Loop baking
233  /// @{
234 
235  /// Bake inner loops in the spline.
236  ///
237  /// Modify the spline by baking out the knots generated by inner looping to
238  /// explicit knots and resetting the looping parameters to default.
239  TS_API
240  bool BakeInnerLoops();
241 
242  /// Return all the knots on the spline, including knots generated by
243  /// inner looping.
244  ///
245  /// These knots can be used to create a new spline that does not use looping
246  /// but has the same shape as this spline. Note that extrapolated knots are
247  /// not included in the result. If you want to include extrapolated knots
248  /// use \c GetKnotsWithLoopsBaked and provide a time interval over which knots
249  /// should be expanded.
250  TS_API
252 
253  /// Return baked knots that will replicate this spline over the given time
254  /// interval without any looping.
255  ///
256  /// Return a \c TsKnotMap containing baked knots that will replicate the
257  /// shape of the spline over the time interval without using any looping.
258  /// Both inner and extrapolation loops are included in the returned knots.
259  ///
260  /// If extrapolation loops are in use, the specified \p interval argument,
261  /// \e must specify a finite time interval since extrapolation looping
262  /// extends to infinity and will generate a theoretically infinite number of
263  /// knots. Attempts to bake an infinite number of knots will emit a coding
264  /// error and return an empty \c TsKnotMap.
265  ///
266  /// \note Knots baked from extrapolation loops may include knots that are
267  /// generated from multiple input knots. Knots at loop boundaries get their
268  /// "pre" values from the end of the loop and their "post" values from the
269  /// beginning.
270 
271  TS_API
273  const GfInterval &interval) const;
274 
275  /// @}
276  /// \name Breakdowns
277  ///
278  /// A Breakdown in animation is a pose between the key poses. Breakdown
279  /// applied to a \c TsSpline will insert a TsKnot between existing knots
280  /// with as little disruption as possible to the overall shape of the
281  /// spline.
282  /// @{
283 
284  /// Add a knot at the specified time. The new knot is defined so that the
285  /// shape of the curve is changed as little as possible. If necessary,
286  /// neighboring knots may also be modified.
287  ///
288  /// There are some situations where a new knot cannot be inserted. For
289  /// example, if there is already a knot at the requested time, or if the
290  /// requested insertion time is in a region of the spline that is looped
291  /// from either extrapolation or inner looping. Use \c CanBreakdown to see
292  /// if a breakdown would succeed.
293  ///
294  /// \return true if a knot was successfully inserted or false if not.
295  TS_API
296  bool Breakdown(
297  TsTime time,
298  GfInterval *affectedIntervalOut = nullptr);
299 
300  /// Test if a knot could be inserted by \c Breakdown at \c time.
301  ///
302  /// \return true if a knot could be successfully inserted by \c Breakdown
303  /// or false if not. If false is returned and \c reason is not \c nullptr
304  /// then a description of the failure will be stored in \c reason. This is
305  /// the same error or warning message that would have been emitted by
306  /// \c Breakdown if it had failed to insert a knot.
307  TS_API
308  bool CanBreakdown(
309  TsTime time,
310  std::string* reason = nullptr);
311 
312  /// @}
313  /// \name Anti-regression
314  ///
315  /// See \ref page_ts_regression for a general introduction to regression and
316  /// anti-regression.
317  ///
318  /// \sa TsAntiRegressionAuthoringSelector
319  /// \sa TsRegressionPreventer
320  /// @{
321 
322  /// Returns the current effective anti-regression authoring mode. This may
323  /// come from the overall default of Keep Ratio; the build-configured
324  /// default defined by \c PXR_TS_DEFAULT_ANTI_REGRESSION_AUTHORING_MODE; or
325  /// a TsAntiRegressionAuthoringSelector.
326  TS_API
328 
329  /// Returns whether this spline has any tangents long enough to cause
330  /// regression; or, if the current authoring mode is Contain, whether this
331  /// spline has any tangents that exceed their segment interval.
332  TS_API
333  bool HasRegressiveTangents() const;
334 
335  /// Shorten any regressive tangents; or, if the current authoring mode is
336  /// Contain, any tangents that exceed their segment interval. Return
337  /// whether anything was changed.
338  TS_API
340 
341  /// @}
342  /// \name Evaluation
343  /// @{
344  ///
345  /// In all of these templated methods, the T parameter may be the value type
346  /// of the spline (double/float/GfHalf), or VtValue.
347 
348  template <typename T>
349  bool Eval(
350  TsTime time,
351  T *valueOut) const;
352 
353  template <typename T>
354  bool EvalPreValue(
355  TsTime time,
356  T *valueOut) const;
357 
358  template <typename T>
359  bool EvalDerivative(
360  TsTime time,
361  T *valueOut) const;
362 
363  template <typename T>
364  bool EvalPreDerivative(
365  TsTime time,
366  T *valueOut) const;
367 
368  template <typename T>
369  bool EvalHeld(
370  TsTime time,
371  T *valueOut) const;
372 
373  template <typename T>
374  bool EvalPreValueHeld(
375  TsTime time,
376  T *valueOut) const;
377 
378  TS_API
379  bool DoSidesDiffer(
380  TsTime time) const;
381 
382  /// \brief Evaluates the value of the TsSpline over the given time interval,
383  /// typically for drawing.
384  ///
385  /// \c Sample creates a piecewise linear approximation of the spline curve.
386  /// When the returned samples are scaled by \e timeScale and \e valueScale
387  /// and linearly interpolated, the reconstructed curve will nowhere have an
388  /// error greater than \e tolerance.
389  ///
390  /// The values of \e timeScale and \e valueScale are typically chosen to
391  /// scale the spline's units to pixels and then \e tolerance represents
392  /// the allowed deviation in pixel space from a theoretical exact answer.
393  ///
394  /// \c timeInterval must not be empty and \c timeScale, \c valueScale, and
395  /// \c tolerance must all be greater than 0.0. If any of these conditions
396  /// are not met, \c Sample returns false and \c *splineSamples is unchanged.
397  /// Otherwise, true is returned and \c splineSamples is populated.
398  template <typename Vertex>
399  bool
401  const GfInterval& timeInterval,
402  double timeScale,
403  double valueScale,
404  double tolerance,
405  TsSplineSamples<Vertex>* splineSamples) const
406  {
407  return _Sample(timeInterval, timeScale, valueScale, tolerance,
408  splineSamples);
409  }
410 
411  /// \overload
412  /// When passed a \c TsSplineSamplesWithSources<Vertex> class, the returned
413  /// information contains a \c TsSplineSampleSource value for each
414  /// polyline. The \c TsSplineSampleSource indicates the source region
415  /// (extrapolation, looping, normal interpolation, etc.) of the spline
416  /// generated that polyline.
417  template <typename Vertex>
418  bool
420  const GfInterval& timeInterval,
421  double timeScale,
422  double valueScale,
423  double tolerance,
424  TsSplineSamplesWithSources<Vertex>* splineSamples) const
425  {
426  return _Sample(timeInterval, timeScale, valueScale, tolerance,
427  splineSamples);
428  }
429 
430  /// @}
431  /// \name Spline comparison
432  /// @{
433 
434  /// \brief Compare two splines.
435  ///
436  /// Returns the time interval over which this spline and \p other have
437  /// differences. \c Diff compares the "segments" of a spline where a segment
438  /// is the span between adjacent knots (or between the end knots and
439  /// infinity). The returned time interval encompases all of the differing
440  /// segments in the splines.
441  ///
442  /// For example, if \c spline1 has knots at times 1, 2, 3, 4, and 5,
443  /// and \c spline2 is a copy of \c spline1 with the value at time 3 changed,
444  /// calling:
445  /// \code
446  /// GfInterval diffInterval = spline1.Diff(spline2);
447  /// \endcode
448  /// Would set \c diffInterval to the half-open interval [2.0 .. 4.0).
449  ///
450  /// Note that this implementation is fairly conservative, in that it will
451  /// never miss any changes but may report differences that do not appear to
452  /// be obviously different to the casual observer.
453  ///
454  /// \c Diff considers interpolated segments with different interpolation
455  /// modes to be different, even if the evaluated numeric values are
456  /// ultimately the same. A linear segment with a slope of 0.0 is considered
457  /// different than a held segment with the same end points. Two linear
458  /// segments with the same end points but different tangents are also
459  /// considered different. Extrapolation on the other hand is always either a
460  /// value-block, a straight ray from an end point to infinity, or some
461  /// repeated loop over the spline's knots. Value-blocks and extrapolated
462  /// rays \e are considered identical if they start from the same end-point
463  /// with the same slope, even if they are generated by different types of
464  /// extrapolation. Extrapolated loops are considered identical if they
465  /// produce the same segments.
466  TS_API
467  GfInterval Diff(const TsSpline& other) const;
468 
469  /// \overload
470  /// \brief Compare two splines in a specific input time interval.
471  ///
472  /// This method is identical to the above method but it limits the reported
473  /// differences to the provided \p compareInterval. If there are no
474  /// differences in the compareInterval, an empty \c GfInterval is returned,
475  /// even if there may be differences outside of \c compareInterval
476  TS_API
477  GfInterval Diff(const TsSpline& other,
478  const GfInterval& compareInterval) const;
479 
480  /// @}
481  /// \name Whole-spline queries
482  /// @{
483 
484  TS_API
485  bool IsEmpty() const;
486 
487  TS_API
488  bool HasValueBlocks() const;
489 
490  /// <b>Not yet implemented.</b>
491  TS_API
492  bool IsVarying() const;
493 
494  /// Convenience for HasInnerLoops() || HasExtrapolatingLoops().
495  TS_API
496  bool HasLoops() const;
497 
498  TS_API
499  bool HasInnerLoops() const;
500 
501  TS_API
502  bool HasExtrapolatingLoops() const;
503 
504  /// <b>Not yet implemented.</b>
505  TS_API
506  bool IsLinear() const;
507 
508  /// <b>Not yet implemented.</b>
509  TS_API
510  bool IsC0Continuous() const;
511 
512  /// <b>Not yet implemented.</b>
513  TS_API
514  bool IsG1Continuous() const;
515 
516  /// <b>Not yet implemented.</b>
517  TS_API
518  bool IsC1Continuous() const;
519 
520  /// <b>Not yet implemented.</b>
521  TS_API
522  bool GetValueRange(
523  const GfInterval &timeSpan,
524  std::pair<VtValue, VtValue> *rangeOut) const;
525 
526  /// <b>Not yet implemented.</b>
527  template <typename T>
528  bool GetValueRange(
529  const GfInterval &timeSpan,
530  std::pair<T, T> *rangeOut) const;
531 
532  /// @}
533  /// \name Within-spline queries
534  /// @{
535 
536  TS_API
537  bool HasValueBlockAtTime(
538  TsTime time) const;
539 
540  /// <b>Not yet implemented.</b>
541  TS_API
542  bool IsSegmentFlat(
543  TsTime startTime) const;
544 
545  /// <b>Not yet implemented.</b>
546  TS_API
547  bool IsSegmentMonotonic(
548  TsTime startTime) const;
549 
550  /// <b>Not yet implemented.</b>
551  TS_API
552  bool IsKnotRedundant(
553  TsTime time,
554  VtValue defaultValue = VtValue()) const;
555 
556  /// @}
557 
558 public:
559  // Hash function. For now this is cheap, and only hashes by data pointer.
560  // If there are two identical but independent splines, they will hash
561  // unequal.
562  template <typename HashState>
563  friend void TfHashAppend(
564  HashState &h,
565  const TsSpline &spline)
566  {
567  h.Append(spline._data.get());
568  }
569 
570 private:
571  friend class TsRegressionPreventer;
572 
573  // Direct access method used by TsRegressionPreventer.
574  void _SetKnotUnchecked(const TsKnot & knot);
575 
576  template <typename SampleHolder>
577  bool _Sample(
578  const GfInterval& timeInterval,
579  double timeScale,
580  double valueScale,
581  double tolerance,
582  SampleHolder* splineSamples) const;
583 
584  // External helpers provide direct data access for Ts implementation.
585  friend Ts_SplineData* Ts_GetSplineData(TsSpline &spline);
586  friend const Ts_SplineData* Ts_GetSplineData(const TsSpline &spline);
587 
588  friend struct Ts_BinaryDataAccess;
589  friend struct Ts_SplineOffsetAccess;
590 
591 private:
592  // Get data to read from. Will be either actual data or default data.
593  TS_API
594  const Ts_SplineData* _GetData() const;
595 
596  // Ensure we have our own independent data, in preparation for writing. If
597  // a value type is passed, and we don't yet have typed data, ensure we have
598  // data of the specified type.
599  void _PrepareForWrite(TfType valueType = TfType());
600 
601  template <typename T>
602  bool _Eval(
603  TsTime time,
604  T *valueOut,
605  Ts_EvalAspect aspect,
606  Ts_EvalLocation location) const;
607 
608  // Update all the tangents based on the tangent algorithms in the knots and
609  // follow that with a call to AdjustRegressiveTangents() to remove any
610  // remaining regressive spline segments. Return true if any changes were
611  // made.
612  TS_API
613  bool _UpdateAllTangents();
614 
615  // Update the tangents of a single knot based on its tangent algorithms and
616  // the regression prevention settings.
617  TS_API
618  bool _UpdateKnotTangents(const size_t knotIndex);
619 
620 private:
621  // Our parameter data. Copy-on-write. Null only if we are in the default
622  // state, with no knots, and all overall parameters set to defaults. To
623  // deal with the possibility of null data, call _GetData for reading, and
624  // _PrepareForWrite before writing.
625  std::shared_ptr<Ts_SplineData> _data;
626 };
627 
628 // TsSpline supports value transforms.
630 
631 /// Output a text representation of a spline to a stream.
632 TS_API
633 std::ostream& operator<<(std::ostream& out, const TsSpline &spline);
634 
635 // XXX: This should not be necessary. All it does is call std::swap. This is
636 // here as a workaround for a downstream library that tries to call swap on
637 // splines, with a "using namespace std" that doesn't appear to work when pxr
638 // namespaces are in use.
639 TS_API
640 void swap(TsSpline &lhs, TsSpline &rhs);
641 
642 // For applying layer offsets.
644 {
645  TS_API
646  static void ApplyOffsetAndScale(
647  TsSpline *spline,
648  const TsTime offset,
649  const double scale);
650 };
651 
652 
653 ////////////////////////////////////////////////////////////////////////////////
654 // TEMPLATE IMPLEMENTATIONS
655 
656 template <typename T>
658 {
659  if constexpr (!Ts_IsSupportedValueType<T>::value)
660  {
661  return false;
662  }
663 
664  return GetValueType() == Ts_GetType<T>();
665 }
666 
667 template <typename T>
668 bool TsSpline::_Eval(
669  const TsTime time,
670  T* const valueOut,
671  const Ts_EvalAspect aspect,
672  const Ts_EvalLocation location) const
673 {
674  const std::optional<double> result =
675  Ts_Eval(_GetData(), time, aspect, location);
676 
677  if (!result)
678  {
679  return false;
680  }
681 
682  *valueOut = T(*result);
683  return true;
684 }
685 
686 // Implement a special case that will ensure the contents of the VtValue output
687 // variable contain a value of the same type (double, float, or GfHalf) as the
688 // spline.
689 template <>
690 TS_API
691 bool TsSpline::_Eval(
692  const TsTime time,
693  VtValue* const valueOut,
694  const Ts_EvalAspect aspect,
695  const Ts_EvalLocation location) const;
696 
697 template <typename T>
698 bool TsSpline::Eval(const TsTime time, T* const valueOut) const
699 {
700  return _Eval(time, valueOut, Ts_EvalValue, Ts_EvalAtTime);
701 }
702 
703 template <typename T>
704 bool TsSpline::EvalPreValue(const TsTime time, T* const valueOut) const
705 {
706  return _Eval(time, valueOut, Ts_EvalValue, Ts_EvalPre);
707 }
708 
709 template <typename T>
710 bool TsSpline::EvalDerivative(const TsTime time, T* const valueOut) const
711 {
712  return _Eval(time, valueOut, Ts_EvalDerivative, Ts_EvalAtTime);
713 }
714 
715 template <typename T>
716 bool TsSpline::EvalPreDerivative(const TsTime time, T* const valueOut) const
717 {
718  return _Eval(time, valueOut, Ts_EvalDerivative, Ts_EvalPre);
719 }
720 
721 template <typename T>
722 bool TsSpline::EvalHeld(const TsTime time, T* const valueOut) const
723 {
724  return _Eval(time, valueOut, Ts_EvalHeldValue, Ts_EvalAtTime);
725 }
726 
727 template <typename T>
728 bool TsSpline::EvalPreValueHeld(const TsTime time, T* const valueOut) const
729 {
730  return _Eval(time, valueOut, Ts_EvalHeldValue, Ts_EvalPre);
731 }
732 
733 
735 
736 #endif
bool Sample(const GfInterval &timeInterval, double timeScale, double valueScale, double tolerance, TsSplineSamplesWithSources< Vertex > *splineSamples) const
Definition: spline.h:419
void swap(ArAssetInfo &lhs, ArAssetInfo &rhs)
Definition: assetInfo.h:57
TS_API TsKnotMap GetKnotsWithLoopsBaked(const GfInterval &interval) const
TsAntiRegressionMode
Definition: types.h:295
TS_API bool IsC0Continuous() const
Not yet implemented.
bool EvalHeld(TsTime time, T *valueOut) const
Evaluates the value of the TsSpline over the given time interval, typically for drawing.
Definition: spline.h:722
VT_VALUE_TYPE_CAN_TRANSFORM(TsSpline)
TsSplineSamplesWithSources<Vertex> is a TsSplineSamples<Vertex> that also includes source information...
Definition: types.h:277
bool Eval(TsTime time, T *valueOut) const
Evaluates the value of the TsSpline over the given time interval, typically for drawing.
Definition: spline.h:698
friend Ts_SplineData * Ts_GetSplineData(TsSpline &spline)
static TS_API bool IsSupportedValueType(TfType valueType)
TS_API void ClearKnots()
TS_API TsExtrapolation GetPreExtrapolation() const
Ts_EvalLocation
Definition: eval.h:29
TS_API bool IsSegmentFlat(TsTime startTime) const
Not yet implemented.
GT_API const UT_StringHolder time
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
TS_API bool IsEmpty() const
Not yet implemented.
TS_API bool ClearRedundantKnots(VtValue defaultValue=VtValue(), const GfInterval &interval=GfInterval::GetFullInterval())
Not yet implemented.
static TS_API TsAntiRegressionMode GetAntiRegressionAuthoringMode()
TS_API TsCurveType GetCurveType() const
TS_API bool HasRegressiveTangents() const
TS_API bool SetKnot(const TsKnot &knot, GfInterval *affectedIntervalOut=nullptr)
TS_API TfType GetValueType() const
TS_API bool DoSidesDiffer(TsTime time) const
Evaluates the value of the TsSpline over the given time interval, typically for drawing.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat< T > spline(const Quat< T > &q0, const Quat< T > &q1, const Quat< T > &q2, const Quat< T > &q3, T t) IMATH_NOEXCEPT
Definition: ImathQuat.h:621
static GfInterval GetFullInterval()
Returns the full interval (-inf, inf).
Definition: interval.h:325
TS_API void SetKnots(const TsKnotMap &knots)
**But if you need a result
Definition: thread.h:622
friend void TfHashAppend(HashState &h, const TsSpline &spline)
Definition: spline.h:563
TS_API bool Breakdown(TsTime time, GfInterval *affectedIntervalOut=nullptr)
TS_API bool IsSegmentMonotonic(TsTime startTime) const
Not yet implemented.
TS_API bool IsC1Continuous() const
Not yet implemented.
GLenum const GLfloat * params
Definition: glcorearb.h:105
TS_API TsExtrapolation GetPostExtrapolation() const
TS_API bool AdjustRegressiveTangents()
TS_API bool GetValueRange(const GfInterval &timeSpan, std::pair< VtValue, VtValue > *rangeOut) const
Not yet implemented.
static TS_API void ApplyOffsetAndScale(TsSpline *spline, const TsTime offset, const double scale)
Ts_EvalAspect
Definition: eval.h:22
TS_API TsKnotMap GetKnots() const
TS_API bool GetKnot(TsTime time, TsKnot *knotOut) const
GA_API const UT_StringHolder scale
TS_API void SetInnerLoopParams(const TsLoopParams &params)
GLintptr offset
Definition: glcorearb.h:665
TS_API void SetCurveType(TsCurveType curveType)
TS_API bool IsG1Continuous() const
Not yet implemented.
TS_API GfInterval Diff(const TsSpline &other) const
Compare two splines.
TS_API void SetPostExtrapolation(const TsExtrapolation &extrap)
TS_API bool BakeInnerLoops()
TsCurveType
Definition: types.h:92
TS_API bool HasExtrapolatingLoops() const
Not yet implemented.
bool IsHolding() const
Definition: spline.h:657
bool EvalDerivative(TsTime time, T *valueOut) const
Evaluates the value of the TsSpline over the given time interval, typically for drawing.
Definition: spline.h:710
TS_API bool HasLoops() const
Convenience for HasInnerLoops() || HasExtrapolatingLoops().
GLint location
Definition: glcorearb.h:805
TS_API bool operator!=(const TsSpline &other) const
TS_API std::optional< double > Ts_Eval(const Ts_SplineData *data, TsTime time, Ts_EvalAspect aspect, Ts_EvalLocation location)
TS_API bool IsTimeValued() const
TS_API TsSpline()
#define TS_API
Definition: api.h:24
TS_API bool HasValueBlockAtTime(TsTime time) const
Not yet implemented.
Definition: knot.h:40
TS_API bool IsKnotRedundant(TsTime time, VtValue defaultValue=VtValue()) const
Not yet implemented.
TS_API bool operator==(const TsSpline &other) const
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
TS_API void RemoveKnot(TsTime time, GfInterval *affectedIntervalOut=nullptr)
TS_API TsLoopParams GetInnerLoopParams() const
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
TS_API bool IsLinear() const
Not yet implemented.
TS_API bool CanSetKnot(const TsKnot &knot, std::string *reasonOut=nullptr) const
Definition: type.h:47
bool EvalPreValue(TsTime time, T *valueOut) const
Evaluates the value of the TsSpline over the given time interval, typically for drawing.
Definition: spline.h:704
TS_API std::ostream & operator<<(std::ostream &out, const TsSpline &spline)
Output a text representation of a spline to a stream.
TS_API bool HasInnerLoops() const
Not yet implemented.
TS_API bool HasValueBlocks() const
Not yet implemented.
TS_API TsKnotMap GetKnotsWithInnerLoopsBaked() const
TS_API bool IsVarying() const
Not yet implemented.
bool EvalPreValueHeld(TsTime time, T *valueOut) const
Evaluates the value of the TsSpline over the given time interval, typically for drawing.
Definition: spline.h:728
TsSplineSamples<Vertex> holds a collection of piecewise linear polylines that approximate a TsSpline...
Definition: types.h:254
TS_API void SetTimeValued(bool timeValued)
bool EvalPreDerivative(TsTime time, T *valueOut) const
Evaluates the value of the TsSpline over the given time interval, typically for drawing.
Definition: spline.h:716
bool Sample(const GfInterval &timeInterval, double timeScale, double valueScale, double tolerance, TsSplineSamples< Vertex > *splineSamples) const
Evaluates the value of the TsSpline over the given time interval, typically for drawing.
Definition: spline.h:400
Definition: value.h:89
TS_API bool CanBreakdown(TsTime time, std::string *reason=nullptr)
TS_API TsSpline & operator=(const TsSpline &other)
TS_API void SetPreExtrapolation(const TsExtrapolation &extrap)