Field3D
|
Base class for mapping between world-, local- and voxel coordinates. More...
#include <FieldMapping.h>
Public Types | |
typedef boost::intrusive_ptr < FieldMapping > | Ptr |
typedef boost::intrusive_ptr < FieldMapping > | Ptr |
Public Member Functions | |
const V3d & | origin () const |
Returns the origin. | |
const V3d & | origin () const |
Returns the origin. | |
const V3d & | resolution () const |
Returns the resolution. | |
const V3d & | resolution () const |
Returns the resolution. | |
void | setExtents (const Box3i &extents) |
This sets the field extents information to use for defining the local coordinate space. | |
void | setExtents (const Box3i &extents) |
This sets the field extents information to use for defining the local coordinate space. | |
Constructors & destructor | |
FieldMapping () | |
Constructor. | |
FieldMapping (const Box3i &extents) | |
Construct with known extents. | |
virtual | ~FieldMapping () |
Destructor. | |
FieldMapping () | |
Constructor. | |
FieldMapping (const Box3i &extents) | |
Construct with known extents. | |
virtual | ~FieldMapping () |
Destructor. | |
To be implemented by subclasses | |
virtual Ptr | clone () const =0 |
Returns a pointer to a copy of the mapping, pure virtual so ensure derived classes properly implement it. | |
virtual void | worldToVoxel (const V3d &wsP, V3d &vsP) const =0 |
Transform from world space position into voxel space. | |
virtual void | worldToVoxel (const V3d &wsP, V3d &vsP, float time) const =0 |
virtual void | voxelToWorld (const V3d &vsP, V3d &wsP) const =0 |
Transform from voxel space position into world space. | |
virtual void | worldToLocal (const V3d &wsP, V3d &lsP) const =0 |
Transform from world space position into local space. | |
virtual void | worldToLocal (const V3d &wsP, V3d &lsP, float time) const =0 |
virtual void | localToWorld (const V3d &lsP, V3d &wsP) const =0 |
Transform from local space position into world space. | |
virtual void | voxelToWorld (std::vector< V3d >::const_iterator vsP, std::vector< V3d >::const_iterator end, std::vector< V3d >::iterator wsP) const =0 |
Transforms multiple positions at once. Mainly used to avoid the overhead of virtual calls when transforming large quantities of points. | |
virtual void | worldToVoxel (std::vector< V3d >::const_iterator wsP, std::vector< V3d >::const_iterator end, std::vector< V3d >::iterator vsP) const =0 |
virtual void | worldToLocal (std::vector< V3d >::const_iterator wsP, std::vector< V3d >::const_iterator end, std::vector< V3d >::iterator lsP) const =0 |
virtual V3d | wsVoxelSize (int i, int j, int k) const =0 |
Returns world-space size of a voxel at the specified coordinate. | |
virtual void | extentsChanged () |
Implement this if the subclass needs to update itself when the resolution changes. | |
virtual std::string | className () const =0 |
Returns the FieldMapping type name. Used when writing/reading from disk. | |
virtual bool | isIdentical (FieldMapping::Ptr other, double tolerance=0.0) const =0 |
Whether the mapping is identical to another mapping. | |
virtual Ptr | clone () const =0 |
Returns a pointer to a copy of the mapping, pure virtual so ensure derived classes properly implement it. | |
virtual void | worldToVoxel (const V3d &wsP, V3d &vsP) const =0 |
Transform from world space position into voxel space. | |
virtual void | worldToVoxel (const V3d &wsP, V3d &vsP, float time) const =0 |
virtual void | voxelToWorld (const V3d &vsP, V3d &wsP) const =0 |
Transform from voxel space position into world space. | |
virtual void | worldToLocal (const V3d &wsP, V3d &lsP) const =0 |
Transform from world space position into local space. | |
virtual void | worldToLocal (const V3d &wsP, V3d &lsP, float time) const =0 |
virtual void | localToWorld (const V3d &lsP, V3d &wsP) const =0 |
Transform from local space position into world space. | |
virtual void | voxelToWorld (std::vector< V3d >::const_iterator vsP, std::vector< V3d >::const_iterator end, std::vector< V3d >::iterator wsP) const =0 |
Transforms multiple positions at once. Mainly used to avoid the overhead of virtual calls when transforming large quantities of points. | |
virtual void | worldToVoxel (std::vector< V3d >::const_iterator wsP, std::vector< V3d >::const_iterator end, std::vector< V3d >::iterator vsP) const =0 |
virtual void | worldToLocal (std::vector< V3d >::const_iterator wsP, std::vector< V3d >::const_iterator end, std::vector< V3d >::iterator lsP) const =0 |
virtual V3d | wsVoxelSize (int i, int j, int k) const =0 |
Returns world-space size of a voxel at the specified coordinate. | |
virtual void | extentsChanged () |
Implement this if the subclass needs to update itself when the resolution changes. | |
virtual std::string | className () const =0 |
Returns the FieldMapping type name. Used when writing/reading from disk. | |
virtual bool | isIdentical (FieldMapping::Ptr other, double tolerance=0.0) const =0 |
Whether the mapping is identical to another mapping. | |
Transforms implemented in this class | |
void | localToVoxel (const V3d &lsP, V3d &vsP) const |
Transform from local space to voxel space. This is just a multiplication by the resolution of the Field that we're mapping. | |
void | localToVoxel (const V3d &lsP, V3d &vsP, float time) const |
void | localToVoxel (std::vector< V3d >::const_iterator lsP, std::vector< V3d >::const_iterator end, std::vector< V3d >::iterator vsP) const |
void | voxelToLocal (const V3d &vsP, V3d &lsP) const |
Inverse of localToVoxel. | |
void | localToVoxel (const V3d &lsP, V3d &vsP) const |
Transform from local space to voxel space. This is just a multiplication by the resolution of the Field that we're mapping. | |
void | localToVoxel (const V3d &lsP, V3d &vsP, float time) const |
void | localToVoxel (std::vector< V3d >::const_iterator lsP, std::vector< V3d >::const_iterator end, std::vector< V3d >::iterator vsP) const |
void | voxelToLocal (const V3d &vsP, V3d &lsP) const |
Inverse of localToVoxel. | |
Protected Attributes | |
V3d | m_origin |
The integer voxel-space origin of the underlying Field object. Is equal to field.extents.min. | |
V3d | m_res |
The integer voxel-space resolution of the underlying Field object. Is equal to field.extents.max - field.extents.min + 1. |
Base class for mapping between world-, local- and voxel coordinates.
Refer to using_mappings for examples of how to use this in your code.
Local coordinates (ls) are defined as [0,1] over the FieldData object's -extents- (not data window). Thus, if the extents.min isn't at origin, the coordinate system stays the same as if it was. Voxel coordinates (vs) are defined as [0,size-1] over the FieldData object's -extents- (not data window).
Definition at line 82 of file FieldMapping.h.
typedef boost::intrusive_ptr<FieldMapping> FieldMapping::Ptr |
Reimplemented from RefBase.
Reimplemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
Definition at line 88 of file FieldMapping.h.
typedef boost::intrusive_ptr<FieldMapping> FieldMapping::Ptr |
Reimplemented from RefBase.
Reimplemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
Definition at line 88 of file FieldMapping.h.
FieldMapping::FieldMapping | ( | ) |
FieldMapping::FieldMapping | ( | const Box3i & | extents | ) |
Construct with known extents.
Definition at line 89 of file FieldMapping.cpp.
References setExtents().
: RefBase() { setExtents(extents); }
FieldMapping::~FieldMapping | ( | ) | [virtual] |
FieldMapping::FieldMapping | ( | ) |
Constructor.
FieldMapping::FieldMapping | ( | const Box3i & | extents | ) |
Construct with known extents.
virtual FieldMapping::~FieldMapping | ( | ) | [virtual] |
Destructor.
void FieldMapping::setExtents | ( | const Box3i & | extents | ) |
This sets the field extents information to use for defining the local coordinate space.
Definition at line 104 of file FieldMapping.cpp.
References extentsChanged(), m_origin, and m_res.
Referenced by FieldMapping().
{ m_origin = extents.min; m_res = extents.max - extents.min + V3i(1); extentsChanged(); }
const V3d& FieldMapping::origin | ( | ) | const [inline] |
Returns the origin.
Definition at line 114 of file FieldMapping.h.
References m_origin.
{ return m_origin; }
const V3d& FieldMapping::resolution | ( | ) | const [inline] |
Returns the resolution.
Definition at line 117 of file FieldMapping.h.
References m_res.
{ return m_res; }
virtual Ptr FieldMapping::clone | ( | ) | const [pure virtual] |
Returns a pointer to a copy of the mapping, pure virtual so ensure derived classes properly implement it.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
Transform from world space position into voxel space.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual void FieldMapping::worldToVoxel | ( | const V3d & | wsP, |
V3d & | vsP, | ||
float | time | ||
) | const [pure virtual] |
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
Transform from voxel space position into world space.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
Transform from world space position into local space.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual void FieldMapping::worldToLocal | ( | const V3d & | wsP, |
V3d & | lsP, | ||
float | time | ||
) | const [pure virtual] |
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
Transform from local space position into world space.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual void FieldMapping::voxelToWorld | ( | std::vector< V3d >::const_iterator | vsP, |
std::vector< V3d >::const_iterator | end, | ||
std::vector< V3d >::iterator | wsP | ||
) | const [pure virtual] |
Transforms multiple positions at once. Mainly used to avoid the overhead of virtual calls when transforming large quantities of points.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual void FieldMapping::worldToVoxel | ( | std::vector< V3d >::const_iterator | wsP, |
std::vector< V3d >::const_iterator | end, | ||
std::vector< V3d >::iterator | vsP | ||
) | const [pure virtual] |
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual void FieldMapping::worldToLocal | ( | std::vector< V3d >::const_iterator | wsP, |
std::vector< V3d >::const_iterator | end, | ||
std::vector< V3d >::iterator | lsP | ||
) | const [pure virtual] |
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual V3d FieldMapping::wsVoxelSize | ( | int | i, |
int | j, | ||
int | k | ||
) | const [pure virtual] |
Returns world-space size of a voxel at the specified coordinate.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual void FieldMapping::extentsChanged | ( | ) | [inline, virtual] |
Implement this if the subclass needs to update itself when the resolution changes.
Reimplemented in MatrixFieldMapping, and MatrixFieldMapping.
Definition at line 160 of file FieldMapping.h.
Referenced by setExtents().
{ /* Empty */ }
virtual std::string FieldMapping::className | ( | ) | const [pure virtual] |
Returns the FieldMapping type name. Used when writing/reading from disk.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual bool FieldMapping::isIdentical | ( | FieldMapping::Ptr | other, |
double | tolerance = 0.0 |
||
) | const [pure virtual] |
Whether the mapping is identical to another mapping.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
Transform from local space to voxel space. This is just a multiplication by the resolution of the Field that we're mapping.
Definition at line 113 of file FieldMapping.cpp.
References m_origin, and m_res.
Referenced by NullFieldMapping::worldToVoxel().
Inverse of localToVoxel.
Definition at line 138 of file FieldMapping.cpp.
References FIELD3D_LERPFACTOR, m_origin, and m_res.
Referenced by NullFieldMapping::voxelToWorld().
{ lsP.x = FIELD3D_LERPFACTOR(vsP.x, m_origin.x, m_origin.x + m_res.x); lsP.y = FIELD3D_LERPFACTOR(vsP.y, m_origin.y, m_origin.y + m_res.y); lsP.z = FIELD3D_LERPFACTOR(vsP.z, m_origin.z, m_origin.z + m_res.z); }
void FieldMapping::setExtents | ( | const Box3i & | extents | ) |
This sets the field extents information to use for defining the local coordinate space.
const V3d& FieldMapping::origin | ( | ) | const [inline] |
Returns the origin.
Definition at line 114 of file FieldMapping.h.
References m_origin.
{ return m_origin; }
const V3d& FieldMapping::resolution | ( | ) | const [inline] |
Returns the resolution.
Definition at line 117 of file FieldMapping.h.
References m_res.
{ return m_res; }
virtual Ptr FieldMapping::clone | ( | ) | const [pure virtual] |
Returns a pointer to a copy of the mapping, pure virtual so ensure derived classes properly implement it.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
Transform from world space position into voxel space.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual void FieldMapping::worldToVoxel | ( | const V3d & | wsP, |
V3d & | vsP, | ||
float | time | ||
) | const [pure virtual] |
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
Transform from voxel space position into world space.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
Transform from world space position into local space.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual void FieldMapping::worldToLocal | ( | const V3d & | wsP, |
V3d & | lsP, | ||
float | time | ||
) | const [pure virtual] |
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
Transform from local space position into world space.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual void FieldMapping::voxelToWorld | ( | std::vector< V3d >::const_iterator | vsP, |
std::vector< V3d >::const_iterator | end, | ||
std::vector< V3d >::iterator | wsP | ||
) | const [pure virtual] |
Transforms multiple positions at once. Mainly used to avoid the overhead of virtual calls when transforming large quantities of points.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual void FieldMapping::worldToVoxel | ( | std::vector< V3d >::const_iterator | wsP, |
std::vector< V3d >::const_iterator | end, | ||
std::vector< V3d >::iterator | vsP | ||
) | const [pure virtual] |
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual void FieldMapping::worldToLocal | ( | std::vector< V3d >::const_iterator | wsP, |
std::vector< V3d >::const_iterator | end, | ||
std::vector< V3d >::iterator | lsP | ||
) | const [pure virtual] |
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual V3d FieldMapping::wsVoxelSize | ( | int | i, |
int | j, | ||
int | k | ||
) | const [pure virtual] |
Returns world-space size of a voxel at the specified coordinate.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual void FieldMapping::extentsChanged | ( | ) | [inline, virtual] |
Implement this if the subclass needs to update itself when the resolution changes.
Reimplemented in MatrixFieldMapping, and MatrixFieldMapping.
Definition at line 160 of file FieldMapping.h.
{ /* Empty */ }
virtual std::string FieldMapping::className | ( | ) | const [pure virtual] |
Returns the FieldMapping type name. Used when writing/reading from disk.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
virtual bool FieldMapping::isIdentical | ( | FieldMapping::Ptr | other, |
double | tolerance = 0.0 |
||
) | const [pure virtual] |
Whether the mapping is identical to another mapping.
Implemented in NullFieldMapping, MatrixFieldMapping, NullFieldMapping, and MatrixFieldMapping.
Transform from local space to voxel space. This is just a multiplication by the resolution of the Field that we're mapping.
void FieldMapping::localToVoxel | ( | std::vector< V3d >::const_iterator | lsP, |
std::vector< V3d >::const_iterator | end, | ||
std::vector< V3d >::iterator | vsP | ||
) | const |
V3d FieldMapping::m_origin [protected] |
The integer voxel-space origin of the underlying Field object. Is equal to field.extents.min.
Definition at line 192 of file FieldMapping.h.
Referenced by MatrixFieldMapping::getLocalToVoxelMatrix(), localToVoxel(), origin(), setExtents(), and voxelToLocal().
V3d FieldMapping::m_res [protected] |
The integer voxel-space resolution of the underlying Field object. Is equal to field.extents.max - field.extents.min + 1.
Definition at line 195 of file FieldMapping.h.
Referenced by MatrixFieldMapping::getLocalToVoxelMatrix(), localToVoxel(), resolution(), setExtents(), voxelToLocal(), and NullFieldMapping::wsVoxelSize().