Field3D
LinearGenericFieldInterp< Field_T > Class Template Reference

#include <FieldInterp.h>

Inheritance diagram for LinearGenericFieldInterp< Field_T >:
RefBase

List of all members.

Public Types

typedef LinearGenericFieldInterp class_type
typedef boost::intrusive_ptr
< LinearGenericFieldInterp
Ptr
typedef Field_T::value_type value_type
- Public Types inherited from RefBase

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.
 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 ()
- Static Public Member Functions inherited from RefBase

Public Attributes

 DEFINE_FIELD_RTTI_CONCRETE_CLASS

Private Types

typedef RefBase base
 Convenience typedef for referring to base class.

Static Private Attributes

static TemplatedFieldType
< LinearGenericFieldInterp
< Field_T > > 
ms_classType

Detailed Description

template<class Field_T>
class LinearGenericFieldInterp< Field_T >

Definition at line 253 of file FieldInterp.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

Reimplemented from RefBase.

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.

{
return "LinearGenericFieldInterp";
}
template<class Field_T >
static const char* LinearGenericFieldInterp< Field_T >::classType ( )
inlinestatic

Reimplemented from RefBase.

Definition at line 272 of file FieldInterp.h.

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

{
return ms_classType.name();
}
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.

{
typedef typename Field_T::value_type Data_T;
// Pixel 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);
const Box3i &dataWindow = data.dataWindow();
// Clamp the coordinates
c1.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x, c1.x));
c1.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y, c1.y));
c1.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z, c1.z));
c2.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x, c2.x));
c2.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y, c2.y));
c2.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z, c2.z));
return static_cast<Data_T>
(f1.x * (f1.y * (f1.z * data.fastValue(c1.x, c1.y, c1.z) +
f2.z * data.fastValue(c1.x, c1.y, c2.z)) +
f2.y * (f1.z * data.fastValue(c1.x, c2.y, c1.z) +
f2.z * data.fastValue(c1.x, c2.y, c2.z))) +
f2.x * (f1.y * (f1.z * data.fastValue(c2.x, c1.y, c1.z) +
f2.z * data.fastValue(c2.x, c1.y, c2.z)) +
f2.y * (f1.z * data.fastValue(c2.x, c2.y, c1.z) +
f2.z * data.fastValue(c2.x, c2.y, c2.z))));
}

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.

Referenced by LinearGenericFieldInterp< Field_T >::classType().


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