HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
simplify.h
Go to the documentation of this file.
1 //
2 // Copyright 2023 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 
25 #ifndef PXR_BASE_TS_SIMPLIFY_H
26 #define PXR_BASE_TS_SIMPLIFY_H
27 
28 #include "pxr/pxr.h"
29 #include "pxr/base/ts/api.h"
30 #include "pxr/base/ts/spline.h"
32 
34 
35 /// Remove as many knots as possible from spline without introducing
36 /// error greater than maxErrorFraction, where maxErrorFraction is a
37 /// percentage of the spline's total range (if the spline's value varies
38 /// over a range of x, the largest error allowed will be x*maxErrorFraction).
39 /// Only remove knots in intervals.
40 TS_API
41 void TsSimplifySpline(
43  const GfMultiInterval &intervals,
44  double maxErrorFraction,
45  double extremeMaxErrFract = .001);
46 
47 /// Run TsSimplifySpline() on a vector of splines in parallel. The splines
48 /// in 'splines' are mutated in place. The first two args must have the same
49 /// length, unless the intervals arg is empty, in which case the full frame
50 /// range of each spline is used. The remaining args are as in
51 /// TsSimplifySpline.
52 TS_API
54  const std::vector<TsSpline *> &splines,
55  const std::vector<GfMultiInterval>& intervals,
56  double maxErrorFraction,
57  double extremeMaxErrFract = .001);
58 
59 /// First densely samples the spline within the given intervals
60 /// by adding one knot per frame. Then executes the simplify algorithm
61 /// to remove as many knots as possibe while keeping the error below
62 /// the given maximum.
63 TS_API
64 void TsResampleSpline(
66  const GfMultiInterval &intervals,
67  double maxErrorFraction);
68 
70 
71 #endif // PXR_BASE_TS_SIMPLIFY_H
TS_API void TsResampleSpline(TsSpline *spline, const GfMultiInterval &intervals, double maxErrorFraction)
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:576
TS_API void TsSimplifySplinesInParallel(const std::vector< TsSpline * > &splines, const std::vector< GfMultiInterval > &intervals, double maxErrorFraction, double extremeMaxErrFract=.001)
#define TS_API
Definition: api.h:41
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
PXR_NAMESPACE_OPEN_SCOPE TS_API void TsSimplifySpline(TsSpline *spline, const GfMultiInterval &intervals, double maxErrorFraction, double extremeMaxErrFract=.001)