HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_AIFStdInterp.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GA_AIFStdInterp.h ( GA Library, C++)
7  *
8  * COMMENTS: Attribute Interface for Interpolation
9  */
10 
11 #ifndef __GA_AIFStdInterp__
12 #define __GA_AIFStdInterp__
13 
14 #include "GA_API.h"
15 #include "GA_AIFInterp.h"
16 #include "GA_Range.h"
17 #include "GA_Types.h"
18 
19 #include <SYS/SYS_Types.h>
20 
21 class GA_Attribute;
22 class GA_WeightedSum;
23 
24 
25 /// @brief Generic implementation of the GA_AIFInterp interface using AIFTuple
26 ///
27 /// The GA_AIFInterp class provides a pure virtual implementation requiring
28 /// developers to implement all specializations of the methods. This class
29 /// provides these specializations using the AIFTuple methods to get/set
30 /// data.
31 ///
32 /// As a developer, you may want to provide the GA_AIFInterp interface, but
33 /// may not want to have to provide all the specialized methods. You can
34 /// subclass from this interface (rather than GA_AIFInterp directly).
35 ///
36 /// However, <b>be warned</b> that if the GA_AIFInterp iterface changes,
37 /// you may end up missing opportunities for specialization.
38 /// @see GA_AIFMath, GA_AIFStdMath
39 ///
40 class GA_API GA_AIFStdInterp : public GA_AIFInterp
41 {
42 public:
44  ~GA_AIFStdInterp() override;
45 
46  /// Note: Weighted sums can only be performed on a single element, and thus
47  /// don't have a generic GA_AttributeOperand method.
48  /// These methods @b must be implemented for an interpolation interface.
49  bool startSum(GA_Attribute &d, GA_Offset di,
50  const GA_WeightedSum &sum) const override = 0;
51  bool addSum(GA_Attribute &d, GA_Offset di,
52  const GA_WeightedSum &sum,
53  const GA_Attribute &a, GA_Offset ai) const override = 0;
54  bool endSum(GA_Attribute &d, GA_Offset di,
55  const GA_WeightedSum &sum,
56  fpreal scale_factor = 1) const override = 0;
57 
58  // Specializations of some of the common methods
59  bool lerp(GA_Attribute &d, GA_Offset di,
60  const GA_Attribute &a, GA_Offset ai,
61  const GA_Attribute &b, GA_Offset bi,
62  fpreal t) const override;
63  bool lerp(GA_Attribute &d, const GA_Range &di,
64  const GA_Attribute &a, const GA_Range &ai,
65  const GA_Attribute &b, const GA_Range &bi,
66  fpreal t) const override;
67  bool lerp(GA_Attribute &d, const GA_Range &di,
68  const GA_Attribute &a, const GA_Range &ai,
69  const GA_Attribute &b, const GA_Range &bi,
70  const GA_Attribute &t, const GA_Range &ti)const override;
71 
72  bool smooth(GA_Attribute &d, GA_Offset di,
74  const GA_Attribute &a, GA_Offset ai) const override = 0;
75  bool smooth(GA_Attribute &d, const GA_Range &di,
77  const GA_Attribute &a, const GA_Range &ai)const override;
78 
79  bool fit(GA_Attribute &d, GA_Offset di,
80  const GA_Attribute &a, GA_Offset ai,
81  fpreal omin, fpreal omax,
82  fpreal nmin, fpreal nmax) const override = 0;
83  bool fit(GA_Attribute &d, const GA_Range &di,
84  const GA_Attribute &a, const GA_Range &ai,
85  fpreal omin, fpreal omax,
86  fpreal nmin, fpreal nmax) const override = 0;
87 
88  /// @{
89  /// Methods implemented in GA_AIFInterp
90  GA_AIFINTERP_OPERAND_METHODS(GA_AIFInterp)
91  /// @}
92 };
93 
94 #endif
Definition of a geometry attribute.
Definition: GA_Attribute.h:198
virtual bool lerp(GA_AttributeOperand &d, GA_AttributeOperand &a, GA_AttributeOperand &b, GA_AttributeOperand &t) const
d = SYSlerp(a, b, t);
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
Context to keep track of weighted sums.
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
#define GA_API
Definition: GA_API.h:14
virtual bool fit(GA_AttributeOperand &d, GA_AttributeOperand &a, GA_AttributeOperand &omin, GA_AttributeOperand &omax, GA_AttributeOperand &nmin, GA_AttributeOperand &nmax) const
d = SYSfit(a, omin, omax, nmin, nmax);
A range of elements in an index-map.
Definition: GA_Range.h:42
GA_Size GA_Offset
Definition: GA_Types.h:641
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
GLdouble t
Definition: glad.h:2397
virtual bool smooth(GA_AttributeOperand &d, GA_AttributeOperand &min, GA_AttributeOperand &max, GA_AttributeOperand &t) const
d = SYSsmooth(min, max, t);
#define GA_AIFINTERP_OPERAND_METHODS(BASECLASS)
Definition: GA_AIFInterp.h:253
fpreal64 fpreal
Definition: SYS_Types.h:277
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
virtual bool endSum(GA_Attribute &d, GA_Offset di, const GA_WeightedSum &sum, fpreal scale_factor=1) const =0
Attribute Interface class to perform interpolation operations on attributes.
Generic implementation of the GA_AIFInterp interface using AIFTuple.