46 #ifndef _INCLUDED_Field3D_FieldMapping_H_
47 #define _INCLUDED_Field3D_FieldMapping_H_
92 typedef boost::intrusive_ptr<FieldMapping>
Ptr;
101 return "FieldMapping";
165 virtual std::string
className()
const = 0;
169 double tolerance = 0.0)
const = 0;
225 typedef boost::intrusive_ptr<NullFieldMapping>
Ptr;
234 return "NullFieldMapping";
279 double tolerance = 0.0)
const;
323 typedef boost::intrusive_ptr<MatrixFieldMapping>
Ptr;
334 return "MatrixFieldMapping";
385 {
m_wsToVs.multVecMatrix(wsP, vsP); }
392 wsToVs.multVecMatrix(wsP, vsP);
397 {
m_vsToWs.multVecMatrix(vsP, wsP); }
404 vsToWs.multVecMatrix(vsP, wsP);
409 {
m_wsToLs.multVecMatrix(wsP, lsP); }
417 wsToLs.multVecMatrix(wsP, lsP);
422 {
m_lsToWs.multVecMatrix(lsP, wsP); }
429 lsToWs.multVecMatrix(lsP, wsP);
435 {
m_wsToVs.multDirMatrix(wsV, vsV); }
439 {
m_vsToWs.multDirMatrix(vsV, wsV); }
443 {
m_wsToLs.multDirMatrix(wsV, lsV); }
447 {
m_lsToWs.multDirMatrix(lsV, wsV); }
454 double tolerance = 0.0)
const;
543 typedef boost::intrusive_ptr<FrustumFieldMapping>
Ptr;
569 return "FrustumFieldMapping";
665 double tolerance = 0.0)
const;
727 #endif // Include guard
Trivial class, world space is equal to local space, i.e. the field is contained in the unit cube [0...
const MatrixCurve::SampleVec & cameraToWorldSamples() const
Returns a vector of all motion samples for camera to world transform.
#define FIELD3D_NAMESPACE_HEADER_CLOSE
const M44d & voxelToWorld() const
Returns a reference to the voxel to world space transform.
MatrixFieldMapping class_type
virtual V3d wsVoxelSize(int, int, int) const
Returns world-space size of a voxel at the specified coordinate.
virtual void worldToLocal(const V3d &wsP, V3d &lsP) const
Transform from world space position into local space.
Contains typedefs for the commonly used types in Field3D.
V3d m_origin
The integer voxel-space origin of the underlying Field object. Is equal to field.extents.min.
virtual FieldMapping::Ptr clone() const
Returns a pointer to a copy of the mapping, pure virtual so ensure derived classes properly implement...
FloatCurve m_farCurve
Time-varying far plane. Computed from m_lpsToWsCurve.
virtual void worldToVoxel(const V3d &wsP, V3d &vsP) const
Transform from world space position into voxel space.
void clearCurves()
Clears all Curve data members. Used by setTransforms() to prepare for the first sample to be added...
M44d m_vsToWs
Voxel space to world space.
virtual void worldToVoxel(const V3d &wsP, V3d &vsP, float) const
virtual bool isIdentical(FieldMapping::Ptr other, double tolerance=0.0) const
Whether the mapping is identical to another mapping.
virtual void localToWorld(const V3d &lsP, V3d &wsP) const =0
Transform from local space position into world space.
MatrixCurve m_vsToWsCurve
Time-varying voxel to world space transform.
const M44d & localToWorld() const
Returns a reference to the local to world transform.
Contains base class for reference counting with Mutex.
FieldMapping()
Constructor.
virtual void voxelToWorld(const V3d &vsP, V3d &wsP) const
Transform from voxel space position into world space.
void setLocalToWorld(const M44d &lsToWs)
Sets the local to world transform. All other matrices will be updated based on this.
virtual void localToWorld(const V3d &lsP, V3d &wsP) const
Transform from local space position into world space.
virtual void voxelToWorld(const V3d &vsP, V3d &wsP) const
Transform from voxel space position into world space.
virtual void extentsChanged()
Implement this if the subclass needs to update itself when the resolution changes.
virtual V3d wsVoxelSize(int, int, int) const
Returns world-space size of a voxel at the specified coordinate.
void getLocalToVoxelMatrix(M44d &result)
virtual void localToWorld(const V3d &lsP, V3d &wsP) const
Transform from local space position into world space.
Base class for mapping between world-, local- and voxel coordinates.
void setZDistribution(ZDistribution dist)
Sets the z slice distribution.
void voxelToLocal(const V3d &vsP, V3d &lsP) const
Inverse of localToVoxel.
virtual void worldToVoxel(const V3d &wsP, V3d &vsP, float time) const
MatrixCurve m_lsToWsCurve
Time-varying local to world space transform.
virtual void voxelToWorld(const V3d &vsP, V3d &wsP, float time) const
M44d m_lsToWs
Local space to world space.
void worldToVoxelDir(const V3d &wsV, V3d &vsV) const
ZDistribution zDistribution() const
Returns the z slice distribution.
V3d m_res
The integer voxel-space resolution of the underlying Field object. Is equal to field.extents.max - field.extents.min + 1.
const V3d & resolution() const
Returns the resolution.
RefBase base
Convenience typedef for referring to base class.
DEFINE_FIELD_RTTI_CONCRETE_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 Fie...
double farPlane() const
Returns the far plane.
virtual void voxelToWorld(const V3d &vsP, V3d &wsP, float) const
virtual Ptr clone() const =0
Returns a pointer to a copy of the mapping, pure virtual so ensure derived classes properly implement...
virtual void worldToVoxel(const V3d &wsP, V3d &vsP) const
Transform from world space position into voxel space.
virtual std::string className() const
Returns the FieldMapping type name. Used when writing/reading from disk.
void computeVoxelSize()
Updates the local to world transformation matrix.
NullFieldMapping class_type
NullFieldMapping(const Box3i &extents)
boost::intrusive_ptr< FieldMapping > Ptr
static const char * classType()
const FloatCurve::SampleVec & farPlaneSamples() const
Returns a vector of all motion samples for far plane.
virtual void localToWorld(const V3d &lsP, V3d &wsP, float) const
MatrixCurve m_lpsToWsCurve
Time-varying local perspective to world space transform. Computed from m_ssToWsCurve.
virtual V3d wsVoxelSize(int i, int j, int k) const =0
Returns world-space size of a voxel at the specified coordinate.
std::vector< V3d > m_wsVoxelSize
Precomputed world-space voxel size. Calculations may assume orthogonal transformation for efficiency...
virtual void worldToVoxel(const V3d &wsP, V3d &vsP) const =0
Transform from world space position into voxel space.
virtual bool isIdentical(FieldMapping::Ptr other, double tolerance=0.0) const =0
Whether the mapping is identical to another mapping.
FieldMapping base
Convenience typedef for referring to base class.
virtual bool isIdentical(FieldMapping::Ptr other, double tolerance=0.0) const
Whether the mapping is identical to another mapping.
void reset()
Resets the transform. Makes a perspective transform at the origin, looking down the negative Z axis w...
void voxelToWorldDir(const V3d &vsV, V3d &wsV) const
boost::intrusive_ptr< NullFieldMapping > Ptr
Convenience typedef.
static const char * classType()
virtual bool isIdentical(FieldMapping::Ptr other, double tolerance=0.0) const
Whether the mapping is identical to another mapping.
virtual void worldToVoxel(const V3d &wsP, V3d &vsP) const
Transform from world space position into voxel space.
bool m_defaultState
Boolean to tell us if the mapping is in its 'default' state. This is needed because the class has a d...
MatrixCurve m_ssToWsCurve
Time-varying local perspective to world space transform This is not used in calculations, but rather as the public interface to the class.
static const char * classType()
virtual ~FieldMapping()
Destructor.
void localToWorldDir(const V3d &lsV, V3d &wsV) const
const SampleVec & samples() const
Returns a const reference to the samples in the curve.
const MatrixCurve::SampleVec & localToWorldSamples() const
Returns a vector of all motion samples for local to world transform.
Contains the Curve class which is used to interpolate attributes in time.
virtual void extentsChanged()
Implement this if the subclass needs to update itself when the resolution changes.
virtual FieldMapping::Ptr clone() const
Returns a pointer to a copy of the mapping, pure virtual so ensure derived classes properly implement...
DEFINE_FIELD_RTTI_CONCRETE_CLASS
virtual void worldToLocal(const V3d &wsP, V3d &lsP, float time) const
virtual void worldToLocal(const V3d &wsP, V3d &lsP, float) const
virtual void localToWorld(const V3d &lsP, V3d &wsP) const
Transform from local space position into world space.
virtual void worldToLocal(const V3d &wsP, V3d &lsP) const
Transform from world space position into local space.
virtual void localToWorld(const V3d &lsP, V3d &wsP, float time) const
virtual void extentsChanged()
Implement this if the subclass needs to update itself when the resolution changes.
const M44d screenToWorld() const
Returns a reference to the screen to world space transform.
Curve< double > FloatCurve
Time-varying float.
#define DECLARE_FIELD3D_GENERIC_EXCEPTION(name, base_class)
Used to declare a generic but named exception.
FloatCurve m_nearCurve
Time-varying near plane. Computed from m_lpsToWsCurve.
DEFINE_FIELD_RTTI_ABSTRACT_CLASS
const M44d & worldToVoxel() const
Returns a reference to the world to voxel space transform.
FrustumFieldMapping class_type
T linear(const float t) const
Linearly interpolates a value from the curve.
void getLocalToVoxelMatrix(M44d &result)
virtual V3d wsVoxelSize(int i, int j, int k) const
Returns world-space size of a voxel at the specified coordinate.
const MatrixCurve::SampleVec & screenToWorldSamples() const
Returns a vector of all motion samples for screen to world transform.
const V3d & origin() const
Returns the origin.
Represents the mapping of a field by a perspective transform.
void setTransforms(const M44d &ssToWs, const M44d &csToWs)
Sets the screenToWorld and cameraToWorld transforms. All other internal matrices will be updated base...
MatrixCurve m_csToWsCurve
Time-varying camera to world space transform.
DEFINE_FIELD_RTTI_CONCRETE_CLASS
Curve< Imath::M44d > MatrixCurve
Time-varying matrix.
bool m_isTimeVarying
Stores whether the curve has more than one time sample.
void makeIdentity()
Sets the transform to identity. This makes it functionally equivalent to a NullFieldMapping.
ZDistribution
Enumerates the Z slice distribution. .f3d files will store values as an int, so be very careful not t...
virtual void voxelToWorld(const V3d &vsP, V3d &wsP) const
Transform from voxel space position into world space.
FieldMapping base
Convenience typedef for referring to base class.
FieldMapping base
Convenience typedef for referring to base class.
void updateTransform()
Updates the local to world transformation matrix.
void worldToLocalDir(const V3d &wsV, V3d &lsV) const
virtual std::string className() const =0
Returns the FieldMapping type name. Used when writing/reading from disk.
virtual void worldToLocal(const V3d &wsP, V3d &lsP) const =0
Transform from world space position into local space.
std::vector< Sample > SampleVec
ZDistribution m_zDistribution
Slice distribution type.
virtual void voxelToWorld(const V3d &vsP, V3d &wsP) const =0
Transform from voxel space position into world space.
virtual std::string className() const
Returns the FieldMapping type name. Used when writing/reading from disk.
V3d m_wsVoxelSize
Precomputed world-space voxel size. Calculations may assume orthogonal transformation for efficiency...
Contains Exception base class.
Represents the mapping of a field by a matrix transform.
virtual FieldMapping::Ptr clone() const
Returns a pointer to a copy of the mapping, pure virtual so ensure derived classes properly implement...
double nearPlane() const
Returns the near plane.
boost::intrusive_ptr< MatrixFieldMapping > Ptr
Convenience typedef.
const FloatCurve::SampleVec & nearPlaneSamples() const
Returns a vector of all motion samples for near plane.
M44d m_wsToLs
World space to local space.
boost::intrusive_ptr< FrustumFieldMapping > Ptr
Convenience typedef.
virtual void worldToLocal(const V3d &wsP, V3d &lsP) const
Transform from world space position into local space.
M44d m_wsToVs
World space to voxel space.
const M44d cameraToWorld() const
Returns a reference to the camera to world space transform.
Curve< Imath::M44d > MatrixCurve
Time-varying matrix.
virtual std::string className() const
Returns the FieldMapping type name. Used when writing/reading from disk.
void setExtents(const Box3i &extents)
This sets the field extents information to use for defining the local coordinate space.
#define FIELD3D_NAMESPACE_OPEN
static const char * classType()