Field3D
CubicGenericFieldInterp< Field_T > Class Template Reference

#include <FieldInterp.h>

Inheritance diagram for CubicGenericFieldInterp< Field_T >:
RefBase

Public Types

typedef CubicGenericFieldInterp class_type
 
typedef boost::intrusive_ptr< CubicGenericFieldInterpPtr
 
typedef Field_T::value_type value_type
 
- Public Types inherited from RefBase
typedef boost::intrusive_ptr< RefBasePtr
 
typedef boost::weak_ptr< RefBaseWeakPtr
 

Public Member Functions

value_type sample (const Field_T &data, const V3d &vsP) const
 
- Public Member Functions inherited from RefBase
void ref () const
 Used by boost::intrusive_pointer.
 
size_t refcnt ()
 Used by boost::intrusive_pointer.
 
void unref () const
 Used by boost::intrusive_pointer.
 
WeakPtr weakPtr () const
 
 RefBase ()
 
 RefBase (const RefBase &)
 Copy constructor.
 
RefBaseoperator= (const RefBase &)
 Assignment operator.
 
virtual ~RefBase ()
 Destructor.
 
virtual bool checkRTTI (const char *typenameStr)=0
 This function is only implemented by concrete classes and triggers the actual RTTI check through matchRTTI();.
 
bool matchRTTI (const char *typenameStr)
 Performs a check to see if the given typename string matches this class' This needs to be implemented in -all- subclasses, even abstract ones.
 

Static Public Member Functions

static const charstaticClassName ()
 
static const charstaticClassType ()
 
- Static Public Member Functions inherited from RefBase
static const charstaticClassType ()
 

Public Attributes

 DEFINE_FIELD_RTTI_CONCRETE_CLASS
 

Private Types

typedef RefBase base
 Convenience typedef for referring to base class.
 

Static Private Attributes

static TemplatedFieldType< CubicGenericFieldInterp< Field_T > > ms_classType
 

Detailed Description

template<class Field_T>
class CubicGenericFieldInterp< Field_T >

Definition at line 375 of file FieldInterp.h.

Member Typedef Documentation

◆ value_type

template<class Field_T >
typedef Field_T::value_type CubicGenericFieldInterp< Field_T >::value_type

Definition at line 381 of file FieldInterp.h.

◆ Ptr

template<class Field_T >
typedef boost::intrusive_ptr<CubicGenericFieldInterp> CubicGenericFieldInterp< Field_T >::Ptr

Definition at line 382 of file FieldInterp.h.

◆ class_type

template<class Field_T >
typedef CubicGenericFieldInterp CubicGenericFieldInterp< Field_T >::class_type

Definition at line 386 of file FieldInterp.h.

◆ base

template<class Field_T >
typedef RefBase CubicGenericFieldInterp< Field_T >::base
private

Convenience typedef for referring to base class.

Definition at line 413 of file FieldInterp.h.

Member Function Documentation

◆ staticClassName()

template<class Field_T >
static const char * CubicGenericFieldInterp< Field_T >::staticClassName ( )
inlinestatic

Definition at line 389 of file FieldInterp.h.

390 {
391 return "CubicGenericFieldInterp";
392 }

◆ staticClassType()

template<class Field_T >
static const char * CubicGenericFieldInterp< Field_T >::staticClassType ( )
inlinestatic

Definition at line 394 of file FieldInterp.h.

395 {
396 return ms_classType.name();
397 }
static TemplatedFieldType< CubicGenericFieldInterp< Field_T > > ms_classType
const char * name()
Definition Traits.h:284

References CubicGenericFieldInterp< Field_T >::ms_classType, and TemplatedFieldType< Field_T >::name().

◆ sample()

template<class Field_T >
Field_T::value_type CubicGenericFieldInterp< Field_T >::sample ( const Field_T & data,
const V3d & vsP ) const

Definition at line 1083 of file FieldInterp.h.

