Loading...
Searching...
No Matches
tsTest_Museum.h
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_TS_TEST_MUSEUM_H
9#define PXR_BASE_TS_TS_TEST_MUSEUM_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/spline.h"
15
16#include <vector>
17#include <string>
18
19PXR_NAMESPACE_OPEN_SCOPE
20
21
22// A collection of museum exhibits. These are spline cases that can be used by
23// tests to exercise various behaviors.
24//
25class TsTest_Museum
26{
27public:
28 enum DataId
29 {
30 // Single-segment ordinary curves.
31 TwoKnotBezier,
32 TwoKnotBezierAutoEase,
33 TwoKnotHermite,
34 TwoKnotLinear,
35
36 // Longer splines.
37 FourKnotBezier,
38 FourKnotHermite,
39
40 // Looping cases.
41 SimpleInnerLoop,
42 InnerLoop2and2,
43 InnerLoopPre,
44 InnerLoopPost,
45 ExtrapLoopRepeat,
46 ExtrapLoopRepeatDualValued,
47 ExtrapLoopRepeatBoundary,
48 ExtrapLoopRepeatDualValuedBoundary,
49 ExtrapLoopReset,
50 ExtrapLoopResetDualValued,
51 ExtrapLoopResetBoundary,
52 ExtrapLoopResetInvalidBoundary,
53 ExtrapLoopOscillate,
54 ExtrapLoopOscillateBoundary,
55 InnerAndExtrapLoops,
56
57 // Tests of several regressive Bezier cases.
58 RegressiveLoop,
59 RegressiveS,
60 RegressiveSStandard,
61 RegressiveSPreOut,
62 RegressiveSPostOut,
63 RegressiveSBothOut,
64 RegressivePreJ,
65 RegressivePostJ,
66 RegressivePreC,
67 RegressivePostC,
68 RegressivePreG,
69 RegressivePostG,
70 RegressivePreFringe,
71 RegressivePostFringe,
72
73 // Bold case: escaped tangents, but not regressive.
74 BoldS,
75
76 // Edge case: cusp. Valid but just barely; undefined tangent.
77 Cusp,
78
79 // Edge case: vertical tangent in center. Also a less extreme variant.
80 CenterVertical,
81 NearCenterVertical,
82
83 // A case that hit an old bug. A particular case of a single vertical.
84 VerticalTorture,
85
86 // Edge case: 4/3 + 1/3 tangents. Vertical at 24/27.
87 // Also the inverse.
88 FourThirdOneThird,
89 OneThirdFourThird,
90
91 // Edge cases: single verticals at start and end.
92 StartVert,
93 EndVert,
94
95 // Fringe vertical between FourThirdOneThird and EndVert.
96 FringeVert,
97
98 // N-shape, with near-vertical tangents.
99 MarginalN,
100
101 // Both tangents zero-length.
102 ZeroTans,
103
104 // Exercise many features of the object model.
105 ComplexParams
106 };
107
108 // Get a case by ID.
109 TS_API
110 static TsSpline GetSpline(
111 DataId id,
112 const TfType valueType = Ts_GetType<double>());
113
114 // Get all case names.
115 TS_API
116 static std::vector<std::string> GetAllNames();
117
118 // Get a case by name.
119 TS_API
120 static TsSpline GetSplineByName(
121 const std::string &name,
122 const TfType valueType = Ts_GetType<double>());
123
124private:
125 static Ts_TypedSplineData<double> _GetData(DataId id);
126
127 static TsSpline _SplineDataToSpline(
128 const Ts_TypedSplineData<double>& data,
129 const TfType valueType);
130};
131
132
133PXR_NAMESPACE_CLOSE_SCOPE
134
135
136#endif
TfType represents a dynamic runtime type.
Definition type.h:48
A mathematical description of a curved function from time to value.
Definition spline.h:60