Field3D
LinearGenericFieldInterp< Field_T > Class Template Reference

#include <DenseField.h>

Inheritance diagram for LinearGenericFieldInterp< Field_T >:
RefBase

Public Types

typedef LinearGenericFieldInterp class_type
 
typedef boost::intrusive_ptr< LinearGenericFieldInterpPtr
 
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. More...
 
size_t refcnt ()
 Used by boost::intrusive_pointer. More...
 
void unref () const
 Used by boost::intrusive_pointer. More...
 
WeakPtr weakPtr () const
 
 RefBase ()
 
 RefBase (const RefBase &)
 Copy constructor. More...
 
RefBaseoperator= (const RefBase &)
 Assignment operator. More...
 
virtual ~RefBase ()
 Destructor. More...
 
virtual bool checkRTTI (const char *typenameStr)=0
 This function is only implemented by concrete classes and triggers the actual RTTI check through matchRTTI();. More...
 
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. More...
 

Static Public Member Functions

static const char * staticClassName ()
 
static const char * staticClassType ()
 
- Static Public Member Functions inherited from RefBase
static const char * staticClassType ()
 

Public Attributes

 DEFINE_FIELD_RTTI_CONCRETE_CLASS
 

Private Types

typedef RefBase base
 Convenience typedef for referring to base class. More...
 

Static Private Attributes

static TemplatedFieldType< LinearGenericFieldInterp< Field_T > > ms_classType
 

Detailed Description

template<class Field_T>
class LinearGenericFieldInterp< Field_T >

Definition at line 64 of file DenseField.h.

Member Typedef Documentation

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

Definition at line 259 of file FieldInterp.h.

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

Definition at line 260 of file FieldInterp.h.

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

Definition at line 264 of file FieldInterp.h.

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

Convenience typedef for referring to base class.

Definition at line 290 of file FieldInterp.h.

Member Function Documentation

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

Definition at line 267 of file FieldInterp.h.

268  {
269  return "LinearGenericFieldInterp";
270  }
template<class Field_T >
static const char* LinearGenericFieldInterp< Field_T >::staticClassType ( )
inlinestatic

Definition at line 272 of file FieldInterp.h.

References FieldInterp< Data_T >::ms_classType, TemplatedFieldType< Field_T >::name(), and FieldInterp< Data_T >::sample().

273  {
274  return ms_classType.name();
275  }
static TemplatedFieldType< LinearGenericFieldInterp< Field_T > > ms_classType
Definition: FieldInterp.h:285
const char * name()
Definition: Traits.h:118
template<class Field_T >
Field_T::value_type LinearGenericFieldInterp< Field_T >::sample ( const Field_T &  data,
const V3d vsP 
) const

Definition at line 773 of file FieldInterp.h.

References detail::floor().

775 {
776  typedef typename Field_T::value_type Data_T;
777 
778  // Pixel centers are at .5 coordinates
779  // NOTE: Don't use contToDisc for this, we're looking for sample
780  // point locations, not coordinate shifts.
781  FIELD3D_VEC3_T<double> p(vsP - FIELD3D_VEC3_T<double>(0.5));
782 
783  // Lower left corner
784  V3i c1(static_cast<int>(floor(p.x)),
785  static_cast<int>(floor(p.y)),
786  static_cast<int>(floor(p.z)));
787  // Upper right corner
788  V3i c2(c1 + V3i(1));
789  // C1 fractions
790  FIELD3D_VEC3_T<double> f1(static_cast<FIELD3D_VEC3_T<double> >(c2) - p);
791  // C2 fraction
792  FIELD3D_VEC3_T<double> f2(static_cast<FIELD3D_VEC3_T<double> >(1.0) - f1);
793 
794  const Box3i &dataWindow = data.dataWindow();
795 
796  // Clamp the coordinates
797  c1.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x, c1.x));
798  c1.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y, c1.y));
799  c1.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z, c1.z));
800  c2.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x, c2.x));
801  c2.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y, c2.y));
802  c2.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z, c2.z));
803 
804  return static_cast<Data_T>
805  (f1.x * (f1.y * (f1.z * data.fastValue(c1.x, c1.y, c1.z) +
806  f2.z * data.fastValue(c1.x, c1.y, c2.z)) +
807  f2.y * (f1.z * data.fastValue(c1.x, c2.y, c1.z) +
808  f2.z * data.fastValue(c1.x, c2.y, c2.z))) +
809  f2.x * (f1.y * (f1.z * data.fastValue(c2.x, c1.y, c1.z) +
810  f2.z * data.fastValue(c2.x, c1.y, c2.z)) +
811  f2.y * (f1.z * data.fastValue(c2.x, c2.y, c1.z) +
812  f2.z * data.fastValue(c2.x, c2.y, c2.z))));
813 }
Imath::Box3i Box3i
Definition: SpiMathLib.h:77
Imath::V3i V3i
Definition: SpiMathLib.h:71
FIELD3D_VEC3_T< T > floor(const FIELD3D_VEC3_T< T > &v)
Floor function for Vec3.
Definition: CoordSys.h:95

Member Data Documentation

template<class Field_T >
LinearGenericFieldInterp< Field_T >::DEFINE_FIELD_RTTI_CONCRETE_CLASS

Definition at line 265 of file FieldInterp.h.

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

Definition at line 285 of file FieldInterp.h.


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