1085{
1086 typedef typename Field_T::value_type Data_T;
1087
1088 // Pixel centers are at .5 coordinates
1089 // NOTE: Don't use contToDisc for this, we're looking for sample
1090 // point locations, not coordinate shifts.
1091 V3d clampedVsP(std::max(0.5, vsP.x),
1092 std::max(0.5, vsP.y),
1093 std::max(0.5, vsP.z));
1095
1096 const Box3i &dataWindow = data.dataWindow();
1097
1098 // Lower left corner
1099 V3i c(static_cast<int>(floor(p.x)),
1100 static_cast<int>(floor(p.y)),
1101 static_cast<int>(floor(p.z)));
1102
1103 // Fractions
1105
1106 // Clamp the coordinates
1107 int im, jm, km;
1108 im = std::max(dataWindow.min.x, std::min(c.x, dataWindow.max.x));
1109 jm = std::max(dataWindow.min.y, std::min(c.y, dataWindow.max.y));
1110 km = std::max(dataWindow.min.z, std::min(c.z, dataWindow.max.z));
1111 int im_1, jm_1, km_1;
1112 im_1 = std::max(dataWindow.min.x, std::min(im - 1, dataWindow.max.x));
1113 jm_1 = std::max(dataWindow.min.y, std::min(jm - 1, dataWindow.max.y));
1114 km_1 = std::max(dataWindow.min.z, std::min(km - 1, dataWindow.max.z));
1115 int im1, jm1, km1;
1116 im1 = std::max(dataWindow.min.x, std::min(im + 1, dataWindow.max.x));
1117 jm1 = std::max(dataWindow.min.y, std::min(jm + 1, dataWindow.max.y));
1118 km1 = std::max(dataWindow.min.z, std::min(km + 1, dataWindow.max.z));
1119 int im2, jm2, km2;
1120 im2 = std::max(dataWindow.min.x, std::min(im + 2, dataWindow.max.x));
1121 jm2 = std::max(dataWindow.min.y, std::min(jm + 2, dataWindow.max.y));
1122 km2 = std::max(dataWindow.min.z, std::min(km + 2, dataWindow.max.z));
1123
1124 Data_T z11 = monotonicCubicInterpolant(data.fastValue(im_1, jm_1, km_1),
1125 data.fastValue(im_1, jm_1, km),
1126 data.fastValue(im_1, jm_1, km1),
1127 data.fastValue(im_1, jm_1, km2), t.z);
1128 Data_T z12 = monotonicCubicInterpolant(data.fastValue(im_1, jm, km_1),
1129 data.fastValue(im_1, jm, km),
1130 data.fastValue(im_1, jm, km1),
1131 data.fastValue(im_1, jm, km2), t.z);
1132 Data_T z13 = monotonicCubicInterpolant(data.fastValue(im_1, jm1, km_1),
1133 data.fastValue(im_1, jm1, km),
1134 data.fastValue(im_1, jm1, km1),
1135 data.fastValue(im_1, jm1, km2), t.z);
1136 Data_T z14 = monotonicCubicInterpolant(data.fastValue(im_1, jm2, km_1),
1137 data.fastValue(im_1, jm2, km),
1138 data.fastValue(im_1, jm2, km1),
1139 data.fastValue(im_1, jm2, km2), t.z);
1140
1141 Data_T z21 = monotonicCubicInterpolant(data.fastValue(im, jm_1, km_1),
1142 data.fastValue(im, jm_1, km),
1143 data.fastValue(im, jm_1, km1),
1144 data.fastValue(im, jm_1, km2), t.z);
1145 Data_T z22 = monotonicCubicInterpolant(data.fastValue(im, jm, km_1),
1146 data.fastValue(im, jm, km),
1147 data.fastValue(im, jm, km1),
1148 data.fastValue(im, jm, km2), t.z);
1149 Data_T z23 = monotonicCubicInterpolant(data.fastValue(im, jm1, km_1),
1150 data.fastValue(im, jm1, km),
1151 data.fastValue(im, jm1, km1),
1152 data.fastValue(im, jm1, km2), t.z);
1153 Data_T z24 = monotonicCubicInterpolant(data.fastValue(im, jm2, km_1),
1154 data.fastValue(im, jm2, km),
1155 data.fastValue(im, jm2, km1),
1156 data.fastValue(im, jm2, km2), t.z);
1157
1158 Data_T z31 = monotonicCubicInterpolant(data.fastValue(im1, jm_1, km_1),
1159 data.fastValue(im1, jm_1, km),
1160 data.fastValue(im1, jm_1, km1),
1161 data.fastValue(im1, jm_1, km2), t.z);
1162 Data_T z32 = monotonicCubicInterpolant(data.fastValue(im1, jm, km_1),
1163 data.fastValue(im1, jm, km),
1164 data.fastValue(im1, jm, km1),
1165 data.fastValue(im1, jm, km2), t.z);
1166 Data_T z33 = monotonicCubicInterpolant(data.fastValue(im1, jm1, km_1),
1167 data.fastValue(im1, jm1, km),
1168 data.fastValue(im1, jm1, km1),
1169 data.fastValue(im1, jm1, km2), t.z);
1170 Data_T z34 = monotonicCubicInterpolant(data.fastValue(im1, jm2, km_1),
1171 data.fastValue(im1, jm2, km),
1172 data.fastValue(im1, jm2, km1),
1173 data.fastValue(im1, jm2, km2), t.z);
1174
1175 Data_T z41 = monotonicCubicInterpolant(data.fastValue(im2, jm_1, km_1),
1176 data.fastValue(im2, jm_1, km),
1177 data.fastValue(im2, jm_1, km1),
1178 data.fastValue(im2, jm_1, km2), t.z);
1179 Data_T z42 = monotonicCubicInterpolant(data.fastValue(im2, jm, km_1),
1180 data.fastValue(im2, jm, km),
1181 data.fastValue(im2, jm, km1),
1182 data.fastValue(im2, jm, km2), t.z);
1183 Data_T z43 = monotonicCubicInterpolant(data.fastValue(im2, jm1, km_1),
1184 data.fastValue(im2, jm1, km),
1185 data.fastValue(im2, jm1, km1),
1186 data.fastValue(im2, jm1, km2), t.z);
1187 Data_T z44 = monotonicCubicInterpolant(data.fastValue(im2, jm2, km_1),
1188 data.fastValue(im2, jm2, km),
1189 data.fastValue(im2, jm2, km1),
1190 data.fastValue(im2, jm2, km2), t.z);
1191
1192 Data_T y1 = monotonicCubicInterpolant(z11, z12, z13, z14, t.y);
1193 Data_T y2 = monotonicCubicInterpolant(z21, z22, z23, z24, t.y);
1194 Data_T y3 = monotonicCubicInterpolant(z31, z32, z33, z34, t.y);
1195 Data_T y4 = monotonicCubicInterpolant(z41, z42, z43, z44, t.y);
1196
1197 Data_T z0 = monotonicCubicInterpolant(y1, y2, y3, y4, t.x);
1198
1199 return z0;
1200}
Data_T monotonicCubicInterpolant(const Data_T &f1, const Data_T &f2, const Data_T &f3, const Data_T &f4, double t)
Monotonic cubic interpolation References: http://en.wikipedia.org/wiki/Monotone_cubic_interpolation h...
Imath::V3i V3i
Definition SpiMathLib.h:71
Imath::V3d V3d
Definition SpiMathLib.h:74
Imath::Box3i Box3i
Definition SpiMathLib.h:77
#define FIELD3D_MTX_T
Definition StdMathLib.h:99
FIELD3D_VEC3_T< T > floor(const FIELD3D_VEC3_T< T > &v)
Floor function for Vec3.
Definition CoordSys.h:104

References FIELD3D_MTX_T, and monotonicCubicInterpolant().

Member Data Documentation

◆ DEFINE_FIELD_RTTI_CONCRETE_CLASS

template<class Field_T >
CubicGenericFieldInterp< Field_T >::DEFINE_FIELD_RTTI_CONCRETE_CLASS

Definition at line 387 of file FieldInterp.h.

◆ ms_classType

template<class Field_T >
TemplatedFieldType<CubicGenericFieldInterp<Field_T> > CubicGenericFieldInterp< Field_T >::ms_classType
staticprivate

Definition at line 408 of file FieldInterp.h.

Referenced by CubicGenericFieldInterp< Field_T >::staticClassType().


The documentation for this class was generated from the following files: