OpenVDB 11.0.0
Loading...
Searching...
No Matches
Transform Class Reference

#include <openvdb/math/Transform.h>

Public Types

using Ptr = SharedPtr<Transform>
 
using ConstPtr = SharedPtr<const Transform>
 

Public Member Functions

 Transform ()
 
 Transform (const MapBase::Ptr &)
 
 Transform (const Transform &)
 
 ~Transform ()
 
Ptr copy () const
 
bool isLinear () const
 Return true if the transformation map is exclusively linear/affine.
 
bool isIdentity () const
 Return true if the transform is equivalent to an idenity.
 
Name mapType () const
 Return the transformation map's type-name.
 
void preRotate (double radians, const Axis axis=X_AXIS)
 Update the linear (affine) map by prepending or postfixing the appropriate operation. In the case of a frustum, the pre-operations apply to the linear part of the transform and not the entire transform, while the post-operations are allways applied last.
 
void preTranslate (const Vec3d &)
 
void preScale (const Vec3d &)
 
void preScale (double)
 
void preShear (double shear, Axis axis0, Axis axis1)
 
void preMult (const Mat4d &)
 
void preMult (const Mat3d &)
 
void postRotate (double radians, const Axis axis=X_AXIS)
 
void postTranslate (const Vec3d &)
 
void postScale (const Vec3d &)
 
void postScale (double)
 
void postShear (double shear, Axis axis0, Axis axis1)
 
void postMult (const Mat4d &)
 
void postMult (const Mat3d &)
 
Vec3d voxelSize () const
 Return the size of a voxel using the linear component of the map.
 
Vec3d voxelSize (const Vec3d &xyz) const
 Return the size of a voxel at position (x, y, z).
 
double voxelVolume () const
 Return the voxel volume of the linear component of the map.
 
double voxelVolume (const Vec3d &xyz) const
 Return the voxel volume at position (x, y, z).
 
bool hasUniformScale () const
 Return true if the voxels in world space are uniformly sized cubes.
 
Vec3d indexToWorld (const Vec3d &xyz) const
 Apply this transformation to the given coordinates.
 
Vec3d indexToWorld (const Coord &ijk) const
 
Vec3d worldToIndex (const Vec3d &xyz) const
 
Coord worldToIndexCellCentered (const Vec3d &xyz) const
 
Coord worldToIndexNodeCentered (const Vec3d &xyz) const
 
BBoxd indexToWorld (const CoordBBox &) const
 Apply this transformation to the given index-space bounding box.
 
BBoxd indexToWorld (const BBoxd &) const
 
BBoxd worldToIndex (const BBoxd &) const
 Apply the inverse of this transformation to the given world-space bounding box.
 
CoordBBox worldToIndexCellCentered (const BBoxd &) const
 
CoordBBox worldToIndexNodeCentered (const BBoxd &) const
 
MapBase::ConstPtr baseMap () const
 Return a base pointer to the transformation map.
 
MapBase::Ptr baseMap ()
 
template<typename MapType >
MapType::Ptr map ()
 Return the result of downcasting the base map pointer to a MapType pointer, or return a null pointer if the types are incompatible.
 
template<typename MapType >
MapType::ConstPtr map () const
 
template<typename MapType >
MapType::ConstPtr constMap () const
 
void read (std::istream &)
 Unserialize this transform from the given stream.
 
void write (std::ostream &) const
 Serialize this transform to the given stream.
 
void print (std::ostream &os=std::cout, const std::string &indent="") const
 Print a description of this transform.
 
bool operator== (const Transform &other) const
 
bool operator!= (const Transform &other) const
 

Static Public Member Functions

static Transform::Ptr createLinearTransform (double voxelSize=1.0)
 Create and return a shared pointer to a new transform.
 
static Transform::Ptr createLinearTransform (const Mat4R &)
 
static Transform::Ptr createFrustumTransform (const BBoxd &, double taper, double depth, double voxelSize=1.0)
 

Detailed Description

Member Typedef Documentation

◆ ConstPtr

using ConstPtr = SharedPtr<const Transform>

◆ Ptr

Constructor & Destructor Documentation

◆ Transform() [1/3]

Transform ( )
inline

◆ Transform() [2/3]

Transform ( const MapBase::Ptr & )

◆ Transform() [3/3]

Transform ( const Transform & )

◆ ~Transform()

~Transform ( )
inline

Member Function Documentation

◆ baseMap() [1/2]

MapBase::Ptr baseMap ( )
inline

◆ baseMap() [2/2]

MapBase::ConstPtr baseMap ( ) const
inline

Return a base pointer to the transformation map.

◆ constMap()

template<typename MapType >
MapType::ConstPtr constMap ( ) const
inline

◆ copy()

Ptr copy ( ) const
inline

◆ createFrustumTransform()

static Transform::Ptr createFrustumTransform ( const BBoxd & ,
double taper,
double depth,
double voxelSize = 1.0 )
static

