HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_AIFCondInterp.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_AIFCondInterp.h ( GA Library, C++)
7  *
8  * COMMENTS: Attribute Interface for Interpolation
9  */
10 
11 #ifndef __GA_AIFCondInterp__
12 #define __GA_AIFCondInterp__
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 
22 class GA_Attribute;
23 class GA_WeightedSum;
24 
25 
26 /// @brief Conditional copy implementation of the GA_AIFInterp interface
27 /// using AIFTuple
28 ///
29 /// The GA_AIFInterp class provides a pure virtual implementation requiring
30 /// developers to implement all specializations of the methods. This class
31 /// provides these specializations using the AIFTuple methods to get/set
32 /// data.
33 ///
34 /// This class performs interpolation by conditional copy. That is, rather
35 /// than blending the values, the values are copied as discrete elements.
36 ///
37 /// @see GA_AIFMath, GA_AIFStdMath, GA_AIFStdInterp
38 ///
39 class GA_API GA_AIFCondInterp : public GA_AIFInterp
40 {
41 public:
43  ~GA_AIFCondInterp() override;
44 
45  /// Return whether this interpolator is a conditional interpolation or
46  /// whether values are actually interpolated.
47  bool isConditionalInterpolation() const override { return true; }
48 
49  /// The weighted sum will copy over the element which has the greatest
50  /// contribution to the sum. The initialization is a no-op, so any
51  /// initialization you need to perform should be done in a sub-class
52  /// implementation.
53  bool startSum(GA_Attribute &d, GA_Offset di,
54  const GA_WeightedSum &sum) const override;
55  bool addSum(GA_Attribute &d, GA_Offset di,
56  const GA_WeightedSum &sum,
57  const GA_Attribute &a, GA_Offset ai) const override;
58  bool addSquare(GA_Attribute &d, GA_Offset di,
59  const GA_WeightedSum &sum,
60  const GA_Attribute &a, GA_Offset ai) const override;
61  bool endSum(GA_Attribute &d, GA_Offset di,
62  const GA_WeightedSum &sum,
63  fpreal scale_factor = 1) const override;
64  bool endSquare(GA_Attribute &d, GA_Offset di,
65  const GA_WeightedSum &sum,
66  fpreal scale_factor = 1) const override;
67 
68  // Specializations of some of the common methods
69  bool lerp(GA_Attribute &d, GA_Offset di,
70  const GA_Attribute &a, GA_Offset ai,
71  const GA_Attribute &b, GA_Offset bi,
72  fpreal t) const override;
73  bool lerp(GA_Attribute &d, const GA_Range &di,
74  const GA_Attribute &a, const GA_Range &ai,
75  const GA_Attribute &b, const GA_Range &bi,
76  fpreal t) const override;
77  bool lerp(GA_Attribute &d, const GA_Range &di,
78  const GA_Attribute &a, const GA_Range &ai,
79  const GA_Attribute &b, const GA_Range &bi,
80  const GA_Attribute &t, const GA_Range &ti)const override;
81 
82  /// Since smooth() blends between floating point values, it is not
83  /// implemented as a conditional copy (returns false). Sub-classes
84  /// may choose to implement this differently.
85  bool smooth(GA_Attribute &d, GA_Offset di,
87  const GA_Attribute &a, GA_Offset ai) const override;
88  bool smooth(GA_Attribute &d, const GA_Range &di,
90  const GA_Attribute &a, const GA_Range &ai)const override;
91 
92  bool fit(GA_Attribute &d, GA_Offset di,
93  const GA_Attribute &a, GA_Offset ai,
94  fpreal omin, fpreal omax,
95  fpreal nmin, fpreal nmax) const override;
96  bool fit(GA_Attribute &d, const GA_Range &di,
97  const GA_Attribute &a, const GA_Range &ai,
98  fpreal omin, fpreal omax,
99  fpreal nmin, fpreal nmax) const override;
100 
101  /// @{
102  /// Methods implemented in GA_AIFInterp
103  GA_AIFINTERP_OPERAND_METHODS(GA_AIFInterp)
104  /// @}
105 };
106 
107 #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 endSquare(GA_Attribute &d, GA_Offset di, const GA_WeightedSum &sum, fpreal scale_factor=1) const =0
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:646
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);
Conditional copy implementation of the GA_AIFInterp interface using AIFTuple.
#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.
bool isConditionalInterpolation() const override