Field3D
LinearFieldInterp< Data_T > Class Template Reference

#include <FieldInterp.h>

Inheritance diagram for LinearFieldInterp< Data_T >:
FieldInterp< Data_T > RefBase

Public Types

typedef LinearFieldInterp class_type
typedef boost::intrusive_ptr
< LinearFieldInterp
Ptr
typedef Data_T value_type
- Public Types inherited from FieldInterp< Data_T >
typedef FieldInterp class_type
typedef boost::intrusive_ptr
< FieldInterp
Ptr
typedef Data_T value_type
- Public Types inherited from RefBase
typedef boost::intrusive_ptr
< RefBase
Ptr

Public Member Functions

virtual Data_T sample (const Field< Data_T > &data, const V3d &vsP) const
- Public Member Functions inherited from FieldInterp< Data_T >
virtual ~FieldInterp ()
- 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.
 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 char * classType ()
static const char * staticClassName ()

Public Attributes

 DEFINE_FIELD_RTTI_CONCRETE_CLASS
- Public Attributes inherited from FieldInterp< Data_T >
 DEFINE_FIELD_RTTI_ABSTRACT_CLASS

Private Types

typedef FieldInterp< Data_T > base
 Convenience typedef for referring to base class.

Static Private Attributes

static TemplatedFieldType
< LinearFieldInterp< Data_T > > 
ms_classType

Detailed Description

template<class Data_T>
class LinearFieldInterp< Data_T >

Definition at line 136 of file FieldInterp.h.

Member Typedef Documentation

template<class Data_T >
typedef Data_T LinearFieldInterp< Data_T >::value_type

Definition at line 142 of file FieldInterp.h.

template<class Data_T >
typedef boost::intrusive_ptr<LinearFieldInterp> LinearFieldInterp< Data_T >::Ptr

Definition at line 143 of file FieldInterp.h.

template<class Data_T >
typedef LinearFieldInterp LinearFieldInterp< Data_T >::class_type

Definition at line 147 of file FieldInterp.h.

template<class Data_T >
typedef FieldInterp<Data_T> LinearFieldInterp< Data_T >::base
private

Convenience typedef for referring to base class.

Definition at line 173 of file FieldInterp.h.

Member Function Documentation

template<class Data_T >
static const char* LinearFieldInterp< Data_T >::staticClassName ( )
inlinestatic

Reimplemented from FieldInterp< Data_T >.

Definition at line 150 of file FieldInterp.h.

{
return "LinearFieldInterp";
}
template<class Data_T >
static const char* LinearFieldInterp< Data_T >::classType ( )
inlinestatic
template<class Data_T >
Data_T LinearFieldInterp< Data_T >::sample ( const Field< Data_T > &  data,
const V3d vsP 
) const
virtual

Implements FieldInterp< Data_T >.

Definition at line 606 of file FieldInterp.h.

References FieldRes::dataWindow(), and Field< Data_T >::value().

{
// Voxel centers are at .5 coordinates
// NOTE: Don't use contToDisc for this, we're looking for sample
// point locations, not coordinate shifts.
FIELD3D_VEC3_T<double> p(vsP - FIELD3D_VEC3_T<double>(0.5));
// Lower left corner
V3i c1(static_cast<int>(floor(p.x)),
static_cast<int>(floor(p.y)),
static_cast<int>(floor(p.z)));
// Upper right corner
V3i c2(c1 + V3i(1));
// C1 fractions
FIELD3D_VEC3_T<double> f1(static_cast<FIELD3D_VEC3_T<double> >(c2) - p);
// C2 fraction
FIELD3D_VEC3_T<double> f2(static_cast<FIELD3D_VEC3_T<double> >(1.0) - f1);
// Clamp the indexing coordinates
if (true) {
const Box3i &dataWindow = data.dataWindow();
c1.x = std::max(dataWindow.min.x, std::min(c1.x, dataWindow.max.x));
c2.x = std::max(dataWindow.min.x, std::min(c2.x, dataWindow.max.x));
c1.y = std::max(dataWindow.min.y, std::min(c1.y, dataWindow.max.y));
c2.y = std::max(dataWindow.min.y, std::min(c2.y, dataWindow.max.y));
c1.z = std::max(dataWindow.min.z, std::min(c1.z, dataWindow.max.z));
c2.z = std::max(dataWindow.min.z, std::min(c2.z, dataWindow.max.z));
}
return static_cast<Data_T>
(f1.x * (f1.y * (f1.z * data.value(c1.x, c1.y, c1.z) +
f2.z * data.value(c1.x, c1.y, c2.z)) +
f2.y * (f1.z * data.value(c1.x, c2.y, c1.z) +
f2.z * data.value(c1.x, c2.y, c2.z))) +
f2.x * (f1.y * (f1.z * data.value(c2.x, c1.y, c1.z) +
f2.z * data.value(c2.x, c1.y, c2.z)) +
f2.y * (f1.z * data.value(c2.x, c2.y, c1.z) +
f2.z * data.value(c2.x, c2.y, c2.z))));
}

Member Data Documentation

template<class Data_T >
LinearFieldInterp< Data_T >::DEFINE_FIELD_RTTI_CONCRETE_CLASS

Definition at line 148 of file FieldInterp.h.

template<class Data_T >
TemplatedFieldType<LinearFieldInterp<Data_T> > LinearFieldInterp< Data_T >::ms_classType
staticprivate

Definition at line 168 of file FieldInterp.h.

Referenced by LinearFieldInterp< Data_T >::classType().


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