◆ createLinearTransform() [1/2]

static Transform::Ptr createLinearTransform ( const Mat4R & )
static

◆ createLinearTransform() [2/2]

static Transform::Ptr createLinearTransform ( double voxelSize = 1.0)
static

Create and return a shared pointer to a new transform.

◆ hasUniformScale()

bool hasUniformScale ( ) const
inline

Return true if the voxels in world space are uniformly sized cubes.

◆ indexToWorld() [1/4]

BBoxd indexToWorld ( const BBoxd & ) const

◆ indexToWorld() [2/4]

Vec3d indexToWorld ( const Coord & ijk) const
inline

◆ indexToWorld() [3/4]

BBoxd indexToWorld ( const CoordBBox & ) const

Apply this transformation to the given index-space bounding box.

Returns
an axis-aligned world-space bounding box

◆ indexToWorld() [4/4]

Vec3d indexToWorld ( const Vec3d & xyz) const
inline

Apply this transformation to the given coordinates.

◆ isIdentity()

bool isIdentity ( ) const

Return true if the transform is equivalent to an idenity.

◆ isLinear()

bool isLinear ( ) const
inline

Return true if the transformation map is exclusively linear/affine.

◆ map() [1/2]

template<typename MapType >
MapType::Ptr map ( )
inline

Return the result of downcasting the base map pointer to a MapType pointer, or return a null pointer if the types are incompatible.

◆ map() [2/2]

template<typename MapType >
MapType::ConstPtr map ( ) const
inline

◆ mapType()

Name mapType ( ) const
inline

Return the transformation map's type-name.

◆ operator!=()

bool operator!= ( const Transform & other) const
inline

◆ operator==()

bool operator== ( const Transform & other) const

◆ postMult() [1/2]

void postMult ( const Mat3d & )

◆ postMult() [2/2]

void postMult ( const Mat4d & )

◆ postRotate()

void postRotate ( double radians,
const Axis axis = X_AXIS )

◆ postScale() [1/2]

void postScale ( const Vec3d & )

◆ postScale() [2/2]

void postScale ( double )

◆ postShear()

void postShear ( double shear,
Axis axis0,
Axis axis1 )

◆ postTranslate()

void postTranslate ( const Vec3d & )

◆ preMult() [1/2]

void preMult ( const Mat3d & )

◆ preMult() [2/2]

void preMult ( const Mat4d & )

◆ preRotate()

void preRotate ( double radians,
const Axis axis = X_AXIS )

Update the linear (affine) map by prepending or postfixing the appropriate operation. In the case of a frustum, the pre-operations apply to the linear part of the transform and not the entire transform, while the post-operations are allways applied last.

◆ preScale() [1/2]

void preScale ( const Vec3d & )

◆ preScale() [2/2]

void preScale ( double )

◆ preShear()

void preShear ( double shear,
Axis axis0,
Axis axis1 )

◆ preTranslate()

void preTranslate ( const Vec3d & )

◆ print()

void print ( std::ostream & os = std::cout,
const std::string & indent = "" ) const

Print a description of this transform.

Parameters
osa stream to which to write textual information
indenta string with which to prefix each line of text

◆ read()

void read ( std::istream & )

Unserialize this transform from the given stream.

◆ voxelSize() [1/2]

Vec3d voxelSize ( ) const
inline

Return the size of a voxel using the linear component of the map.

◆ voxelSize() [2/2]

Vec3d voxelSize ( const Vec3d & xyz) const
inline

Return the size of a voxel at position (x, y, z).

Note
Maps that have a nonlinear component (e.g., perspective and frustum maps) have position-dependent voxel sizes.

◆ voxelVolume() [1/2]

double voxelVolume ( ) const
inline

Return the voxel volume of the linear component of the map.

◆ voxelVolume() [2/2]

double voxelVolume ( const Vec3d & xyz) const
inline

Return the voxel volume at position (x, y, z).

◆ worldToIndex() [1/2]

BBoxd worldToIndex ( const BBoxd & ) const

Apply the inverse of this transformation to the given world-space bounding box.

Returns
an axis-aligned index-space bounding box

◆ worldToIndex() [2/2]

Vec3d worldToIndex ( const Vec3d & xyz) const
inline

◆ worldToIndexCellCentered() [1/2]

CoordBBox worldToIndexCellCentered ( const BBoxd & ) const

◆ worldToIndexCellCentered() [2/2]

Coord worldToIndexCellCentered ( const Vec3d & xyz) const
inline

◆ worldToIndexNodeCentered() [1/2]

CoordBBox worldToIndexNodeCentered ( const BBoxd & ) const

◆ worldToIndexNodeCentered() [2/2]

Coord worldToIndexNodeCentered ( const Vec3d & xyz) const
inline

◆ write()

void write ( std::ostream & ) const

Serialize this transform to the given stream.