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< LinearFieldInterpPtr
 
typedef Data_T value_type
 
- Public Types inherited from FieldInterp< Data_T >
typedef FieldInterp class_type
 
typedef boost::intrusive_ptr< FieldInterpPtr
 
typedef Data_T value_type
 
- Public Types inherited from RefBase
typedef boost::intrusive_ptr< RefBasePtr
 
typedef boost::weak_ptr< RefBaseWeakPtr
 

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.
 
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 char * staticClassName ()
 
static const char * staticClassType ()
 
- Static Public Member Functions inherited from FieldInterp< Data_T >
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
 
- 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

◆ value_type

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

Definition at line 142 of file FieldInterp.h.

◆ Ptr

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

Definition at line 143 of file FieldInterp.h.

◆ class_type

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

Definition at line 147 of file FieldInterp.h.

◆ base

template<class Data_T >
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

◆ staticClassName()

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

Definition at line 150 of file FieldInterp.h.

151 {
152 return "LinearFieldInterp";
153 }

◆ staticClassType()

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

Definition at line 155 of file FieldInterp.h.

156 {
157 return ms_classType.name();
158 }
static TemplatedFieldType< LinearFieldInterp< Data_T > > ms_classType
const char * name()
Definition Traits.h:284

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

◆ sample()

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.

608{
609 // Voxel centers are at .5 coordinates
610 // NOTE: Don't use contToDisc for this, we're looking for sample
611 // point locations, not coordinate shifts.
613
614 // Lower left corner
615 V3i c1(static_cast<int>(floor(p.x)),
616 static_cast<int>(floor(p.y)),
617 static_cast<int>(floor(p.z)));
618 // Upper right corner
619 V3i c2(c1 + V3i(1));
620 // C1 fractions
621 FIELD3D_VEC3_T<double> f1(static_cast<FIELD3D_VEC3_T<double> >(c2) - p);
622 // C2 fraction
623 FIELD3D_VEC3_T<double> f2(static_cast<FIELD3D_VEC3_T<double> >(1.0) - f1);
624
625 // Clamp the indexing coordinates
626 if (true) {
627 const Box3i &dataWindow = data.dataWindow();
628 c1.x = std::max(dataWindow.min.x, std::min(c1.x, dataWindow.max.x));
629 c2.x = std::max(dataWindow.min.x, std::min(c2.x, dataWindow.max.x));
630 c1.y = std::max(dataWindow.min.y, std::min(c1.y, dataWindow.max.y));
631 c2.y = std::max(dataWindow.min.y, std::min(c2.y, dataWindow.max.y));
632 c1.z = std::max(dataWindow.min.z, std::min(c1.z, dataWindow.max.z));
633 c2.z = std::max(dataWindow.min.z, std::min(c2.z, dataWindow.max.z));
634 }
635
636 return static_cast<Data_T>
637 (f1.x * (f1.y * (f1.z * data.value(c1.x, c1.y, c1.z) +
638 f2.z * data.value(c1.x, c1.y, c2.z)) +
639 f2.y * (f1.z * data.value(c1.x, c2.y, c1.z) +
640 f2.z * data.value(c1.x, c2.y, c2.z))) +
641 f2.x * (f1.y * (f1.z * data.value(c2.x, c1.y, c1.z) +
642 f2.z * data.value(c2.x, c1.y, c2.z)) +
643 f2.y * (f1.z * data.value(c2.x, c2.y, c1.z) +
644 f2.z * data.value(c2.x, c2.y, c2.z))));
645
646}
Imath::V3i V3i
Definition SpiMathLib.h:71
#define FIELD3D_VEC3_T
Definition SpiMathLib.h:88
Imath::Box3i Box3i
Definition SpiMathLib.h:77
const Box3i & dataWindow() const
Returns the data window. Any coordinate inside this window is safe to pass to value() in the Field su...
Definition Field.h:253
virtual Data_T value(int i, int j, int k) const =0
Read access to a voxel. The coordinates are in integer voxel space .
FIELD3D_VEC3_T< T > floor(const FIELD3D_VEC3_T< T > &v)
Floor function for Vec3.
Definition CoordSys.h:104

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

Member Data Documentation

◆ DEFINE_FIELD_RTTI_CONCRETE_CLASS

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

Definition at line 148 of file FieldInterp.h.

◆ ms_classType

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 >::staticClassType().


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