library of assembled shared sources |
http://lass.cocamware.com |
#include <transformation_3d.h>
Data Structures | |
struct | Rebind |
Public Types | |
enum | { dimension = TPoint::dimension } |
typedef Transformation3D< T > | TSelf |
typedef Point3D< T > | TPoint |
typedef TPoint::TVector | TVector |
typedef util::CallTraits< T > ::TValue | TValue |
typedef util::CallTraits< T > ::TParam | TParam |
typedef util::CallTraits< T > ::TReference | TReference |
typedef util::CallTraits< T > ::TConstReference | TConstReference |
typedef num::NumTraits< T > | TNumTraits |
typedef size_t | TSize |
Public Member Functions | |
Transformation3D () | |
construct an identity transformation. | |
Transformation3D (const TPoint &origin, const TVector &baseX, const TVector &baseY, const TVector &baseZ) | |
construct an matrix from an origin and three base vectors | |
template<typename InputIterator > | |
Transformation3D (InputIterator first, InputIterator last) | |
construct a transformation from a 4x4 tranformation matrix. | |
const TSelf | inverse () const |
return the inverse transformation. | |
const TValue * | matrix () const |
Return pointer to row major matrix representation of transformation. | |
void | swap (TSelf &other) |
Static Public Member Functions | |
static const TSelf | identity () |
make a 3D identity transformation | |
static const TSelf | translation (const Vector3D< T > &offset) |
make a 3D transformation representing a translation | |
static const TSelf | scaler (const T &scale) |
make a 3D transformation representing a uniform scaling | |
static const TSelf | scaler (const Vector3D< T > &scale) |
make a 3D transformation representing a scaling with different factors per axis | |
static const TSelf | rotation (XYZ axis, TParam radians) |
make a 3D transformation representing a rotation around a primary axis | |
static const TSelf | rotation (const Vector3D< T > &axis, TParam radians) |
make a 3D transformation representing a rotation around an arbitrary axis | |
Private Types | |
enum | { matrixSize_ = 16 } |
typedef util::SharedPtr < TValue, impl::Transformation3DStorage > | TMatrix |
Private Member Functions | |
Transformation3D (const TMatrix &matrix, const TMatrix &inverseMatrix, bool dummy) | |
Static Private Member Functions | |
static T * | allocate () |
Private Attributes | |
TMatrix | matrix_ |
TMatrix | inverseMatrix_ |
Static Private Attributes | |
static util::Semaphore | sync_ |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T , class MMP > | |
Aabb2D< T, MMP > | transform (const Aabb2D< T, MMP > &subject, const Transformation2D< T > &transformation) |
apply transformation to axis aligned bounding box | |
template<typename T , class MMP > | |
Aabb3D< T, MMP > | transform (const Aabb3D< T, MMP > &subject, const Transformation3D< T > &transformation) |
apply transformation to axis aligned bounding box | |
template<typename T > | |
ColorRGBA | transform (const ColorRGBA &subject, const Transformation3D< T > &transformation) |
apply transformation to axis aligned bounding box | |
template<typename T , class NP > | |
Plane3D< T, Cartesian, NP > | transform (const Plane3D< T, Cartesian, NP > &plane, const Transformation3D< T > &transformation) |
apply transformation to cartesian plane | |
template<typename T , class NP > | |
Plane3D< T, Parametric, NP > | transform (const Plane3D< T, Parametric, NP > &plane, const Transformation3D< T > &transformation) |
apply transformation to parametric plane | |
template<typename T , class NP > | |
Plane3D< T, Combined, NP > | transform (const Plane3D< T, Combined, NP > &plane, const Transformation3D< T > &transformation) |
apply transformation to combined plane | |
template<typename T , class NP , class PP > | |
Ray3D< T, NP, PP > | transform (const Ray3D< T, NP, PP > &subject, const Transformation3D< T > &transformation) |
apply transformation to ray | |
template<typename T , class NP , class PP > | |
Ray3D< T, NP, PP > | transform (const Ray3D< T, NP, PP > &subject, const Transformation3D< T > &transformation, T &tRay) |
apply transformation to ray, and rescale a parameter to represent same point | |
template<typename T > | |
Transformation3D< T > | concatenate (const Transformation3D< T > &first, const Transformation3D< T > &second) |
concatenate two transformations first and second in one. | |
template<typename T > | |
Vector3D< T > | transform (const Vector3D< T > &subject, const Transformation3D< T > &transformation) |
apply transformation to a vector | |
template<typename T > | |
Point3D< T > | transform (const Point3D< T > &subject, const Transformation3D< T > &transformation) |
apply transformation to a point | |
template<typename T > | |
Vector3D< T > | normalTransform (const Vector3D< T > &subject, const Transformation3D< T > &transformation) |
apply transformation to a normal vector. | |
template<typename T > | |
std::pair< Vector3D< T >, T > | normalTransform (const std::pair< Vector3D< T >, T > &subject, const Transformation3D< T > &transformation) |
apply transformation to a 4D normal vector. | |
template<typename T , typename Char , typename Traits > | |
std::basic_ostream< Char, Traits > & | operator<< (std::basic_ostream< Char, Traits > &stream, const Transformation3D< T > &transformation) |
template<typename T > | |
io::XmlOStream & | operator<< (io::XmlOStream &stream, const Transformation3D< T > &transformation) |
Definition at line 83 of file transformation_3d.h.
typedef Transformation3D<T> lass::prim::Transformation3D< T >::TSelf |
Definition at line 87 of file transformation_3d.h.
typedef Point3D<T> lass::prim::Transformation3D< T >::TPoint |
Definition at line 89 of file transformation_3d.h.
typedef TPoint::TVector lass::prim::Transformation3D< T >::TVector |
Definition at line 90 of file transformation_3d.h.
typedef util::CallTraits<T>::TValue lass::prim::Transformation3D< T >::TValue |
Definition at line 91 of file transformation_3d.h.
typedef util::CallTraits<T>::TParam lass::prim::Transformation3D< T >::TParam |
Definition at line 92 of file transformation_3d.h.
typedef util::CallTraits<T>::TReference lass::prim::Transformation3D< T >::TReference |
Definition at line 93 of file transformation_3d.h.
typedef util::CallTraits<T>::TConstReference lass::prim::Transformation3D< T >::TConstReference |
Definition at line 94 of file transformation_3d.h.
typedef num::NumTraits<T> lass::prim::Transformation3D< T >::TNumTraits |
Definition at line 95 of file transformation_3d.h.
typedef size_t lass::prim::Transformation3D< T >::TSize |
Definition at line 96 of file transformation_3d.h.
typedef util::SharedPtr<TValue, impl::Transformation3DStorage> lass::prim::Transformation3D< T >::TMatrix [private] |
Definition at line 126 of file transformation_3d.h.
anonymous enum |
anonymous enum [private] |
lass::prim::Transformation3D< T >::Transformation3D | ( | ) | [inline] |
construct an identity transformation.
An identity transformation transforms every point to itself.
Definition at line 65 of file transformation_3d.inl.
References lass::prim::Transformation3D< T >::matrix_, lass::num::NumTraits< C >::one, and lass::num::NumTraits< C >::zero.
lass::prim::Transformation3D< T >::Transformation3D | ( | const TPoint & | origin, | |
const TVector & | baseX, | |||
const TVector & | baseY, | |||
const TVector & | baseZ | |||
) | [inline] |
construct an matrix from an origin and three base vectors
TVector3D<T> i, j, k; TPoint3D<T> o, p; // ... Transformation3D<T> transformation(o, i, j, k); LASS_ASSERT(transform(p, transformation) == (o + i * p.x + j * p.y + k * p.z));
Definition at line 101 of file transformation_3d.inl.
References lass::prim::Transformation3D< T >::matrix_, lass::num::NumTraits< C >::one, lass::prim::Point3D< T >::x, lass::prim::Vector3D< T >::x, lass::prim::Point3D< T >::y, lass::prim::Vector3D< T >::y, lass::prim::Point3D< T >::z, lass::prim::Vector3D< T >::z, and lass::num::NumTraits< C >::zero.
lass::prim::Transformation3D< T >::Transformation3D | ( | InputIterator | first, | |
InputIterator | last | |||
) | [inline] |
construct a transformation from a 4x4 tranformation matrix.
The elements of the 4x4 matrix will represented in a row major way by an iterator range [first, last) of 16 elements.
Definition at line 132 of file transformation_3d.inl.
References lass::prim::distance(), lass::util::SharedPtr< T, StoragePolicy, CounterPolicy >::get(), LASS_ENFORCE, and lass::prim::Transformation3D< T >::matrix_.
lass::prim::Transformation3D< T >::Transformation3D | ( | const TMatrix & | matrix, | |
const TMatrix & | inverseMatrix, | |||
bool | dummy | |||
) | [inline, private] |
Definition at line 365 of file transformation_3d.inl.
const Transformation3D< T > lass::prim::Transformation3D< T >::inverse | ( | ) | const [inline] |
return the inverse transformation.
The inverse is calculated on the first call, and then cached for later use. For the transformation, we've use the C version of Cramer's rule as described in the Intel (R) article "Streaming SIMD Extensions -Inverse of 4x4 Matrix" which can be found here: http://www.intel.com/design/pentiumiii/sml/245043.htm
Definition at line 150 of file transformation_3d.inl.
References lass::util::SharedPtr< T, StoragePolicy, CounterPolicy >::get(), lass::num::inv(), lass::prim::Transformation3D< T >::inverseMatrix_, lass::util::SharedPtr< T, StoragePolicy, CounterPolicy >::isEmpty(), LASS_ASSERT, LASS_THROW_EX, lass::util::Semaphore::lock(), lass::prim::Transformation3D< T >::matrix_, lass::prim::Transformation3D< T >::matrixSize_, lass::util::SharedPtr< T, StoragePolicy, CounterPolicy >::swap(), lass::prim::Transformation3D< T >::sync_, lass::util::Semaphore::unlock(), and lass::num::NumTraits< C >::zero.
Referenced by lass::prim::Transformation3D< T >::normalTransform().
const Transformation3D< T >::TValue * lass::prim::Transformation3D< T >::matrix | ( | ) | const [inline] |
Return pointer to row major matrix representation of transformation.
This is for immediate use only, like std::basic_string::data()
.
Definition at line 244 of file transformation_3d.inl.
References lass::util::SharedPtr< T, StoragePolicy, CounterPolicy >::get(), and lass::prim::Transformation3D< T >::matrix_.
Referenced by lass::prim::Transformation3D< T >::concatenate(), lass::prim::Transformation3D< T >::normalTransform(), and lass::prim::Transformation3D< T >::transform().
void lass::prim::Transformation3D< T >::swap | ( | TSelf & | other | ) | [inline] |
Definition at line 252 of file transformation_3d.inl.
References lass::prim::Transformation3D< T >::inverseMatrix_, lass::prim::Transformation3D< T >::matrix_, and lass::util::SharedPtr< T, StoragePolicy, CounterPolicy >::swap().
const Transformation3D< T > lass::prim::Transformation3D< T >::identity | ( | ) | [inline, static] |
const Transformation3D< T > lass::prim::Transformation3D< T >::translation | ( | const Vector3D< T > & | offset | ) | [inline, static] |
make a 3D transformation representing a translation
Definition at line 273 of file transformation_3d.inl.
References lass::prim::Transformation3D< T >::matrix_, lass::prim::Vector3D< T >::x, lass::prim::Vector3D< T >::y, and lass::prim::Vector3D< T >::z.
const Transformation3D< T > lass::prim::Transformation3D< T >::scaler | ( | const T & | scale | ) | [inline, static] |
make a 3D transformation representing a uniform scaling
Definition at line 287 of file transformation_3d.inl.
References lass::prim::Transformation3D< T >::matrix_.
const Transformation3D< T > lass::prim::Transformation3D< T >::scaler | ( | const Vector3D< T > & | scale | ) | [inline, static] |
make a 3D transformation representing a scaling with different factors per axis
Definition at line 301 of file transformation_3d.inl.
References lass::prim::Transformation3D< T >::matrix_, lass::prim::Vector3D< T >::x, lass::prim::Vector3D< T >::y, and lass::prim::Vector3D< T >::z.
const Transformation3D< T > lass::prim::Transformation3D< T >::rotation | ( | XYZ | axis, | |
TParam | radians | |||
) | [inline, static] |
make a 3D transformation representing a rotation around a primary axis
Definition at line 315 of file transformation_3d.inl.
References lass::prim::cos(), LASS_ASSERT, lass::prim::Transformation3D< T >::matrix_, lass::num::sin(), and lass::stde::T.
const Transformation3D< T > lass::prim::Transformation3D< T >::rotation | ( | const Vector3D< T > & | axis, | |
TParam | radians | |||
) | [inline, static] |
make a 3D transformation representing a rotation around an arbitrary axis
Definition at line 336 of file transformation_3d.inl.
References lass::prim::cos(), lass::prim::Transformation3D< T >::matrix_, lass::prim::Vector3D< T >::normal(), lass::num::NumTraits< C >::one, lass::num::sin(), lass::stde::T, lass::prim::Vector3D< T >::x, lass::prim::Vector3D< T >::y, and lass::prim::Vector3D< T >::z.
static T* lass::prim::Transformation3D< T >::allocate | ( | ) | [static, private] |
Aabb2D< T, MMP > transform | ( | const Aabb2D< T, MMP > & | subject, | |
const Transformation2D< T > & | transformation | |||
) | [related] |
apply transformation to axis aligned bounding box
Definition at line 60 of file aabb_2d_transformation_2d.h.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isEmpty(), lass::prim::Aabb2D< T, MinMaxPolicy >::min(), lass::prim::Aabb2D< T, MinMaxPolicy >::size(), lass::prim::transform(), lass::prim::Vector3D< T >::x, and lass::prim::Vector3D< T >::y.
Aabb3D< T, MMP > transform | ( | const Aabb3D< T, MMP > & | subject, | |
const Transformation3D< T > & | transformation | |||
) | [related] |
apply transformation to axis aligned bounding box
Definition at line 59 of file aabb_3d_transformation_3d.h.
References lass::prim::Aabb3D< T, MinMaxPolicy >::isEmpty(), lass::prim::Aabb3D< T, MinMaxPolicy >::min(), lass::prim::Aabb3D< T, MinMaxPolicy >::size(), lass::prim::transform(), lass::prim::Vector3D< T >::x, lass::prim::Vector3D< T >::y, and lass::prim::Vector3D< T >::z.
ColorRGBA transform | ( | const ColorRGBA & | subject, | |
const Transformation3D< T > & | transformation | |||
) | [related] |
apply transformation to axis aligned bounding box
Definition at line 60 of file color_rgba_transformation_3d.h.
References lass::prim::ColorRGBA::a, lass::prim::ColorRGBA::b, lass::prim::ColorRGBA::g, lass::prim::Transformation3D< T >::matrix(), lass::prim::ColorRGBA::r, and lass::stde::T.
Plane3D< T, Cartesian, NP > transform | ( | const Plane3D< T, Cartesian, NP > & | plane, | |
const Transformation3D< T > & | transformation | |||
) | [related] |
apply transformation to cartesian plane
Definition at line 60 of file plane_3d_transformation_3d.h.
References lass::prim::impl::Plane3DCartesian< T, NormalizingPolicy >::d(), lass::prim::impl::Plane3DCartesian< T, NormalizingPolicy >::normal(), lass::stde::T, and lass::prim::transform().
Plane3D< T, Parametric, NP > transform | ( | const Plane3D< T, Parametric, NP > & | plane, | |
const Transformation3D< T > & | transformation | |||
) | [related] |
apply transformation to parametric plane
Definition at line 74 of file plane_3d_transformation_3d.h.
References lass::prim::impl::Plane3DCartesian< T, NormalizingPolicy >::directionU(), lass::prim::impl::Plane3DCartesian< T, NormalizingPolicy >::directionV(), lass::prim::impl::Plane3DCartesian< T, NormalizingPolicy >::support(), and lass::prim::transform().
Plane3D< T, Combined, NP > transform | ( | const Plane3D< T, Combined, NP > & | plane, | |
const Transformation3D< T > & | transformation | |||
) | [related] |
apply transformation to combined plane
Definition at line 87 of file plane_3d_transformation_3d.h.
References lass::prim::impl::Plane3DCartesian< T, NormalizingPolicy >::directionU(), lass::prim::impl::Plane3DCartesian< T, NormalizingPolicy >::directionV(), lass::prim::impl::Plane3DCartesian< T, NormalizingPolicy >::support(), and lass::prim::transform().
Ray3D< T, NP, PP > transform | ( | const Ray3D< T, NP, PP > & | subject, | |
const Transformation3D< T > & | transformation | |||
) | [related] |
apply transformation to ray
Definition at line 88 of file ray_3d_transformation_3d.h.
References lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::direction(), lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::support(), and lass::prim::transform().
Ray3D< T, NP, PP > transform | ( | const Ray3D< T, NP, PP > & | subject, | |
const Transformation3D< T > & | transformation, | |||
T & | tRay | |||
) | [related] |
apply transformation to ray, and rescale a parameter to represent same point
tRay |
|
Definition at line 111 of file ray_3d_transformation_3d.h.
References lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::direction(), lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::support(), and lass::prim::transform().
Transformation3D< T > concatenate | ( | const Transformation3D< T > & | first, | |
const Transformation3D< T > & | second | |||
) | [related] |
concatenate two transformations first and second in one.
The result is one transformation that performs the same actions as first performing first and then second. Hence, the following lines of code are equivalent (ignoring numerical imprecions):
y = transform(x, concatenate(first, second)); y = transform(transform(x, first), second);
Definition at line 387 of file transformation_3d.inl.
References lass::prim::Transformation3D< T >::matrix(), and lass::stde::T.
Vector3D< T > transform | ( | const Vector3D< T > & | subject, | |
const Transformation3D< T > & | transformation | |||
) | [related] |
apply transformation to a vector
Definition at line 413 of file transformation_3d.inl.
References lass::prim::Transformation3D< T >::matrix(), lass::stde::T, lass::prim::Vector3D< T >::x, lass::prim::Vector3D< T >::y, and lass::prim::Vector3D< T >::z.
Point3D< T > transform | ( | const Point3D< T > & | subject, | |
const Transformation3D< T > & | transformation | |||
) | [related] |
apply transformation to a point
Definition at line 428 of file transformation_3d.inl.
References lass::num::inv(), lass::prim::Transformation3D< T >::matrix(), lass::stde::T, lass::prim::Point3D< T >::x, lass::prim::Point3D< T >::y, and lass::prim::Point3D< T >::z.
Vector3D< T > normalTransform | ( | const Vector3D< T > & | subject, | |
const Transformation3D< T > & | transformation | |||
) | [related] |
apply transformation to a normal vector.
Vectors that represent a normal vector should transform differentely than ordinary vectors. Use this transformation function for normals.
Definition at line 447 of file transformation_3d.inl.
References lass::prim::Transformation3D< T >::inverse(), lass::prim::Transformation3D< T >::matrix(), lass::stde::T, lass::prim::Vector3D< T >::x, lass::prim::Vector3D< T >::y, and lass::prim::Vector3D< T >::z.
std::pair< Vector3D< T >, T > normalTransform | ( | const std::pair< Vector3D< T >, T > & | subject, | |
const Transformation3D< T > & | transformation | |||
) | [related] |
apply transformation to a 4D normal vector.
Vectors that represent a normal vector should transform differentely than ordinary vectors. Use this transformation function for normals.
Cartesian planes have a 4D normal vector that must be transformed in 3D. Use this function to do it:
// ax + by + cz + d == 0 normalTransform(std::make_pair(Vector3D<float>(a, b, c), d), transformation);
Definition at line 472 of file transformation_3d.inl.
References lass::prim::Transformation3D< T >::inverse(), lass::prim::Transformation3D< T >::matrix(), lass::stde::T, lass::prim::Vector3D< T >::x, lass::prim::Vector3D< T >::y, and lass::prim::Vector3D< T >::z.
std::basic_ostream< Char, Traits > & operator<< | ( | std::basic_ostream< Char, Traits > & | stream, | |
const Transformation3D< T > & | transformation | |||
) | [related] |
Definition at line 492 of file transformation_3d.inl.
References LASS_ENFORCE_STREAM, and lass::stde::T.
io::XmlOStream & operator<< | ( | io::XmlOStream & | stream, | |
const Transformation3D< T > & | transformation | |||
) | [related] |
Definition at line 509 of file transformation_3d.inl.
References LASS_ENFORCE_STREAM, and lass::stde::T.
TMatrix lass::prim::Transformation3D< T >::matrix_ [private] |
Definition at line 130 of file transformation_3d.h.
Referenced by lass::prim::Transformation3D< T >::inverse(), lass::prim::Transformation3D< T >::matrix(), lass::prim::Transformation3D< T >::rotation(), lass::prim::Transformation3D< T >::scaler(), lass::prim::Transformation3D< T >::swap(), lass::prim::Transformation3D< T >::Transformation3D(), and lass::prim::Transformation3D< T >::translation().
TMatrix lass::prim::Transformation3D< T >::inverseMatrix_ [mutable, private] |
Definition at line 131 of file transformation_3d.h.
Referenced by lass::prim::Transformation3D< T >::inverse(), and lass::prim::Transformation3D< T >::swap().
util::Semaphore lass::prim::Transformation3D< T >::sync_ [inline, static, private] |
Definition at line 135 of file transformation_3d.h.
Referenced by lass::prim::Transformation3D< T >::inverse().
Generated on Mon Nov 10 14:22:14 2008 for Library of Assembled Shared Sources by 1.5.7.1 |