33 #ifndef OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED
34 #define OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED
41 #include <openvdb/util/Name.h>
42 #include <openvdb/Types.h>
43 #include <boost/shared_ptr.hpp>
59 class ScaleTranslateMap;
60 class UniformScaleMap;
61 class UniformScaleTranslateMap;
64 class NonlinearFrustumMap;
79 template<
typename T>
struct is_linear {
static const bool value =
false; };
99 static const bool value =
true;
103 template<
typename T>
struct is_scale {
static const bool value =
false; };
161 typedef boost::shared_ptr<MapBase>
Ptr;
163 typedef Ptr (*MapFactory)();
167 virtual boost::shared_ptr<AffineMap> getAffineMap()
const = 0;
170 virtual Name type()
const = 0;
173 template<
typename MapT>
bool isType()
const {
return this->type() == MapT::mapType(); }
176 virtual bool isEqual(
const MapBase& other)
const = 0;
179 virtual bool isLinear()
const = 0;
181 virtual bool hasUniformScale()
const = 0;
183 virtual Vec3d applyMap(
const Vec3d& in)
const = 0;
184 virtual Vec3d applyInverseMap(
const Vec3d& in)
const = 0;
187 virtual Vec3d applyIJT(
const Vec3d& in)
const = 0;
191 virtual Vec3d applyIJT(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
194 virtual Mat3d applyIJC(
const Mat3d& m)
const = 0;
198 virtual double determinant()
const = 0;
199 virtual double determinant(
const Vec3d&)
const = 0;
203 virtual Vec3d voxelSize()
const = 0;
207 virtual Vec3d voxelSize(
const Vec3d&)
const = 0;
210 virtual void read(std::istream&) = 0;
211 virtual void write(std::ostream&)
const = 0;
213 virtual std::string str()
const = 0;
231 virtual Vec3d applyJacobian(
const Vec3d& in)
const = 0;
237 virtual Vec3d applyJacobian(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
241 virtual Vec3d applyInverseJacobian(
const Vec3d& in)
const = 0;
247 virtual Vec3d applyInverseJacobian(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
252 virtual Vec3d applyJT(
const Vec3d& in)
const = 0;
259 virtual Vec3d applyJT(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
272 template<
typename MapT>
275 return other.
isType<MapT>() && (
self == *static_cast<const MapT*>(&other));
296 static bool isRegistered(
const Name&);
299 static void registerMap(
const Name&, MapBase::MapFactory);
302 static void unregisterMap(
const Name&);
326 typedef boost::shared_ptr<AffineMap>
Ptr;
327 typedef boost::shared_ptr<const AffineMap>
ConstPtr;
330 mMatrix(
Mat4d::identity()),
331 mMatrixInv(
Mat4d::identity()),
332 mJacobianInv(
Mat3d::identity()),
334 mVoxelSize(
Vec3d(1,1,1)),
346 updateAcceleration();
353 "Tried to initialize an affine transform from a non-affine 4x4 matrix");
355 updateAcceleration();
360 mMatrix(other.mMatrix),
361 mMatrixInv(other.mMatrixInv),
362 mJacobianInv(other.mJacobianInv),
363 mDeterminant(other.mDeterminant),
364 mVoxelSize(other.mVoxelSize),
365 mIsDiagonal(other.mIsDiagonal),
366 mIsIdentity(other.mIsIdentity)
372 mMatrix(first.mMatrix * second.mMatrix)
374 updateAcceleration();
386 static bool isRegistered() {
return MapRegistry::isRegistered(AffineMap::mapType()); }
390 MapRegistry::registerMap(
391 AffineMap::mapType(),
404 Mat3d mat = mMatrix.getMat3();
405 const double det = mat.
det();
409 mat *= (1.f / pow(std::abs(det),1./3.));
414 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
419 if (!mMatrix.eq(other.mMatrix)) {
return false; }
420 if (!mMatrixInv.eq(other.mMatrixInv)) {
return false; }
428 mMatrix = other.mMatrix;
429 mMatrixInv = other.mMatrixInv;
431 mJacobianInv = other.mJacobianInv;
432 mDeterminant = other.mDeterminant;
433 mVoxelSize = other.mVoxelSize;
434 mIsDiagonal = other.mIsDiagonal;
435 mIsIdentity = other.mIsIdentity;
459 return Vec3d( m[ 0] * in[0] + m[ 1] * in[1] + m[ 2] * in[2],
460 m[ 4] * in[0] + m[ 5] * in[1] + m[ 6] * in[2],
461 m[ 8] * in[0] + m[ 9] * in[1] + m[10] * in[2] );
470 return mJacobianInv.
transpose()* m * mJacobianInv;
481 Vec3d voxelSize()
const {
return mVoxelSize; }
500 void accumPreRotation(
Axis axis,
double radians)
503 mMatrix.preRotate(axis, radians);
504 updateAcceleration();
509 updateAcceleration();
513 mMatrix.preTranslate(v);
514 updateAcceleration();
518 mMatrix.preShear(axis0, axis1, shear);
519 updateAcceleration();
525 void accumPostRotation(
Axis axis,
double radians)
528 mMatrix.postRotate(axis, radians);
529 updateAcceleration();
533 mMatrix.postScale(v);
534 updateAcceleration();
538 mMatrix.postTranslate(v);
539 updateAcceleration();
543 mMatrix.postShear(axis0, axis1, shear);
544 updateAcceleration();
553 updateAcceleration();
565 std::ostringstream buffer;
566 buffer <<
" - mat4:\n" << mMatrix.str() << std::endl;
567 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
590 affineMap->accumPreRotation(axis, radians);
596 affineMap->accumPreTranslation(t);
602 affineMap->accumPreScale(s);
608 affineMap->accumPreShear(axis0, axis1, shear);
620 affineMap->accumPostRotation(axis, radians);
626 affineMap->accumPostTranslation(t);
632 affineMap->accumPostScale(s);
638 affineMap->accumPostShear(axis0, axis1, shear);
649 void updateAcceleration() {
650 Mat3d mat3 = mMatrix.getMat3();
651 mDeterminant = mat3.
det();
655 "Tried to initialize an affine transform from a nearly singular matrix");
657 mMatrixInv = mMatrix.inverse();
662 mVoxelSize(0) = (applyMap(
Vec3d(1,0,0)) - pos).length();
663 mVoxelSize(1) = (applyMap(
Vec3d(0,1,0)) - pos).length();
664 mVoxelSize(2) = (applyMap(
Vec3d(0,0,1)) - pos).length();
675 bool mIsDiagonal, mIsIdentity;
687 typedef boost::shared_ptr<ScaleMap>
Ptr;
688 typedef boost::shared_ptr<const ScaleMap>
ConstPtr;
691 mScaleValuesInverse(
Vec3d(1,1,1)),
692 mInvScaleSqr(1,1,1), mInvTwiceScale(0.5,0.5,0.5){}
697 mVoxelSize(
Vec3d(std::abs(scale(0)),std::abs(scale(1)), std::abs(scale(2))))
699 double determinant = scale[0]* scale[1] * scale[2];
703 mScaleValuesInverse = 1.0 / mScaleValues;
704 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
705 mInvTwiceScale = mScaleValuesInverse / 2;
710 mScaleValues(other.mScaleValues),
711 mVoxelSize(other.mVoxelSize),
712 mScaleValuesInverse(other.mScaleValuesInverse),
713 mInvScaleSqr(other.mInvScaleSqr),
714 mInvTwiceScale(other.mInvTwiceScale)
727 static bool isRegistered() {
return MapRegistry::isRegistered(ScaleMap::mapType()); }
731 MapRegistry::registerMap(
746 std::abs(mScaleValues.x()), std::abs(mScaleValues.y()),
double(5e-7));
748 std::abs(mScaleValues.x()), std::abs(mScaleValues.z()),
double(5e-7));
756 in.
x() * mScaleValues.x(),
757 in.
y() * mScaleValues.y(),
758 in.
z() * mScaleValues.z());
764 in.
x() * mScaleValuesInverse.x(),
765 in.
y() * mScaleValuesInverse.y(),
766 in.
z() * mScaleValuesInverse.z());
795 for (
int i = 0; i < 3; i++) {
796 tmp.
setRow(i, in.
row(i) * mScaleValuesInverse(i));
798 for (
int i = 0; i < 3; i++) {
799 tmp.
setCol(i, tmp.
col(i) * mScaleValuesInverse(i));
807 double determinant()
const {
return mScaleValues.x() * mScaleValues.y() * mScaleValues.z(); }
820 Vec3d voxelSize()
const {
return mVoxelSize; }
831 mScaleValues.read(is);
833 mScaleValuesInverse.read(is);
834 mInvScaleSqr.read(is);
835 mInvTwiceScale.read(is);
840 mScaleValues.write(os);
841 mVoxelSize.write(os);
842 mScaleValuesInverse.write(os);
843 mInvScaleSqr.write(os);
844 mInvTwiceScale.write(os);
849 std::ostringstream buffer;
850 buffer <<
" - scale: " << mScaleValues << std::endl;
851 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
855 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
860 if (!mScaleValues.eq(other.mScaleValues)) {
return false; }
880 affineMap->accumPreRotation(axis, radians);
884 MapBase::Ptr preTranslate(
const Vec3d& tr)
const;
886 MapBase::Ptr preScale(
const Vec3d& v)
const;
891 affineMap->accumPreShear(axis0, axis1, shear);
903 affineMap->accumPostRotation(axis, radians);
907 MapBase::Ptr postTranslate(
const Vec3d& tr)
const;
909 MapBase::Ptr postScale(
const Vec3d& v)
const;
914 affineMap->accumPostShear(axis0, axis1, shear);
920 Vec3d mScaleValues, mVoxelSize, mScaleValuesInverse, mInvScaleSqr, mInvTwiceScale;
929 typedef boost::shared_ptr<UniformScaleMap>
Ptr;
930 typedef boost::shared_ptr<const UniformScaleMap>
ConstPtr;
944 const Vec3d& invScale = getInvScale();
948 static bool isRegistered() {
return MapRegistry::isRegistered(UniformScaleMap::mapType()); }
951 MapRegistry::registerMap(
952 UniformScaleMap::mapType(),
953 UniformScaleMap::create);
959 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
979 ScaleMap::preScale(
const Vec3d& v)
const
981 const Vec3d new_scale(v * mScaleValues);
991 ScaleMap::postScale(
const Vec3d& v)
const
1001 typedef boost::shared_ptr<TranslationMap>
Ptr;
1002 typedef boost::shared_ptr<const TranslationMap>
ConstPtr;
1018 static bool isRegistered() {
return MapRegistry::isRegistered(TranslationMap::mapType()); }
1022 MapRegistry::registerMap(
1023 TranslationMap::mapType(),
1024 TranslationMap::create);
1080 void read(std::istream& is) { mTranslation.read(is); }
1082 void write(std::ostream& os)
const { mTranslation.write(os); }
1087 std::ostringstream buffer;
1088 buffer <<
" - translation: " << mTranslation << std::endl;
1089 return buffer.str();
1092 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
1097 return mTranslation.eq(other.mTranslation);
1118 affineMap->accumPreRotation(axis, radians);
1132 affineMap->accumPreShear(axis0, axis1, shear);
1143 affineMap->accumPostRotation(axis, radians);
1157 affineMap->accumPostShear(axis0, axis1, shear);
1176 typedef boost::shared_ptr<ScaleTranslateMap>
Ptr;
1177 typedef boost::shared_ptr<const ScaleTranslateMap>
ConstPtr;
1181 mTranslation(
Vec3d(0,0,0)),
1182 mScaleValues(
Vec3d(1,1,1)),
1183 mVoxelSize(
Vec3d(1,1,1)),
1184 mScaleValuesInverse(
Vec3d(1,1,1)),
1185 mInvScaleSqr(1,1,1),
1186 mInvTwiceScale(0.5,0.5,0.5)
1192 mTranslation(translate),
1193 mScaleValues(scale),
1194 mVoxelSize(std::abs(scale(0)), std::abs(scale(1)), std::abs(scale(2)))
1196 const double determinant = scale[0]* scale[1] * scale[2];
1200 mScaleValuesInverse = 1.0 / mScaleValues;
1201 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1202 mInvTwiceScale = mScaleValuesInverse / 2;
1207 mTranslation(translate.getTranslation()),
1209 mVoxelSize(std::abs(mScaleValues(0)),
1210 std::abs(mScaleValues(1)),
1211 std::abs(mScaleValues(2))),
1212 mScaleValuesInverse(1.0 / scale.
getScale())
1214 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1215 mInvTwiceScale = mScaleValuesInverse / 2;
1220 mTranslation(other.mTranslation),
1221 mScaleValues(other.mScaleValues),
1222 mVoxelSize(other.mVoxelSize),
1223 mScaleValuesInverse(other.mScaleValuesInverse),
1224 mInvScaleSqr(other.mInvScaleSqr),
1225 mInvTwiceScale(other.mInvTwiceScale)
1238 mScaleValuesInverse, -mScaleValuesInverse * mTranslation));
1241 static bool isRegistered() {
return MapRegistry::isRegistered(ScaleTranslateMap::mapType()); }
1245 MapRegistry::registerMap(
1246 ScaleTranslateMap::mapType(),
1247 ScaleTranslateMap::create);
1261 std::abs(mScaleValues.x()), std::abs(mScaleValues.y()),
double(5e-7));
1263 std::abs(mScaleValues.x()), std::abs(mScaleValues.z()),
double(5e-7));
1271 in.
x() * mScaleValues.x() + mTranslation.x(),
1272 in.
y() * mScaleValues.y() + mTranslation.y(),
1273 in.
z() * mScaleValues.z() + mTranslation.z());
1279 (in.
x() - mTranslation.x() ) * mScaleValuesInverse.x(),
1280 (in.
y() - mTranslation.y() ) * mScaleValuesInverse.y(),
1281 (in.
z() - mTranslation.z() ) * mScaleValuesInverse.z());
1307 in.
x() * mScaleValuesInverse.x(),
1308 in.
y() * mScaleValuesInverse.y(),
1309 in.
z() * mScaleValuesInverse.z());
1315 for (
int i=0; i<3; i++){
1316 tmp.
setRow(i, in.
row(i)*mScaleValuesInverse(i));
1318 for (
int i=0; i<3; i++){
1319 tmp.
setCol(i, tmp.
col(i)*mScaleValuesInverse(i));
1328 double determinant()
const {
return mScaleValues.x()*mScaleValues.y()*mScaleValues.z(); }
1350 mTranslation.read(is);
1351 mScaleValues.read(is);
1352 mVoxelSize.read(is);
1353 mScaleValuesInverse.read(is);
1354 mInvScaleSqr.read(is);
1355 mInvTwiceScale.read(is);
1360 mTranslation.write(os);
1361 mScaleValues.write(os);
1362 mVoxelSize.write(os);
1363 mScaleValuesInverse.write(os);
1364 mInvScaleSqr.write(os);
1365 mInvTwiceScale.write(os);
1370 std::ostringstream buffer;
1371 buffer <<
" - translation: " << mTranslation << std::endl;
1372 buffer <<
" - scale: " << mScaleValues << std::endl;
1373 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
1374 return buffer.str();
1377 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
1382 if (!mScaleValues.eq(other.mScaleValues)) {
return false; }
1383 if (!mTranslation.eq(other.mTranslation)) {
return false; }
1393 affineMap->accumPostTranslation(mTranslation);
1403 affineMap->accumPreRotation(axis, radians);
1408 const Vec3d& s = mScaleValues;
1409 const Vec3d scaled_trans( t.
x() * s.
x(),
1420 affineMap->accumPreShear(axis0, axis1, shear);
1431 affineMap->accumPostRotation(axis, radians);
1444 affineMap->accumPostShear(axis0, axis1, shear);
1450 Vec3d mTranslation, mScaleValues, mVoxelSize, mScaleValuesInverse,
1451 mInvScaleSqr, mInvTwiceScale;
1456 ScaleMap::postTranslate(
const Vec3d& t)
const
1463 ScaleMap::preTranslate(
const Vec3d& t)
const
1466 const Vec3d& s = mScaleValues;
1467 const Vec3d scaled_trans( t.
x() * s.
x(),
1479 typedef boost::shared_ptr<UniformScaleTranslateMap>
Ptr;
1480 typedef boost::shared_ptr<const UniformScaleTranslateMap>
ConstPtr;
1498 const Vec3d& scaleInv = getInvScale();
1499 const Vec3d& trans = getTranslation();
1505 return MapRegistry::isRegistered(UniformScaleTranslateMap::mapType());
1510 MapRegistry::registerMap(
1511 UniformScaleTranslateMap::mapType(),
1512 UniformScaleTranslateMap::create);
1518 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
1531 const Vec3d new_trans = this->getTranslation() + scale * t;
1546 UniformScaleMap::postTranslate(
const Vec3d& t)
const
1554 UniformScaleMap::preTranslate(
const Vec3d& t)
const
1562 TranslationMap::preScale(
const Vec3d& v)
const
1573 TranslationMap::postScale(
const Vec3d& v)
const
1578 const Vec3d trans(mTranslation.x()*v.
x(),
1579 mTranslation.y()*v.
y(),
1580 mTranslation.z()*v.
z());
1587 ScaleTranslateMap::preScale(
const Vec3d& v)
const
1589 const Vec3d new_scale( v * mScaleValues );
1599 ScaleTranslateMap::postScale(
const Vec3d& v)
const
1601 const Vec3d new_scale( v * mScaleValues );
1602 const Vec3d new_trans( mTranslation.x()*v.
x(),
1603 mTranslation.y()*v.
y(),
1604 mTranslation.z()*v.
z() );
1622 typedef boost::shared_ptr<UnitaryMap>
Ptr;
1660 "4x4 Matrix initializing unitary map was not unitary: not invertible");
1665 "4x4 Matrix initializing unitary map was not unitary: not affine");
1670 "4x4 Matrix initializing unitary map was not unitary: had translation");
1675 "4x4 Matrix initializing unitary map was not unitary");
1683 mAffineMap(other.mAffineMap)
1688 mAffineMap(*(first.getAffineMap()), *(second.getAffineMap()))
1703 static bool isRegistered() {
return MapRegistry::isRegistered(UnitaryMap::mapType()); }
1707 MapRegistry::registerMap(
1708 UnitaryMap::mapType(),
1709 UnitaryMap::create);
1723 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
1728 if (mAffineMap!=other.mAffineMap)
return false;
1754 return applyInverseMap(in);
1782 mAffineMap.read(is);
1788 mAffineMap.write(os);
1793 std::ostringstream buffer;
1794 buffer << mAffineMap.str();
1795 return buffer.str();
1812 affineMap->accumPreTranslation(t);
1818 affineMap->accumPreScale(v);
1824 affineMap->accumPreShear(axis0, axis1, shear);
1842 affineMap->accumPostTranslation(t);
1848 affineMap->accumPostScale(v);
1854 affineMap->accumPostShear(axis0, axis1, shear);
1876 typedef boost::shared_ptr<NonlinearFrustumMap>
Ptr;
1877 typedef boost::shared_ptr<const NonlinearFrustumMap>
ConstPtr;
1892 MapBase(),mBBox(bb), mTaper(taper), mDepth(depth)
1904 mBBox(bb), mTaper(taper), mDepth(depth)
1906 if (!secondMap->isLinear() ) {
1908 "The second map in the Frustum transfrom must be linear");
1910 mSecondMap = *( secondMap->getAffineMap() );
1917 mTaper(other.mTaper),
1918 mDepth(other.mDepth),
1919 mSecondMap(other.mSecondMap),
1920 mHasSimpleAffine(other.mHasSimpleAffine)
1941 const Vec3d& direction,
1944 double z_near,
double depth,
1952 "The frustum depth must be non-zero and positive");
1954 if (!(up.
length() > 0)) {
1956 "The frustum height must be non-zero and positive");
1958 if (!(aspect > 0)) {
1960 "The frustum aspect ratio must be non-zero and positive");
1964 "The frustum up orientation must be perpendicular to into-frustum direction");
1967 double near_plane_height = 2 * up.
length();
1968 double near_plane_width = aspect * near_plane_height;
1973 mDepth = depth / near_plane_width;
1974 double gamma = near_plane_width / z_near;
1975 mTaper = 1./(mDepth*gamma + 1.);
1977 Vec3d direction_unit = direction;
1986 Vec3d(near_plane_width, near_plane_width, near_plane_width));
1990 Mat4d mat = scale * r2 * r1;
2010 "inverseMap() is not implemented for NonlinearFrustumMap");
2012 static bool isRegistered() {
return MapRegistry::isRegistered(NonlinearFrustumMap::mapType()); }
2016 MapRegistry::registerMap(
2017 NonlinearFrustumMap::mapType(),
2018 NonlinearFrustumMap::create);
2039 const Vec3d e1(1,0,0);
2040 if (!applyMap(e1).eq(e1))
return false;
2042 const Vec3d e2(0,1,0);
2043 if (!applyMap(e2).eq(e2))
return false;
2045 const Vec3d e3(0,0,1);
2046 if (!applyMap(e3).eq(e3))
return false;
2051 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
2055 if (mBBox!=other.mBBox)
return false;
2062 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2065 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2068 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2071 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2080 return mSecondMap.applyMap(applyFrustumMap(in));
2086 return applyFrustumInverseMap(mSecondMap.applyInverseMap(in));
2095 Vec3d centered(isloc);
2096 centered = centered - mBBox.min();
2097 centered.
x() -= mXo;
2098 centered.
y() -= mYo;
2101 const double zprime = centered.
z()*mDepthOnLz;
2103 const double scale = (mGamma * zprime + 1.) / mLx;
2104 const double scale2 = mGamma * mDepthOnLz / mLx;
2106 const Vec3d tmp(scale * in.
x() + scale2 * centered.
x()* in.
z(),
2107 scale * in.
y() + scale2 * centered.
y()* in.
z(),
2108 mDepthOnLz * in.
z());
2110 return mSecondMap.applyJacobian(tmp);
2121 Vec3d centered(isloc);
2122 centered = centered - mBBox.min();
2123 centered.
x() -= mXo;
2124 centered.
y() -= mYo;
2127 const double zprime = centered.
z()*mDepthOnLz;
2129 const double scale = (mGamma * zprime + 1.) / mLx;
2130 const double scale2 = mGamma * mDepthOnLz / mLx;
2133 Vec3d out = mSecondMap.applyInverseJacobian(in);
2135 out.
x() = (out.
x() - scale2 * centered.
x() * out.
z() / mDepthOnLz) / scale;
2136 out.
y() = (out.
y() - scale2 * centered.
y() * out.
z() / mDepthOnLz) / scale;
2137 out.
z() = out.
z() / mDepthOnLz;
2148 const Vec3d tmp = mSecondMap.applyJT(in);
2151 Vec3d centered(isloc);
2152 centered = centered - mBBox.min();
2153 centered.
x() -= mXo;
2154 centered.
y() -= mYo;
2157 const double zprime = centered.
z()*mDepthOnLz;
2159 const double scale = (mGamma * zprime + 1.) / mLx;
2160 const double scale2 = mGamma * mDepthOnLz / mLx;
2162 return Vec3d(scale * tmp.
x(),
2164 scale2 * centered.
x()* tmp.
x() +
2165 scale2 * centered.
y()* tmp.
y() +
2166 mDepthOnLz * tmp.
z());
2170 return mSecondMap.applyJT(in);
2186 const Vec3d loc = applyFrustumMap(ijk);
2187 const double s = mGamma * loc.
z() + 1.;
2192 " at the singular focal point (e.g. camera)");
2195 const double sinv = 1.0/s;
2196 const double pt0 = mLx * sinv;
2197 const double pt1 = mGamma * pt0;
2198 const double pt2 = pt1 * sinv;
2200 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2203 Mat3d gradE(Mat3d::zero());
2204 for (
int j = 0; j < 3; ++j ) {
2205 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2206 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2207 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2211 for (
int i = 0; i < 3; ++i) {
2212 result(0) = d1_is(0) * gradE(0,i) + d1_is(1) * gradE(1,i) + d1_is(2) * gradE(2,i);
2227 const Vec3d loc = applyFrustumMap(ijk);
2229 const double s = mGamma * loc.
z() + 1.;
2234 " at the singular focal point (e.g. camera)");
2238 const double sinv = 1.0/s;
2239 const double pt0 = mLx * sinv;
2240 const double pt1 = mGamma * pt0;
2241 const double pt2 = pt1 * sinv;
2242 const double pt3 = pt2 * sinv;
2244 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2248 Mat3d matE0(Mat3d::zero());
2249 Mat3d matE1(Mat3d::zero());
2250 for(
int j = 0; j < 3; j++) {
2251 for (
int k = 0; k < 3; k++) {
2253 const double pt4 = 2. * jacinv(2,j) * jacinv(2,k) * pt3;
2255 matE0(j,k) = -(jacinv(0,j) * jacinv(2,k) + jacinv(2,j) * jacinv(0,k)) * pt2 +
2258 matE1(j,k) = -(jacinv(1,j) * jacinv(2,k) + jacinv(2,j) * jacinv(1,k)) * pt2 +
2264 Mat3d gradE(Mat3d::zero());
2265 for (
int j = 0; j < 3; ++j ) {
2266 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2267 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2268 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2271 Mat3d result(Mat3d::zero());
2274 for (
int m = 0; m < 3; ++m ) {
2275 for (
int n = 0; n < 3; ++n) {
2276 for (
int i = 0; i < 3; ++i ) {
2277 for (
int j = 0; j < 3; ++j) {
2278 result(m, n) += gradE(j, m) * gradE(i, n) * d2_is(i, j);
2284 for (
int m = 0; m < 3; ++m ) {
2285 for (
int n = 0; n < 3; ++n) {
2287 matE0(m, n) * d1_is(0) + matE1(m, n) * d1_is(1);
2301 double s = mGamma * loc.
z() + 1.0;
2302 double frustum_determinant = s * s * mDepthOnLzLxLx;
2303 return mSecondMap.determinant() * frustum_determinant;
2309 const Vec3d loc( 0.5*(mBBox.min().x() + mBBox.max().x()),
2310 0.5*(mBBox.min().y() + mBBox.max().y()),
2313 return voxelSize(loc);
2323 Vec3d out, pos = applyMap(loc);
2324 out(0) = (applyMap(loc +
Vec3d(1,0,0)) - pos).length();
2325 out(1) = (applyMap(loc +
Vec3d(0,1,0)) - pos).length();
2326 out(2) = (applyMap(loc +
Vec3d(0,0,1)) - pos).length();
2367 is.read(reinterpret_cast<char*>(&mTaper),
sizeof(
double));
2368 is.read(reinterpret_cast<char*>(&mDepth),
sizeof(
double));
2374 if(!MapRegistry::isRegistered(type)) {
2379 MapBase::Ptr proxy = math::MapRegistry::createMap(type);
2381 mSecondMap = *(proxy->getAffineMap());
2389 os.write(reinterpret_cast<const char*>(&mTaper),
sizeof(
double));
2390 os.write(reinterpret_cast<const char*>(&mDepth),
sizeof(
double));
2393 mSecondMap.write(os);
2399 std::ostringstream buffer;
2400 buffer <<
" - taper: " << mTaper << std::endl;
2401 buffer <<
" - depth: " << mDepth << std::endl;
2402 buffer <<
" SecondMap: "<< mSecondMap.type() << std::endl;
2403 buffer << mSecondMap.str() << std::endl;
2404 return buffer.str();
2428 mBBox, mTaper, mDepth, mSecondMap.preShear(shear, axis0, axis1)));
2453 mBBox, mTaper, mDepth, mSecondMap.postShear(shear, axis0, axis1)));
2461 mLx = mBBox.extents().x();
2462 mLy = mBBox.extents().y();
2463 mLz = mBBox.extents().z();
2467 " must have at least two index points in each direction.");
2474 mGamma = (1./mTaper - 1) / mDepth;
2476 mDepthOnLz = mDepth/mLz;
2477 mDepthOnLzLxLx = mDepthOnLz/(mLx * mLx);
2480 mHasSimpleAffine =
true;
2481 Vec3d tmp = mSecondMap.voxelSize();
2484 if (!
isApproxEqual(tmp(0), tmp(1))) { mHasSimpleAffine =
false;
return; }
2485 if (!
isApproxEqual(tmp(0), tmp(2))) { mHasSimpleAffine =
false;
return; }
2487 Vec3d trans = mSecondMap.applyMap(
Vec3d(0,0,0));
2489 Vec3d tmp1 = mSecondMap.applyMap(
Vec3d(1,0,0)) - trans;
2490 Vec3d tmp2 = mSecondMap.applyMap(
Vec3d(0,1,0)) - trans;
2491 Vec3d tmp3 = mSecondMap.applyMap(
Vec3d(0,0,1)) - trans;
2494 if (!
isApproxEqual(tmp1.dot(tmp2), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2495 if (!
isApproxEqual(tmp2.dot(tmp3), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2496 if (!
isApproxEqual(tmp3.dot(tmp1), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2505 out = out - mBBox.min();
2510 out.z() *= mDepthOnLz;
2512 double scale = (mGamma * out.z() + 1.)/ mLx;
2521 Vec3d applyFrustumInverseMap(
const Vec3d& in)
const
2525 double invScale = mLx / (mGamma * out.z() + 1.);
2526 out.x() *= invScale;
2527 out.y() *= invScale;
2532 out.z() /= mDepthOnLz;
2535 out = out + mBBox.min();
2547 AffineMap mSecondMap;
2550 double mLx, mLy, mLz;
2551 double mXo, mYo, mGamma, mDepthOnLz, mDepthOnLzLxLx;
2554 bool mHasSimpleAffine;
2564 template<
typename FirstMapType,
typename SecondMapType>
2570 typedef boost::shared_ptr<MyType>
Ptr;
2576 CompoundMap(
const FirstMapType& f,
const SecondMapType& s): mFirstMap(f), mSecondMap(s)
2578 updateAffineMatrix();
2582 mFirstMap(other.mFirstMap),
2583 mSecondMap(other.mSecondMap),
2584 mAffineMap(other.mAffineMap)
2590 return (FirstMapType::mapType() +
Name(
":") + SecondMapType::mapType());
2595 if (mFirstMap != other.mFirstMap)
return false;
2596 if (mSecondMap != other.mSecondMap)
return false;
2597 if (mAffineMap != other.mAffineMap)
return false;
2605 mFirstMap = other.mFirstMap;
2606 mSecondMap = other.mSecondMap;
2607 mAffineMap = other.mAffineMap;
2614 return mAffineMap.isIdentity();
2616 return mFirstMap.isIdentity()&&mSecondMap.isIdentity();
2622 return mAffineMap.isDiagonal();
2624 return mFirstMap.isDiagonal()&&mSecondMap.isDiagonal();
2635 "Constant affine matrix representation not possible for this nonlinear map");
2640 const FirstMapType&
firstMap()
const {
return mFirstMap; }
2641 const SecondMapType&
secondMap()
const {
return mSecondMap; }
2643 void setFirstMap(
const FirstMapType& first) { mFirstMap = first; updateAffineMatrix(); }
2644 void setSecondMap(
const SecondMapType& second) { mSecondMap = second; updateAffineMatrix(); }
2648 mAffineMap.read(is);
2650 mSecondMap.read(is);
2654 mAffineMap.write(os);
2655 mFirstMap.write(os);
2656 mSecondMap.write(os);
2660 void updateAffineMatrix()
2666 mAffineMap =
AffineMap(*first, *second);
2670 FirstMapType mFirstMap;
2671 SecondMapType mSecondMap;
2673 AffineMap mAffineMap;
2680 #endif // OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED
Mat3d applyIJC(const Mat3d &d2_is, const Vec3d &d1_is, const Vec3d &ijk) const
Definition: Maps.h:2225
Vec3d applyJacobian(const Vec3d &in, const Vec3d &isloc) const
Return the Jacobian defined at isloc applied to in.
Definition: Maps.h:2091
bool isIdentity() const
Definition: Maps.h:2611
bool operator!=(const NonlinearFrustumMap &other) const
Definition: Maps.h:2075
Mat3d applyIJC(const Mat3d &mat, const Vec3d &, const Vec3d &) const
Definition: Maps.h:1065
double determinant() const
Return 1.
Definition: Maps.h:1070
Mat4d getMat4() const
Return the matrix representation of this AffineMap.
Definition: Maps.h:644
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:771
boost::shared_ptr< const MapBase > ConstPtr
Definition: Maps.h:162
Vec3d applyMap(const Vec3d &in) const
Return the image of under the map.
Definition: Maps.h:1268
static MapBase::Ptr create()
Return a MapBase::Ptr to a new TranslationMap.
Definition: Maps.h:1012
virtual ~MapBase()
Definition: Maps.h:165
UnitaryMap(Axis axis, double radians)
Definition: Maps.h:1637
bool hasUniformScale() const
Return false (by convention true)
Definition: Maps.h:1721
UnitaryMap(const Vec3d &axis, double radians)
Definition: Maps.h:1630
Vec3d voxelSize(const Vec3d &) const
Return the lengths of the images of the segments (0,0,0)-(1,0,0), (0,0,0)-(0,1,0) and (0...
Definition: Maps.h:484
static bool isRegistered()
Definition: Maps.h:386
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:2397
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:1037
boost::shared_ptr< const ScaleMap > ConstPtr
Definition: Maps.h:688
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:855
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:723
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the second map applied to in.
Definition: Maps.h:2169
Tolerance for floating-point comparison.
Definition: Math.h:116
Vec4< T0 > transform(const Vec4< T0 > &v) const
Transform a Vec4 by post-multiplication.
Definition: Mat4.h:1012
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:1235
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation...
Definition: Maps.h:1417
void setTaper(double t)
set the taper value, the ratio of nearplane width / far plane width
Definition: Maps.h:2333
bool isValid() const
Definition: Maps.h:2350
TranslationMap()
Definition: Maps.h:1005
OPENVDB_API boost::shared_ptr< SymmetricMap > createSymmetricMap(const Mat3d &m)
Utility methods.
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &) const
Return the Inverse Jacobian of the map applied to in. (i.e. inverse map with out translation) ...
Definition: Maps.h:1046
void write(std::ostream &os) const
write serialization
Definition: Maps.h:1082
bool operator==(const AffineMap &other) const
Definition: Maps.h:416
Vec3d applyInverseJacobian(const Vec3d &in) const
Return the Inverse Jacobian of the map applied to in. (i.e. inverse map with out translation) ...
Definition: Maps.h:451
~NonlinearFrustumMap()
Definition: Maps.h:1998
static MapBase::Ptr create()
Return a MapBase::Ptr to a new NonlinearFrustumMap.
Definition: Maps.h:2000
bool hasUniformScale() const
Return false (by convention true)
Definition: Maps.h:1034
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:1368
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:1341
MyType & operator=(const MyType &other)
Definition: Maps.h:2603
void setToRotation(Axis axis, T angle)
Sets the matrix to a rotation about the given axis.
Definition: Mat4.h:797
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
double getTaper() const
Return the taper value.
Definition: Maps.h:2335
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:446
Mat3d applyIJC(const Mat3d &in) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:792
const MapT & mMap
Definition: GridOperators.h:384
bool normalize(T eps=T(1.0e-7))
this = normalized this
Definition: Vec3.h:328
const SecondMapType & secondMap() const
Definition: Maps.h:2641
MapBase::Ptr postTranslate(const Vec3d &t) const
Return a MapBase::Ptr to a new map that is the result of postfixing the appropiate operation to the l...
Definition: Maps.h:2440
MapBase::Ptr preScale(const Vec3d &s) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation...
Definition: Maps.h:599
boost::shared_ptr< const AffineMap > ConstPtr
Definition: Maps.h:327
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:1851
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:1296
Vec3d voxelSize(const Vec3d &) const
Returns the lengths of the images of the segments , , this is equivalent to the absolute values of t...
Definition: Maps.h:825
AffineMap::Ptr getAffineMap() const
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1103
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const
Return the transpose of the inverse Jacobian (Identity for TranslationMap) of the map applied to in...
Definition: Maps.h:1059
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the linear second map applied to in.
Definition: Maps.h:2174
Vec3d voxelSize(const Vec3d &) const
Return .
Definition: Maps.h:1075
Mat3< T > getMat3() const
Definition: Mat4.h:304
void read(std::istream &is)
read serialization
Definition: Maps.h:550
Mat3< double > Mat3d
Definition: Mat3.h:666
Mat3 transpose() const
returns transpose of this
Definition: Mat3.h:455
Name type() const
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1250
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:1723
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1285
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:1750
Mat4 inverse(T tolerance=0) const
Definition: Mat4.h:492
void setFirstMap(const FirstMapType &first)
Definition: Maps.h:2643
Vec3d voxelSize(const Vec3d &loc) const
Returns the lengths of the images of the three segments from loc to loc + (1,0,0), from loc to loc + (0,1,0) and from loc to loc + (0,0,1)
Definition: Maps.h:2321
Vec3d applyInverseJacobian(const Vec3d &in) const
Return the Inverse Jacobian of the map applied to in. (i.e. inverse map with out translation) ...
Definition: Maps.h:1745
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropriate operation...
Definition: Maps.h:1129
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:97
boost::shared_ptr< UnitaryMap > Ptr
Definition: Maps.h:1622
void setDepth(double d)
set the frustum depth: distance between near and far plane = frustm depth * frustm x-width ...
Definition: Maps.h:2337
bool isLinear() const
Return true (an AffineMap is always linear).
Definition: Maps.h:399
MapBase::Ptr preScale(const Vec3d &v) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation...
Definition: Maps.h:1815
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1287
const Coord & max() const
Definition: Coord.h:258
bool operator==(const ScaleMap &other) const
Definition: Maps.h:857
void write(std::ostream &os) const
write serialization
Definition: Maps.h:838
bool operator==(const ScaleTranslateMap &other) const
Definition: Maps.h:1379
bool isIdentity() const
Return true if the underlying matrix is approximately an identity.
Definition: Maps.h:488
math::BBox< Vec3d > BBoxd
Definition: Types.h:84
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:1016
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:414
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:1377
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1233
const AffineMap & secondMap() const
Return MapBase::Ptr& to the second map.
Definition: Maps.h:2347
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const
Definition: Maps.h:472
boost::shared_ptr< FullyDecomposedMap > createDecomposedMap()
on-demand decomposition of the affine map
Definition: Maps.h:572
AffineMap()
Definition: Maps.h:329
void setMat3(const Mat3< T > &m)
Set upper left to a Mat3.
Definition: Mat4.h:297
void setSecondMap(const SecondMapType &second)
Definition: Maps.h:2644
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &isloc) const
Return the Inverse Jacobian defined at isloc of the map applied to in.
Definition: Maps.h:2117
ScaleTranslateMap(const ScaleTranslateMap &other)
Definition: Maps.h:1218
Mat3d applyIJC(const Mat3d &m) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:469
static Name mapType()
Definition: Maps.h:1251
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation to the ...
Definition: Maps.h:888
CompoundMap(const MyType &other)
Definition: Maps.h:2581
bool isLinear() const
Return true (a ScaleTranslateMap is always linear).
Definition: Maps.h:1254
bool hasUniformScale() const
Return false (by convention false)
Definition: Maps.h:2029
bool hasTranslation(const Mat4< T > &m)
Definition: Mat4.h:1342
const Coord & min() const
Definition: Coord.h:257
double determinant(const Vec3d &) const
Return 1.
Definition: Maps.h:1068
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:1343
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:444
AffineMap::Ptr getAffineMap() const
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1798
bool isLinear() const
Return true (a ScaleMap is always linear).
Definition: Maps.h:740
Mat3d applyIJC(const Mat3d &in) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1764
static bool isRegistered()
Definition: Maps.h:727
Vec3< typename MatType::value_type > getScale(const MatType &mat)
Definition: Mat.h:614
bool operator==(const UnitaryMap &other) const
Definition: Maps.h:1725
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:457
Mat3 inverse(T tolerance=0) const
Definition: Mat3.h:466
double determinant() const
Return the product of the scale values.
Definition: Maps.h:1328
static MapBase::Ptr create()
Return a MapBase::Ptr to a new AffineMap.
Definition: Maps.h:380
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:430
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1041
MapBase::Ptr postTranslate(const Vec3d &t) const
Return a MapBase::Ptr to a new map that is the result of postfixing the appropriate operation...
Definition: Maps.h:1147
T & y()
Definition: Vec3.h:95
UnitaryMap(const UnitaryMap &other)
Definition: Maps.h:1681
void write(std::ostream &os) const
write serialization
Definition: Maps.h:557
AffineMap::Ptr getAffineMap() const
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1390
ScaleMap(const Vec3d &scale)
Definition: Maps.h:694
OPENVDB_API boost::shared_ptr< PolarDecomposedMap > createPolarDecomposedMap(const Mat3d &m)
Decomposes a general linear into translation following polar decomposition.
ScaleTranslateMap(const Vec3d &scale, const Vec3d &translate)
Definition: Maps.h:1190
double determinant() const
Return the product of the scale values.
Definition: Maps.h:807
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:813
SpectralDecomposedMap SymmetricMap
Definition: Maps.h:70
ScaleTranslateMap()
Definition: Maps.h:1179
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &) const
Return the Inverse Jacobian of the map applied to in. (i.e. inverse map with out translation) ...
Definition: Maps.h:774
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: BBox.h:165
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleTranslateMap.
Definition: Maps.h:1231
Vec3d applyInverseJacobian(const Vec3d &in) const
Return the Inverse Jacobian of the map applied to in. (i.e. inverse map with out translation) ...
Definition: Maps.h:2115
static Name mapType()
Definition: Maps.h:1028
boost::shared_ptr< const ScaleTranslateMap > ConstPtr
Definition: Maps.h:1177
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1762
void setTranslation(const Vec3< T > &t)
Definition: Mat4.h:321
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:790
MatType scale(const Vec3< typename MatType::value_type > &scaling)
Definition: Mat.h:595
void write(std::ostream &os) const
write serialization
Definition: Maps.h:2386
double determinant(const Vec3d &loc) const
Definition: Maps.h:2299
std::map< Name, MapBase::MapFactory > MapDictionary
Definition: Maps.h:288
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:788
Threadsafe singleton object for accessing the map type-name dictionary. Associates a map type-name wi...
Definition: Maps.h:285
Definition: Exceptions.h:78
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropriate operation to the ...
Definition: Maps.h:2425
A general linear transform using homogeneous coordinates to perform rotation, scaling, shear and translation.
Definition: Maps.h:323
bool operator==(const MyType &other) const
Definition: Maps.h:2593
Type Round(Type x)
Return x rounded down to the nearest integer.
Definition: Math.h:700
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const
Definition: Maps.h:803
This map is composed of three steps. Frist it will take a box of size (Lx X Ly X Lz) defined by an me...
Definition: Maps.h:1873
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:2078
void write(std::ostream &os) const
write serialization
Definition: Maps.h:1358
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:467
static const Mat4< double > & identity()
Predefined constant for identity matrix.
Definition: Mat4.h:149
bool isDiagonal() const
Definition: Maps.h:2620
const Vec3d & getScale() const
Return the scale values that define the map.
Definition: Maps.h:810
static void registerMap()
Definition: Maps.h:1243
boost::shared_ptr< TranslationMap > Ptr
Definition: Maps.h:1001
Name readString(std::istream &is)
Definition: Name.h:47
Vec3d applyInverseJacobian(const Vec3d &in) const
Return the Inverse Jacobian of the map applied to in. (i.e. inverse map with out translation) ...
Definition: Maps.h:1292
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:1053
boost::shared_ptr< NonlinearFrustumMap > Ptr
Definition: Maps.h:1876
bool isAffine(const Mat4< T > &m)
Definition: Mat4.h:1337
Vec3d voxelSize() const
Return the absolute values of the scale values.
Definition: Maps.h:1330
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation...
Definition: Maps.h:1821
Vec3d voxelSize() const
Returns the lengths of the images of the segments , , .
Definition: Maps.h:1776
UnitaryMap(const UnitaryMap &first, const UnitaryMap &second)
Definition: Maps.h:1687
bool isScaleTranslate() const
Return true if the map is equivalent to a ScaleTranslateMap.
Definition: Maps.h:494
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:1736
boost::shared_ptr< const TranslationMap > ConstPtr
Definition: Maps.h:1002
bool isLinear() const
Return false (a NonlinearFrustumMap is never linear).
Definition: Maps.h:2026
CompoundMap< CompoundMap< UnitaryMap, ScaleMap >, UnitaryMap > SpectralDecomposedMap
Definition: Maps.h:69
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the linear second map applied to in.
Definition: Maps.h:2089
void setToRotation(const Quat< T > &q)
Set this matrix to the rotation matrix specified by the quaternion.
Definition: Mat3.h:270
double determinant() const
Return the determinant of the Jacobian.
Definition: Maps.h:1769
bool isDiagonal(const MatType &mat)
Determine if a matrix is diagonal.
Definition: Mat.h:864
Name type() const
Definition: Maps.h:2587
AffineMap(const AffineMap &first, const AffineMap &second)
constructor that merges the matrixes for two affine maps
Definition: Maps.h:371
MapBase::Ptr preTranslate(const Vec3d &t) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropriate operation to the ...
Definition: Maps.h:2415
boost::shared_ptr< const MyType > ConstPtr
Definition: Maps.h:2571
static bool isEqualBase(const MapT &self, const MapBase &other)
Definition: Maps.h:273
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:1791
boost::shared_ptr< const UnitaryMap > ConstPtr
Definition: Maps.h:1623
bool isInvertible(const MatType &m)
Definition: Mat.h:841
static Name mapType()
Definition: Maps.h:2588
Vec3d asVec3d() const
Definition: Coord.h:136
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:753
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:229
#define OPENVDB_VERSION_NAME
Definition: version.h:45
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:2002
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1760
MapBase::Ptr preTranslate(const Vec3d &t) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropriate operation...
Definition: Maps.h:1122
bool operator!=(const TranslationMap &other) const
Definition: Maps.h:1100
~ScaleTranslateMap()
Definition: Maps.h:1228
void read(std::istream &is)
read serialization
Definition: Maps.h:1780
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1752
double determinant(const Vec3d &) const
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:1767
TranslationMap(const Vec3d &t)
Definition: Maps.h:1006
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation...
Definition: Maps.h:605
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &) const
Return the Inverse Jacobian of the map applied to in. (i.e. inverse map with out translation) ...
Definition: Maps.h:449
MapBase::Ptr preTranslate(const Vec3d &t) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation...
Definition: Maps.h:1809
static Name mapType()
Definition: Maps.h:737
Name type() const
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1027
static void registerMap()
Definition: Maps.h:1020
CompoundMap()
Definition: Maps.h:2574
bool isLinear() const
Return true (a TranslationMap is always linear).
Definition: Maps.h:1031
bool isDiagonal() const
Return true if the underylying matrix is diagonal.
Definition: Maps.h:490
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const
Apply the Jacobian of this map to a vector. For a linear map this is equivalent to applying the map e...
Definition: Maps.h:1738
boost::shared_ptr< MyType > Ptr
Definition: Maps.h:2570
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:780
AffineMap(const Mat4d &m)
Definition: Maps.h:349
boost::shared_ptr< ScaleMap > Ptr
Definition: Maps.h:687
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1043
void setRow(int i, const Vec3< T > &v)
Set ith row to vector v.
Definition: Mat3.h:157
CompoundMap< UnitaryMap, TranslationMap > UnitaryAndTranslationMap
Definition: Maps.h:66
bool isScale() const
Return true if the map is equivalent to a ScaleMap.
Definition: Maps.h:492
OPENVDB_API boost::shared_ptr< FullyDecomposedMap > createFullyDecomposedMap(const Mat4d &m)
General decomposition of a Matrix into a Unitary (e.g. rotation) following a Symmetric (e...
double determinant() const
Return the determinant of the Jacobian of linear second map.
Definition: Maps.h:2295
static bool isRegistered()
Definition: Maps.h:1018
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1304
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian (Identity for TranslationMap) of the map applied to in...
Definition: Maps.h:1062
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:439
const FirstMapType & firstMap() const
Definition: Maps.h:2640
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const
Return a MapBase::Ptr to a new map that is the result of postfixing the appropiate operation to the l...
Definition: Maps.h:2450
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const
Definition: Maps.h:1765
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:761
Vec3d applyInverseJacobian(const Vec3d &in) const
Return the Inverse Jacobian of the map applied to in. (i.e. inverse map with out translation) ...
Definition: Maps.h:776
Vec3d applyIJT(const Vec3d &d1_is, const Vec3d &ijk) const
Definition: Maps.h:2184
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1298
ScaleMap()
Definition: Maps.h:690
boost::shared_ptr< AffineMap > Ptr
Definition: Maps.h:326
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:441
boost::shared_ptr< const NonlinearFrustumMap > ConstPtr
Definition: Maps.h:1877
double determinant() const
Return the determinant of the Jacobian.
Definition: Maps.h:478
A specialized linear transform that performs a unitary maping i.e. rotation and or reflection...
Definition: Maps.h:1619
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:725
static Name mapType()
Return UnitaryMap.
Definition: Maps.h:1715
MapBase::Ptr postTranslate(const Vec3d &t) const
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:1434
T length() const
Length of the vector.
Definition: Vec3.h:208
T & z()
Definition: Vec3.h:96
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:2084
const BBoxd & getBBox() const
Return the bounding box that defines the frustum in pre-image space.
Definition: Maps.h:2344
NonlinearFrustumMap()
Definition: Maps.h:1879
boost::shared_ptr< ScaleTranslateMap > Ptr
Definition: Maps.h:1176
bool operator!=(const UnitaryMap &other) const
Definition: Maps.h:1732
AffineMap::Ptr getAffineMap() const
Definition: Maps.h:2330
void accumPreTranslation(const Vec3d &v)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:511
Mat3d applyIJC(const Mat3d &in) const
Return the Jacobian Curvature for the linear second map.
Definition: Maps.h:2220
AffineMap & operator=(const AffineMap &other)
Definition: Maps.h:426
~AffineMap()
Definition: Maps.h:377
Vec3< double > Vec3d
Definition: Vec3.h:605
static Name mapType()
Definition: Maps.h:396
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:1441
const Mat4d & getConstMat4() const
Definition: Maps.h:645
Vec3d applyInverseJacobian(const Vec3d &in) const
Return the Inverse Jacobian of the map applied to in. (i.e. inverse map with out translation) ...
Definition: Maps.h:1048
Map traits.
Definition: Maps.h:79
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation to the ...
Definition: Maps.h:911
NonlinearFrustumMap(const BBoxd &bb, double taper, double depth, const MapBase::Ptr &secondMap)
Constructor that takes an index-space bounding box to be mapped into a frustum with a given depth and...
Definition: Maps.h:1902
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:1173
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:382
NonlinearFrustumMap(const NonlinearFrustumMap &other)
Definition: Maps.h:1914
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: Coord.h:360
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:1698
AffineMap::Ptr getAffineMap() const
Return a AffineMap equivalent to this map.
Definition: Maps.h:867
std::string str() const
string serialization, useful for debugging
Definition: Maps.h:563
Mat3d applyIJC(const Mat3d &in) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1312
static bool isRegistered()
Definition: Maps.h:2012
void writeString(std::ostream &os, const Name &name)
Definition: Name.h:58
double determinant(const Vec3d &) const
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:476
static void registerMap()
Definition: Maps.h:388
OPENVDB_API boost::shared_ptr< MapBase > simplify(boost::shared_ptr< AffineMap > affine)
reduces an AffineMap to a ScaleMap or a ScaleTranslateMap when it can
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:2051
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &) const
Return the Inverse Jacobian of the map applied to in. (i.e. inverse map with out translation) ...
Definition: Maps.h:1743
bool isIdentity(const MatType &m)
Definition: Mat.h:834
MapBase::Ptr inverseMap() const
Not implemented, since there is currently no map type that can represent the inverse of a frustum...
Definition: Maps.h:2007
void accumPostShear(Axis axis0, Axis axis1, double shear)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:541
MapBase::Ptr postScale(const Vec3d &v) const
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:1845
bool hasUniformScale() const
Return true if the scale values have the same magnitude (eg. -1, 1, -1 would be a rotation)...
Definition: Maps.h:1258
UnitaryMap(const Mat3d &m)
Definition: Maps.h:1644
void setCol(int j, const Vec3< T > &v)
Set jth column to vector v.
Definition: Mat3.h:175
void accumPreScale(const Vec3d &v)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:506
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of under the map.
Definition: Maps.h:1276
void write(std::ostream &os) const
write serialization
Definition: Maps.h:1786
CompoundMap< SymmetricMap, UnitaryMap > PolarDecomposedMap
Definition: Maps.h:72
Definition: version.h:105
void read(std::istream &is)
Definition: Maps.h:2646
~ScaleMap()
Definition: Maps.h:718
Vec3d voxelSize() const
Return the size of a voxel at the center of the near plane.
Definition: Maps.h:2307
Mat3d applyIJC(const Mat3d &mat) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1064
AffineMap(const AffineMap &other)
Definition: Maps.h:358
Definition: Exceptions.h:84
static MapBase::Ptr create()
Return a MapBase::Ptr to a new UnitaryMap.
Definition: Maps.h:1694
const Mat3d & getConstJacobianInv() const
Definition: Maps.h:646
Definition: Exceptions.h:82
const Vec3d & getScale() const
Returns the scale values.
Definition: Maps.h:1336
double getGamma() const
Definition: Maps.h:2341
void read(std::istream &is)
read serialization
Definition: Maps.h:1348
void read(std::istream &is)
read serialization
Definition: Maps.h:1080
bool isApproxEqual(const Hermite &lhs, const Hermite &rhs)
Definition: Hermite.h:470
bool operator==(const TranslationMap &other) const
Definition: Maps.h:1094
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1014
static void registerMap()
Definition: Maps.h:729
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:635
T * asPointer()
Definition: Vec3.h:103
UnitaryMap()
default constructor makes an Idenity.
Definition: Maps.h:1626
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:684
bool operator==(const NonlinearFrustumMap &other) const
Definition: Maps.h:2053
Int32 ValueType
Definition: Coord.h:55
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:782
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:1345
double getDepth() const
Return the unscaled frustm depth.
Definition: Maps.h:2339
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1740
NonlinearFrustumMap(const BBoxd &bb, double taper, double depth)
Constructor that takes an index-space bounding box to be mapped into a frustum with a given depth and...
Definition: Maps.h:1891
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:815
AffineMap::Ptr inverse() const
Return AffineMap::Ptr to the inverse of this map.
Definition: Maps.h:581
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:465
AffineMap(const Mat3d &m)
Definition: Maps.h:341
void accumPostTranslation(const Vec3d &v)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:536
ScaleTranslateMap(const ScaleMap &scale, const TranslationMap &translate)
Definition: Maps.h:1205
CompoundMap(const FirstMapType &f, const SecondMapType &s)
Definition: Maps.h:2576
void accumPreShear(Axis axis0, Axis axis1, double shear)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:516
MapBase::Ptr copy() const
Returns a MapBase::Ptr to a deep copy of *this.
Definition: Maps.h:1696
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:1734
bool operator!=(const ScaleTranslateMap &other) const
Definition: Maps.h:1387
Name type() const
Return NonlinearFrustumMap.
Definition: Maps.h:2021
Axis
Definition: Math.h:769
CompoundMap< FirstMapType, SecondMapType > MyType
Definition: Maps.h:2568
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const
Return a MapBase::Ptr to a new map that is the result of postfixing the appropriate operation...
Definition: Maps.h:1154
Creates the composition of two maps, each of which could be a composition. In the case that each comp...
Definition: Maps.h:66
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:817
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:847
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const
Definition: Maps.h:1323
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:67
bool hasSimpleAffine() const
Return true if the second map is a uniform scale, Rotation and translation.
Definition: Maps.h:2353
CompoundMap< SymmetricMap, UnitaryAndTranslationMap > FullyDecomposedMap
Definition: Maps.h:71
void read(std::istream &is)
read serialization
Definition: Maps.h:2356
Name type() const
Return UnitaryMap.
Definition: Maps.h:1713
std::string Name
Definition: Name.h:44
MapBase::Ptr preTranslate(const Vec3d &t) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation...
Definition: Maps.h:593
Vec3< T > row(int i) const
Get ith row, e.g. Vec3d v = m.row(1);.
Definition: Mat3.h:168
T & x()
Reference to the component, e.g. v.x() = 4.5f;.
Definition: Vec3.h:94
UnitaryMap(const Mat4d &m)
Definition: Maps.h:1656
OPENVDB_API Mat4d approxInverse(const Mat4d &mat)
Returns the left pseudoInverse of the input matrix when the 3x3 part is symmetric otherwise it zeros ...
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:1085
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleMap.
Definition: Maps.h:721
MapBase::Ptr postScale(const Vec3d &s) const
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:629
bool isType() const
Return true if this map is of concrete type MapT (e.g., AffineMap).
Definition: Maps.h:173
bool hasUniformScale() const
Return false ( test if this is unitary with translation )
Definition: Maps.h:402
static bool isRegistered()
Definition: Maps.h:1703
void read(std::istream &is)
read serialization
Definition: Maps.h:829
AffineMap::Ptr getAffineMap() const
Definition: Maps.h:2628
MapBase::Ptr postTranslate(const Vec3d &t) const
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:623
MapBase::Ptr postTranslate(const Vec3d &t) const
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:1839
MapBase::Ptr preTranslate(const Vec3d &t) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation...
Definition: Maps.h:1406
Abstract base class for maps.
Definition: Maps.h:158
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:384
bool operator!=(const MyType &other) const
Definition: Maps.h:2601
Name type() const
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:395
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1055
boost::shared_ptr< MapBase > Ptr
Definition: Maps.h:161
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:1039
T dot(const Vec3< T > &v) const
Dot product.
Definition: Vec3.h:199
static bool isRegistered()
Definition: Maps.h:1241
Vec3< T > col(int j) const
Get jth column, e.g. Vec3d v = m.col(0);.
Definition: Mat3.h:184
double determinant(const Vec3d &) const
Return the product of the scale values, ignores argument.
Definition: Maps.h:1326
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &) const
Return the Inverse Jacobian of the map applied to in. (i.e. inverse map with out translation) ...
Definition: Maps.h:1290
TranslationMap(const TranslationMap &other)
Definition: Maps.h:1007
ScaleMap(const ScaleMap &other)
Definition: Maps.h:708
MapBase::Ptr postScale(const Vec3d &s) const
Return a MapBase::Ptr to a new map that is the result of postfixing the appropiate operation to the l...
Definition: Maps.h:2445
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1302
bool operator!=(const AffineMap &other) const
Definition: Maps.h:424
void accumPostScale(const Vec3d &v)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:531
void write(std::ostream &os) const
Definition: Maps.h:2652
bool isUnitary(const MatType &m)
Determine is a matrix is Unitary (i.e. rotation or reflection)
Definition: Mat.h:854
OPENVDB_IMPORT uint32_t getFormatVersion(std::istream &)
Return the file format version number associated with the given input stream.
double determinant(const Vec3d &) const
Return the product of the scale values, ignores argument.
Definition: Maps.h:805
const Vec3d & getTranslation() const
Returns the translation.
Definition: Maps.h:1338
Vec3d voxelSize(const Vec3d &) const
Method to return the local size of a voxel. When a location is specified as an argument, it is understood to be be in the domain of the map (i.e. index space)
Definition: Maps.h:1777
static void registerMap()
Definition: Maps.h:1705
static void registerMap()
Definition: Maps.h:2014
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:769
~TranslationMap()
Definition: Maps.h:1009
MatType shear(Axis axis0, Axis axis1, typename MatType::value_type shear)
Set the matrix to a shear along axis0 by a fraction of axis1.
Definition: Mat.h:669
Vec3d voxelSize(const Vec3d &) const
Definition: Maps.h:1333
T det() const
Determinant of matrix.
Definition: Mat3.h:481
MapBase()
Definition: Maps.h:270
bool isLinear() const
Return true (a UnitaryMap is always linear).
Definition: Maps.h:1718
~UnitaryMap()
Definition: Maps.h:1692
bool hasUniformScale() const
Return true if the values have the same magitude (eg. -1, 1, -1 would be a rotation).
Definition: Maps.h:743
Vec3d voxelSize() const
Return .
Definition: Maps.h:1073
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:1092
Name type() const
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:736
bool operator!=(const ScaleMap &other) const
Definition: Maps.h:864
AffineMap::Ptr getAffineMap() const
Return AffineMap::Ptr to a deep copy of the current AffineMap.
Definition: Maps.h:578
static Name mapType()
Return NonlinearFrustumMap.
Definition: Maps.h:2023
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:455
MapBase::Ptr preScale(const Vec3d &s) const
Return a MapBase::Ptr to a new map that is the result of prepending the appropriate operation to the ...
Definition: Maps.h:2420
Vec3d applyJT(const Vec3d &in, const Vec3d &isloc) const
Definition: Maps.h:2147
A specialized linear transform that performs a translation.
Definition: Maps.h:998
const Vec3d & getTranslation() const
Return the translation vector.
Definition: Maps.h:1078
bool isIdentity() const
Return true if the map is equivalent to an identity.
Definition: Maps.h:2032
NonlinearFrustumMap(const Vec3d &position, const Vec3d &direction, const Vec3d &up, double aspect, double z_near, double depth, Coord::ValueType x_count, Coord::ValueType z_count)
Constructor from a camera frustum.
Definition: Maps.h:1940