File VolumeSampler.h

namespace OpenVDS
template<typename T>
struct InterpolatedRealType

Public Types

typedef float type
template<>
struct InterpolatedRealType<double>

Public Types

typedef double type
template<>
struct InterpolatedRealType<uint32_t>

Public Types

typedef double type
template<>
struct InterpolatedRealType<uint64_t>

Public Types

typedef double type
template<typename T, InterpolationMethod INTERPMETHOD, bool ISUSENOVALUE>
class VolumeSampler

Public Functions

inline VolumeSampler()
inline VolumeSampler(const int (&anSize)[DataBlockDimensionality_Max], const int (&anPitch)[DataBlockDimensionality_Max], float rangeMin, float rangeMax, float integerScale, float integerOffset, float noValalue, float replacementNoValue)
Parameters:
  • anSize – the (at least 3D) size of the buffer to be sampled

  • anPitch – the (at least 3D) pitch of the buffer to be sampled

  • rangeMin – the value range minimum of the data to be sampled

  • rangemax – the value range maximum of the data to be sampled

  • noValalue – the no value for the data to be sampled

  • replacementNoValue – the value to replace any NoValues with

inline TREAL Sample3D(const T *ptBuffer, FloatVector3 localIndex) const

Sample the given buffer at the the given 3D index

The returned TREAL type is double when T is double, int32, or int64 and float for all other types

Parameters:
  • ptBuffer – pointer to the buffer to be samples

  • localIndex – the local 3D index into the buffer

Returns:

a TREAL sampled using the ::InterpolationType at the given index

inline bool IsHeightValid(T tHeight) const
inline TREAL Sample2D(const T *ptBuffer, FloatVector2 localIndex) const

Sample the given buffer at the the given 2D index

The returned TREAL type is double when T is double, int32, or int64 and float for all other types

Parameters:
  • ptBuffer – pointer to the buffer to be samples

  • localIndex – the local 2D index into the buffer

Returns:

a TREAL sampled using the ::InterpolationType at the given index

Public Static Attributes

static constexpr int DataBlockDimensionality_Max = 4

Private Types

typedef InterpolatedRealType<T>::type TREAL

Private Functions

inline int Clamp(int nIndex, int nSize) const
inline void GetCubicInterpolationWeights(float rT, float (&arWeights)[4]) const
inline TREAL WrapToClosestAngle(TREAL tData, TREAL tFixed) const
inline TREAL WrapToRange(TREAL tData) const

Private Members

int32_t m_sizeX
int32_t m_sizeY
int32_t m_sizeZ
int32_t m_pitchX
int32_t m_pitchY
int32_t m_pitchZ
float m_rangeMin
float m_rangeMax
T m_noValue
float m_replacementNoValue
QuantizedTypesToFloatConverter<T, ISUSENOVALUE> m_quantizedTypesToFloatConverter