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;
943 const Vec3d& invScale = getInvScale();
946 static bool isRegistered() {
return MapRegistry::isRegistered(UniformScaleMap::mapType()); }
949 MapRegistry::registerMap(
950 UniformScaleMap::mapType(),
951 UniformScaleMap::create);
957 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
977 ScaleMap::preScale(
const Vec3d& v)
const
979 const Vec3d new_scale(v * mScaleValues);
989 ScaleMap::postScale(
const Vec3d& v)
const
999 typedef boost::shared_ptr<TranslationMap>
Ptr;
1000 typedef boost::shared_ptr<const TranslationMap>
ConstPtr;
1016 static bool isRegistered() {
return MapRegistry::isRegistered(TranslationMap::mapType()); }
1020 MapRegistry::registerMap(
1021 TranslationMap::mapType(),
1022 TranslationMap::create);
1078 void read(std::istream& is) { mTranslation.read(is); }
1080 void write(std::ostream& os)
const { mTranslation.write(os); }
1085 std::ostringstream buffer;
1086 buffer <<
" - translation: " << mTranslation << std::endl;
1087 return buffer.str();
1090 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
1095 return mTranslation.eq(other.mTranslation);
1116 affineMap->accumPreRotation(axis, radians);
1130 affineMap->accumPreShear(axis0, axis1, shear);
1141 affineMap->accumPostRotation(axis, radians);
1155 affineMap->accumPostShear(axis0, axis1, shear);
1174 typedef boost::shared_ptr<ScaleTranslateMap>
Ptr;
1175 typedef boost::shared_ptr<const ScaleTranslateMap>
ConstPtr;
1179 mTranslation(
Vec3d(0,0,0)),
1180 mScaleValues(
Vec3d(1,1,1)),
1181 mVoxelSize(
Vec3d(1,1,1)),
1182 mScaleValuesInverse(
Vec3d(1,1,1)),
1183 mInvScaleSqr(1,1,1),
1184 mInvTwiceScale(0.5,0.5,0.5)
1190 mTranslation(translate),
1191 mScaleValues(scale),
1192 mVoxelSize(std::abs(scale(0)), std::abs(scale(1)), std::abs(scale(2)))
1194 const double determinant = scale[0]* scale[1] * scale[2];
1198 mScaleValuesInverse = 1.0 / mScaleValues;
1199 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1200 mInvTwiceScale = mScaleValuesInverse / 2;
1205 mTranslation(translate.getTranslation()),
1207 mVoxelSize(std::abs(mScaleValues(0)),
1208 std::abs(mScaleValues(1)),
1209 std::abs(mScaleValues(2))),
1210 mScaleValuesInverse(1.0 / scale.
getScale())
1212 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1213 mInvTwiceScale = mScaleValuesInverse / 2;
1218 mTranslation(other.mTranslation),
1219 mScaleValues(other.mScaleValues),
1220 mVoxelSize(other.mVoxelSize),
1221 mScaleValuesInverse(other.mScaleValuesInverse),
1222 mInvScaleSqr(other.mInvScaleSqr),
1223 mInvTwiceScale(other.mInvTwiceScale)
1236 mScaleValuesInverse, -mScaleValuesInverse * mTranslation));
1239 static bool isRegistered() {
return MapRegistry::isRegistered(ScaleTranslateMap::mapType()); }
1243 MapRegistry::registerMap(
1244 ScaleTranslateMap::mapType(),
1245 ScaleTranslateMap::create);
1259 std::abs(mScaleValues.x()), std::abs(mScaleValues.y()),
double(5e-7));
1261 std::abs(mScaleValues.x()), std::abs(mScaleValues.z()),
double(5e-7));
1269 in.
x() * mScaleValues.x() + mTranslation.x(),
1270 in.
y() * mScaleValues.y() + mTranslation.y(),
1271 in.
z() * mScaleValues.z() + mTranslation.z());
1277 (in.
x() - mTranslation.x() ) / mScaleValues.x(),
1278 (in.
y() - mTranslation.y() ) / mScaleValues.y(),
1279 (in.
z() - mTranslation.z() ) / mScaleValues.z());
1305 in.
x() / mScaleValues.x(),
1306 in.
y() / mScaleValues.y(),
1307 in.
z() / mScaleValues.z());
1313 for (
int i=0; i<3; i++){
1314 tmp.
setRow(i, in.
row(i)*mScaleValuesInverse(i));
1316 for (
int i=0; i<3; i++){
1317 tmp.
setCol(i, tmp.
col(i)*mScaleValuesInverse(i));
1326 double determinant()
const {
return mScaleValues.x()*mScaleValues.y()*mScaleValues.z(); }
1348 mTranslation.read(is);
1349 mScaleValues.read(is);
1350 mVoxelSize.read(is);
1351 mScaleValuesInverse.read(is);
1352 mInvScaleSqr.read(is);
1353 mInvTwiceScale.read(is);
1358 mTranslation.write(os);
1359 mScaleValues.write(os);
1360 mVoxelSize.write(os);
1361 mScaleValuesInverse.write(os);
1362 mInvScaleSqr.write(os);
1363 mInvTwiceScale.write(os);
1368 std::ostringstream buffer;
1369 buffer <<
" - translation: " << mTranslation << std::endl;
1370 buffer <<
" - scale: " << mScaleValues << std::endl;
1371 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
1372 return buffer.str();
1375 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
1380 if (!mScaleValues.eq(other.mScaleValues)) {
return false; }
1381 if (!mTranslation.eq(other.mTranslation)) {
return false; }
1391 affineMap->accumPostTranslation(mTranslation);
1401 affineMap->accumPreRotation(axis, radians);
1406 const Vec3d& s = mScaleValues;
1407 const Vec3d scaled_trans( t.
x() * s.
x(),
1418 affineMap->accumPreShear(axis0, axis1, shear);
1429 affineMap->accumPostRotation(axis, radians);
1442 affineMap->accumPostShear(axis0, axis1, shear);
1448 Vec3d mTranslation, mScaleValues, mVoxelSize, mScaleValuesInverse,
1449 mInvScaleSqr, mInvTwiceScale;
1454 ScaleMap::postTranslate(
const Vec3d& t)
const
1461 ScaleMap::preTranslate(
const Vec3d& t)
const
1464 const Vec3d& s = mScaleValues;
1465 const Vec3d scaled_trans( t.
x() * s.
x(),
1477 typedef boost::shared_ptr<UniformScaleTranslateMap>
Ptr;
1478 typedef boost::shared_ptr<const UniformScaleTranslateMap>
ConstPtr;
1496 const Vec3d& scaleInv = getInvScale();
1497 const Vec3d& trans = getTranslation();
1503 return MapRegistry::isRegistered(UniformScaleTranslateMap::mapType());
1508 MapRegistry::registerMap(
1509 UniformScaleTranslateMap::mapType(),
1510 UniformScaleTranslateMap::create);
1516 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
1529 const Vec3d new_trans = this->getTranslation() + scale * t;
1544 UniformScaleMap::postTranslate(
const Vec3d& t)
const
1552 UniformScaleMap::preTranslate(
const Vec3d& t)
const
1560 TranslationMap::preScale(
const Vec3d& v)
const
1571 TranslationMap::postScale(
const Vec3d& v)
const
1576 const Vec3d trans(mTranslation.x()*v.
x(),
1577 mTranslation.y()*v.
y(),
1578 mTranslation.z()*v.
z());
1585 ScaleTranslateMap::preScale(
const Vec3d& v)
const
1587 const Vec3d new_scale( v * mScaleValues );
1597 ScaleTranslateMap::postScale(
const Vec3d& v)
const
1599 const Vec3d new_scale( v * mScaleValues );
1600 const Vec3d new_trans( mTranslation.x()*v.
x(),
1601 mTranslation.y()*v.
y(),
1602 mTranslation.z()*v.
z() );
1620 typedef boost::shared_ptr<UnitaryMap>
Ptr;
1658 "4x4 Matrix initializing unitary map was not unitary: not invertible");
1663 "4x4 Matrix initializing unitary map was not unitary: not affine");
1668 "4x4 Matrix initializing unitary map was not unitary: had translation");
1673 "4x4 Matrix initializing unitary map was not unitary");
1681 mAffineMap(other.mAffineMap)
1686 mAffineMap(*(first.getAffineMap()), *(second.getAffineMap()))
1701 static bool isRegistered() {
return MapRegistry::isRegistered(UnitaryMap::mapType()); }
1705 MapRegistry::registerMap(
1706 UnitaryMap::mapType(),
1707 UnitaryMap::create);
1721 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
1726 if (mAffineMap!=other.mAffineMap)
return false;
1752 return applyInverseMap(in);
1780 mAffineMap.read(is);
1786 mAffineMap.write(os);
1791 std::ostringstream buffer;
1792 buffer << mAffineMap.str();
1793 return buffer.str();
1810 affineMap->accumPreTranslation(t);
1816 affineMap->accumPreScale(v);
1822 affineMap->accumPreShear(axis0, axis1, shear);
1840 affineMap->accumPostTranslation(t);
1846 affineMap->accumPostScale(v);
1852 affineMap->accumPostShear(axis0, axis1, shear);
1874 typedef boost::shared_ptr<NonlinearFrustumMap>
Ptr;
1875 typedef boost::shared_ptr<const NonlinearFrustumMap>
ConstPtr;
1890 MapBase(),mBBox(bb), mTaper(taper), mDepth(depth)
1902 mBBox(bb), mTaper(taper), mDepth(depth)
1904 if (!secondMap->isLinear() ) {
1906 "The second map in the Frustum transfrom must be linear");
1908 mSecondMap = *( secondMap->getAffineMap() );
1915 mTaper(other.mTaper),
1916 mDepth(other.mDepth),
1917 mSecondMap(other.mSecondMap),
1918 mHasSimpleAffine(other.mHasSimpleAffine)
1939 const Vec3d& direction,
1942 double z_near,
double depth,
1950 "The frustum depth must be non-zero and positive");
1952 if (!(up.
length() > 0)) {
1954 "The frustum height must be non-zero and positive");
1956 if (!(aspect > 0)) {
1958 "The frustum aspect ratio must be non-zero and positive");
1962 "The frustum up orientation must be perpendicular to into-frustum direction");
1965 double near_plane_height = 2 * up.
length();
1966 double near_plane_width = aspect * near_plane_height;
1971 mDepth = depth / near_plane_width;
1972 double gamma = near_plane_width / z_near;
1973 mTaper = 1./(mDepth*gamma + 1.);
1975 Vec3d direction_unit = direction;
1984 Vec3d(near_plane_width, near_plane_width, near_plane_width));
1988 Mat4d mat = scale * r2 * r1;
2008 "inverseMap() is not implemented for NonlinearFrustumMap");
2010 static bool isRegistered() {
return MapRegistry::isRegistered(NonlinearFrustumMap::mapType()); }
2014 MapRegistry::registerMap(
2015 NonlinearFrustumMap::mapType(),
2016 NonlinearFrustumMap::create);
2037 const Vec3d e1(1,0,0);
2038 if (!applyMap(e1).eq(e1))
return false;
2040 const Vec3d e2(0,1,0);
2041 if (!applyMap(e2).eq(e2))
return false;
2043 const Vec3d e3(0,0,1);
2044 if (!applyMap(e3).eq(e3))
return false;
2049 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
2053 if (mBBox!=other.mBBox)
return false;
2060 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2063 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2066 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2069 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2078 return mSecondMap.applyMap(applyFrustumMap(in));
2084 return applyFrustumInverseMap(mSecondMap.applyInverseMap(in));
2093 Vec3d centered(isloc);
2094 centered = centered - mBBox.min();
2095 centered.
x() -= mXo;
2096 centered.
y() -= mYo;
2099 const double zprime = centered.
z()*mDepthOnLz;
2101 const double scale = (mGamma * zprime + 1.) / mLx;
2102 const double scale2 = mGamma * mDepthOnLz / mLx;
2104 const Vec3d tmp(scale * in.
x() + scale2 * centered.
x()* in.
z(),
2105 scale * in.
y() + scale2 * centered.
y()* in.
z(),
2106 mDepthOnLz * in.
z());
2108 return mSecondMap.applyJacobian(tmp);
2119 Vec3d centered(isloc);
2120 centered = centered - mBBox.min();
2121 centered.
x() -= mXo;
2122 centered.
y() -= mYo;
2125 const double zprime = centered.
z()*mDepthOnLz;
2127 const double scale = (mGamma * zprime + 1.) / mLx;
2128 const double scale2 = mGamma * mDepthOnLz / mLx;
2131 Vec3d out = mSecondMap.applyInverseJacobian(in);
2133 out.
x() = (out.
x() - scale2 * centered.
x() * out.
z() / mDepthOnLz) / scale;
2134 out.
y() = (out.
y() - scale2 * centered.
y() * out.
z() / mDepthOnLz) / scale;
2135 out.
z() = out.
z() / mDepthOnLz;
2146 const Vec3d tmp = mSecondMap.applyJT(in);
2149 Vec3d centered(isloc);
2150 centered = centered - mBBox.min();
2151 centered.
x() -= mXo;
2152 centered.
y() -= mYo;
2155 const double zprime = centered.
z()*mDepthOnLz;
2157 const double scale = (mGamma * zprime + 1.) / mLx;
2158 const double scale2 = mGamma * mDepthOnLz / mLx;
2160 return Vec3d(scale * tmp.
x(),
2162 scale2 * centered.
x()* tmp.
x() +
2163 scale2 * centered.
y()* tmp.
y() +
2164 mDepthOnLz * tmp.
z());
2168 return mSecondMap.applyJT(in);
2184 const Vec3d loc = applyFrustumMap(ijk);
2185 const double s = mGamma * loc.
z() + 1.;
2190 " at the singular focal point (e.g. camera)");
2193 const double sinv = 1.0/s;
2194 const double pt0 = mLx * sinv;
2195 const double pt1 = mGamma * pt0;
2196 const double pt2 = pt1 * sinv;
2198 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2201 Mat3d gradE(Mat3d::zero());
2202 for (
int j = 0; j < 3; ++j ) {
2203 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2204 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2205 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2209 for (
int i = 0; i < 3; ++i) {
2210 result(0) = d1_is(0) * gradE(0,i) + d1_is(1) * gradE(1,i) + d1_is(2) * gradE(2,i);
2225 const Vec3d loc = applyFrustumMap(ijk);
2227 const double s = mGamma * loc.
z() + 1.;
2232 " at the singular focal point (e.g. camera)");
2236 const double sinv = 1.0/s;
2237 const double pt0 = mLx * sinv;
2238 const double pt1 = mGamma * pt0;
2239 const double pt2 = pt1 * sinv;
2240 const double pt3 = pt2 * sinv;
2242 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2246 Mat3d matE0(Mat3d::zero());
2247 Mat3d matE1(Mat3d::zero());
2248 for(
int j = 0; j < 3; j++) {
2249 for (
int k = 0; k < 3; k++) {
2251 const double pt4 = 2. * jacinv(2,j) * jacinv(2,k) * pt3;
2253 matE0(j,k) = -(jacinv(0,j) * jacinv(2,k) + jacinv(2,j) * jacinv(0,k)) * pt2 +
2256 matE1(j,k) = -(jacinv(1,j) * jacinv(2,k) + jacinv(2,j) * jacinv(1,k)) * pt2 +
2262 Mat3d gradE(Mat3d::zero());
2263 for (
int j = 0; j < 3; ++j ) {
2264 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2265 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2266 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2269 Mat3d result(Mat3d::zero());
2272 for (
int m = 0; m < 3; ++m ) {
2273 for (
int n = 0; n < 3; ++n) {
2274 for (
int i = 0; i < 3; ++i ) {
2275 for (
int j = 0; j < 3; ++j) {
2276 result(m, n) += gradE(j, m) * gradE(i, n) * d2_is(i, j);
2282 for (
int m = 0; m < 3; ++m ) {
2283 for (
int n = 0; n < 3; ++n) {
2285 matE0(m, n) * d1_is(0) + matE1(m, n) * d1_is(1);
2299 double s = mGamma * loc.
z() + 1.0;
2300 double frustum_determinant = s * s * mDepthOnLzLxLx;
2301 return mSecondMap.determinant() * frustum_determinant;
2307 const Vec3d loc( 0.5*(mBBox.min().x() + mBBox.max().x()),
2308 0.5*(mBBox.min().y() + mBBox.max().y()),
2311 return voxelSize(loc);
2321 Vec3d out, pos = applyMap(loc);
2322 out(0) = (applyMap(loc +
Vec3d(1,0,0)) - pos).length();
2323 out(1) = (applyMap(loc +
Vec3d(0,1,0)) - pos).length();
2324 out(2) = (applyMap(loc +
Vec3d(0,0,1)) - pos).length();
2365 is.read(reinterpret_cast<char*>(&mTaper),
sizeof(
double));
2366 is.read(reinterpret_cast<char*>(&mDepth),
sizeof(
double));
2372 if(!MapRegistry::isRegistered(type)) {
2377 MapBase::Ptr proxy = math::MapRegistry::createMap(type);
2379 mSecondMap = *(proxy->getAffineMap());
2387 os.write(reinterpret_cast<const char*>(&mTaper),
sizeof(
double));
2388 os.write(reinterpret_cast<const char*>(&mDepth),
sizeof(
double));
2391 mSecondMap.write(os);
2397 std::ostringstream buffer;
2398 buffer <<
" - taper: " << mTaper << std::endl;
2399 buffer <<
" - depth: " << mDepth << std::endl;
2400 buffer <<
" SecondMap: "<< mSecondMap.type() << std::endl;
2401 buffer << mSecondMap.str() << std::endl;
2402 return buffer.str();
2426 mBBox, mTaper, mDepth, mSecondMap.preShear(shear, axis0, axis1)));
2451 mBBox, mTaper, mDepth, mSecondMap.postShear(shear, axis0, axis1)));
2459 mLx = mBBox.extents().x();
2460 mLy = mBBox.extents().y();
2461 mLz = mBBox.extents().z();
2465 " must have at least two index points in each direction.");
2472 mGamma = (1./mTaper - 1) / mDepth;
2474 mDepthOnLz = mDepth/mLz;
2475 mDepthOnLzLxLx = mDepthOnLz/(mLx * mLx);
2478 mHasSimpleAffine =
true;
2479 Vec3d tmp = mSecondMap.voxelSize();
2482 if (!
isApproxEqual(tmp(0), tmp(1))) { mHasSimpleAffine =
false;
return; }
2483 if (!
isApproxEqual(tmp(0), tmp(2))) { mHasSimpleAffine =
false;
return; }
2485 Vec3d trans = mSecondMap.applyMap(
Vec3d(0,0,0));
2487 Vec3d tmp1 = mSecondMap.applyMap(
Vec3d(1,0,0)) - trans;
2488 Vec3d tmp2 = mSecondMap.applyMap(
Vec3d(0,1,0)) - trans;
2489 Vec3d tmp3 = mSecondMap.applyMap(
Vec3d(0,0,1)) - trans;
2492 if (!
isApproxEqual(tmp1.dot(tmp2), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2493 if (!
isApproxEqual(tmp2.dot(tmp3), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2494 if (!
isApproxEqual(tmp3.dot(tmp1), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2503 out = out - mBBox.min();
2508 out.z() *= mDepthOnLz;
2510 double scale = (mGamma * out.z() + 1.)/ mLx;
2519 Vec3d applyFrustumInverseMap(
const Vec3d& in)
const
2523 double invScale = mLx / (mGamma * out.z() + 1.);
2524 out.x() *= invScale;
2525 out.y() *= invScale;
2530 out.z() /= mDepthOnLz;
2533 out = out + mBBox.min();
2545 AffineMap mSecondMap;
2548 double mLx, mLy, mLz;
2549 double mXo, mYo, mGamma, mDepthOnLz, mDepthOnLzLxLx;
2552 bool mHasSimpleAffine;
2562 template<
typename FirstMapType,
typename SecondMapType>
2568 typedef boost::shared_ptr<MyType>
Ptr;
2574 CompoundMap(
const FirstMapType& f,
const SecondMapType& s): mFirstMap(f), mSecondMap(s)
2576 updateAffineMatrix();
2580 mFirstMap(other.mFirstMap),
2581 mSecondMap(other.mSecondMap),
2582 mAffineMap(other.mAffineMap)
2588 return (FirstMapType::mapType() +
Name(
":") + SecondMapType::mapType());
2593 if (mFirstMap != other.mFirstMap)
return false;
2594 if (mSecondMap != other.mSecondMap)
return false;
2595 if (mAffineMap != other.mAffineMap)
return false;
2603 mFirstMap = other.mFirstMap;
2604 mSecondMap = other.mSecondMap;
2605 mAffineMap = other.mAffineMap;
2612 return mAffineMap.isIdentity();
2614 return mFirstMap.isIdentity()&&mSecondMap.isIdentity();
2620 return mAffineMap.isDiagonal();
2622 return mFirstMap.isDiagonal()&&mSecondMap.isDiagonal();
2633 "Constant affine matrix representation not possible for this nonlinear map");
2638 const FirstMapType&
firstMap()
const {
return mFirstMap; }
2639 const SecondMapType&
secondMap()
const {
return mSecondMap; }
2641 void setFirstMap(
const FirstMapType& first) { mFirstMap = first; updateAffineMatrix(); }
2642 void setSecondMap(
const SecondMapType& second) { mSecondMap = second; updateAffineMatrix(); }
2646 mAffineMap.read(is);
2648 mSecondMap.read(is);
2652 mAffineMap.write(os);
2653 mFirstMap.write(os);
2654 mSecondMap.write(os);
2658 void updateAffineMatrix()
2664 mAffineMap =
AffineMap(*first, *second);
2668 FirstMapType mFirstMap;
2669 SecondMapType mSecondMap;
2671 AffineMap mAffineMap;
2678 #endif // OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED
AffineMap()
Definition: Maps.h:329
static MapBase::Ptr create()
Return a MapBase::Ptr to a new UnitaryMap.
Definition: Maps.h:1692
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:1721
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1750
Vec3d applyJacobian(const Vec3d &in, const Vec3d &isloc) const
Return the Jacobian defined at isloc applied to in.
Definition: Maps.h:2089
boost::shared_ptr< const MapBase > ConstPtr
Definition: Maps.h:162
bool isIdentity() const
Return true if the map is equivalent to an identity.
Definition: Maps.h:2030
const Vec3d & getTranslation() const
Return the translation vector.
Definition: Maps.h:1076
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:1035
virtual ~MapBase()
Definition: Maps.h:165
boost::shared_ptr< UnitaryMap > Ptr
Definition: Maps.h:1620
bool isValid() const
Definition: Maps.h:2348
Name type() const
Return UnitaryMap.
Definition: Maps.h:1711
Mat3d applyIJC(const Mat3d &mat, const Vec3d &, const Vec3d &) const
Definition: Maps.h:1063
Vec3d voxelSize() const
Return the absolute values of the scale values.
Definition: Maps.h:1328
void setTaper(double t)
set the taper value, the ratio of nearplane width / far plane width
Definition: Maps.h:2331
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:1819
~AffineMap()
Definition: Maps.h:377
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:771
Vec3d voxelSize(const Vec3d &) const
Definition: Maps.h:1331
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:1741
static MapBase::Ptr create()
Return a MapBase::Ptr to a new TranslationMap.
Definition: Maps.h:1010
UnitaryMap(const UnitaryMap &first, const UnitaryMap &second)
Definition: Maps.h:1685
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
TranslationMap()
Definition: Maps.h:1003
Mat3d applyIJC(const Mat3d &d2_is, const Vec3d &d1_is, const Vec3d &ijk) const
Definition: Maps.h:2223
const SecondMapType & secondMap() const
Definition: Maps.h:2639
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
static MapBase::Ptr create()
Return a MapBase::Ptr to a new NonlinearFrustumMap.
Definition: Maps.h:1998
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:1044
boost::shared_ptr< const MyType > ConstPtr
Definition: Maps.h:2569
OPENVDB_API boost::shared_ptr< PolarDecomposedMap > createPolarDecomposedMap(const Mat3d &m)
Decomposes a general linear into translation following polar decomposition.
void write(std::ostream &os) const
write serialization
Definition: Maps.h:1080
bool hasUniformScale() const
Return true if the scale values have the same magnitude (eg. -1, 1, -1 would be a rotation)...
Definition: Maps.h:1256
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:1837
double determinant() const
Return the determinant of the Jacobian.
Definition: Maps.h:1767
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: Coord.h:360
double getTaper() const
Return the taper value.
Definition: Maps.h:2333
void setCol(int j, const Vec3< T > &v)
Set jth column to vector v.
Definition: Mat3.h:175
bool hasUniformScale() const
Return false (by convention true)
Definition: Maps.h:1032
Name type() const
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1248
Map traits.
Definition: Maps.h:79
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:2438
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the second map applied to in.
Definition: Maps.h:2167
CompoundMap()
Definition: Maps.h:2572
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
const Vec3d & getScale() const
Returns the scale values.
Definition: Maps.h:1334
void write(std::ostream &os) const
write serialization
Definition: Maps.h:838
const MapT & mMap
Definition: GridOperators.h:260
Vec3d voxelSize(const Vec3d &) const
Return .
Definition: Maps.h:1073
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:444
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the linear second map applied to in.
Definition: Maps.h:2172
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:723
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:1375
A specialized linear transform that performs a unitary maping i.e. rotation and or reflection...
Definition: Maps.h:1617
~NonlinearFrustumMap()
Definition: Maps.h:1996
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:684
Vec3d asVec3d() const
Definition: Coord.h:136
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:1233
static Name mapType()
Return UnitaryMap.
Definition: Maps.h:1713
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:1415
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:1734
Mat3d applyIJC(const Mat3d &in) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:792
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:1127
T length() const
Length of the vector.
Definition: Vec3.h:208
T & z()
Definition: Vec3.h:96
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:1343
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:1843
void setRow(int i, const Vec3< T > &v)
Set ith row to vector v.
Definition: Mat3.h:157
const Mat3d & getConstJacobianInv() const
Definition: Maps.h:646
UnitaryMap(const Mat3d &m)
Definition: Maps.h:1642
bool operator!=(const UnitaryMap &other) const
Definition: Maps.h:1730
void setDepth(double d)
set the frustum depth: distance between near and far plane = frustm depth * frustm x-width ...
Definition: Maps.h:2335
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:1101
static Name mapType()
Definition: Maps.h:1249
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
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:1057
bool isLinear() const
Return true (a ScaleTranslateMap is always linear).
Definition: Maps.h:1252
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:97
Mat3< double > Mat3d
Definition: Mat3.h:666
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:1366
ScaleTranslateMap(const ScaleMap &scale, const TranslationMap &translate)
Definition: Maps.h:1203
const AffineMap & secondMap() const
Return MapBase::Ptr& to the second map.
Definition: Maps.h:2345
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:2115
double determinant() const
Return the product of the scale values.
Definition: Maps.h:1326
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:2319
Definition: Exceptions.h:78
double determinant(const Vec3d &) const
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:1765
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
AffineMap::Ptr getAffineMap() const
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1388
AffineMap & operator=(const AffineMap &other)
Definition: Maps.h:426
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const
Definition: Maps.h:1321
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:455
ScaleMap(const Vec3d &scale)
Definition: Maps.h:694
ScaleTranslateMap(const Vec3d &scale, const Vec3d &translate)
Definition: Maps.h:1188
double determinant() const
Return the product of the scale values.
Definition: Maps.h:807
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:467
bool isDiagonal(const MatType &mat)
Determine if a matrix is diagonal.
Definition: Mat.h:864
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:1014
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
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleTranslateMap.
Definition: Maps.h:1229
bool isLinear() const
Return true (a ScaleMap is always linear).
Definition: Maps.h:740
static bool isRegistered()
Definition: Maps.h:727
void write(std::ostream &os) const
write serialization
Definition: Maps.h:557
static bool isRegistered()
Definition: Maps.h:1701
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:414
std::string str() const
string serialization, useful for debugging
Definition: Maps.h:563
bool hasTranslation(const Mat4< T > &m)
Definition: Mat4.h:1342
boost::shared_ptr< ScaleTranslateMap > Ptr
Definition: Maps.h:1174
bool isIdentity(const MatType &m)
Definition: Mat.h:834
bool isDiagonal() const
Definition: Maps.h:2618
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:1404
bool operator!=(const MyType &other) const
Definition: Maps.h:2599
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1285
bool operator==(const ScaleMap &other) const
Definition: Maps.h:857
Tolerance for floating-point comparison.
Definition: Math.h:116
void write(std::ostream &os) const
write serialization
Definition: Maps.h:1356
bool hasUniformScale() const
Return false (by convention true)
Definition: Maps.h:1719
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:1439
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:2113
static void registerMap()
Definition: Maps.h:1241
double determinant(const Vec3d &) const
Return 1.
Definition: Maps.h:1066
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:1732
static Name mapType()
Definition: Maps.h:1026
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:1290
const Vec3d & getTranslation() const
Returns the translation.
Definition: Maps.h:1336
bool hasUniformScale() const
Return false (by convention false)
Definition: Maps.h:2027
Type Round(Type x)
Return x rounded down to the nearest integer.
Definition: Math.h:693
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:1696
void read(std::istream &is)
read serialization
Definition: Maps.h:1778
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1039
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:1145
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
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:1807
CompoundMap(const FirstMapType &f, const SecondMapType &s)
Definition: Maps.h:2574
bool isUnitary(const MatType &m)
Determine is a matrix is Unitary (i.e. rotation or reflection)
Definition: Mat.h:854
Name type() const
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:395
Vec3< T > row(int i) const
Get ith row, e.g. Vec3d v = m.row(1);.
Definition: Mat3.h:168
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:813
CompoundMap(const MyType &other)
Definition: Maps.h:2579
SpectralDecomposedMap SymmetricMap
Definition: Maps.h:70
bool isIdentity() const
Return true if the underlying matrix is approximately an identity.
Definition: Maps.h:488
T * asPointer()
Definition: Vec3.h:103
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
CompoundMap< FirstMapType, SecondMapType > MyType
Definition: Maps.h:2566
boost::shared_ptr< NonlinearFrustumMap > Ptr
Definition: Maps.h:1874
Threadsafe singleton object for accessing the map type-name dictionary. Associates a map type-name wi...
Definition: Maps.h:285
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:1051
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const
Definition: Maps.h:472
bool isInvertible(const MatType &m)
Definition: Mat.h:841
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:2076
boost::shared_ptr< const AffineMap > ConstPtr
Definition: Maps.h:327
bool isLinear() const
Return false (a NonlinearFrustumMap is never linear).
Definition: Maps.h:2024
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:430
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:753
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:2423
AffineMap(const AffineMap &first, const AffineMap &second)
constructor that merges the matrixes for two affine maps
Definition: Maps.h:371
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const
Definition: Maps.h:803
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:2413
boost::shared_ptr< const TranslationMap > ConstPtr
Definition: Maps.h:1000
~ScaleTranslateMap()
Definition: Maps.h:1226
MapBase::Ptr copy() const
Returns a MapBase::Ptr to a deep copy of *this.
Definition: Maps.h:1694
void write(std::ostream &os) const
write serialization
Definition: Maps.h:2384
double determinant(const Vec3d &loc) const
Definition: Maps.h:2297
Name type() const
Definition: Maps.h:2585
boost::shared_ptr< TranslationMap > Ptr
Definition: Maps.h:999
CompoundMap< CompoundMap< UnitaryMap, ScaleMap >, UnitaryMap > SpectralDecomposedMap
Definition: Maps.h:69
OPENVDB_IMPORT uint32_t getFormatVersion(std::istream &)
Return the file format version number associated with the given input stream.
boost::shared_ptr< const ScaleTranslateMap > ConstPtr
Definition: Maps.h:1175
static Name mapType()
Definition: Maps.h:2586
static Name mapType()
Definition: Maps.h:737
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:1871
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:457
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:790
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:1748
T det() const
Determinant of matrix.
Definition: Mat3.h:481
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:2000
std::string Name
Definition: Name.h:44
bool operator==(const UnitaryMap &other) const
Definition: Maps.h:1723
static bool isEqualBase(const MapT &self, const MapBase &other)
Definition: Maps.h:273
bool operator!=(const TranslationMap &other) const
Definition: Maps.h:1098
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the linear second map applied to in.
Definition: Maps.h:2087
const Vec3d & getScale() const
Return the scale values that define the map.
Definition: Maps.h:810
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:441
A specialized linear transform that performs a translation.
Definition: Maps.h:996
#define OPENVDB_VERSION_NAME
Definition: version.h:45
void setSecondMap(const SecondMapType &second)
Definition: Maps.h:2642
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1738
Vec3< T > col(int j) const
Get jth column, e.g. Vec3d v = m.col(0);.
Definition: Mat3.h:184
UnitaryMap(const Vec3d &axis, double radians)
Definition: Maps.h:1628
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1041
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:1120
bool operator!=(const ScaleTranslateMap &other) const
Definition: Maps.h:1385
const Coord & min() const
Definition: Coord.h:257
TranslationMap(const Vec3d &t)
Definition: Maps.h:1004
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1296
bool isIdentity() const
Definition: Maps.h:2609
Abstract base class for maps.
Definition: Maps.h:158
Mat3< T > getMat3() const
Definition: Mat4.h:304
Name type() const
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1025
static void registerMap()
Definition: Maps.h:1018
AffineMap(const AffineMap &other)
Definition: Maps.h:358
bool isLinear() const
Return true (a TranslationMap is always linear).
Definition: Maps.h:1029
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1283
Name readString(std::istream &is)
Definition: Name.h:47
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:780
T & x()
Reference to the component, e.g. v.x() = 4.5f;.
Definition: Vec3.h:94
boost::shared_ptr< ScaleMap > Ptr
Definition: Maps.h:687
bool isDiagonal() const
Return true if the underylying matrix is diagonal.
Definition: Maps.h:490
double determinant() const
Return the determinant of the Jacobian of linear second map.
Definition: Maps.h:2293
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
CompoundMap< UnitaryMap, TranslationMap > UnitaryAndTranslationMap
Definition: Maps.h:66
bool operator==(const ScaleTranslateMap &other) const
Definition: Maps.h:1377
Vec3d voxelSize() const
Returns the lengths of the images of the segments , , .
Definition: Maps.h:1774
Vec3d applyIJT(const Vec3d &d1_is, const Vec3d &ijk) const
Definition: Maps.h:2182
A general linear transform using homogeneous coordinates to perform rotation, scaling, shear and translation.
Definition: Maps.h:323
boost::shared_ptr< const NonlinearFrustumMap > ConstPtr
Definition: Maps.h:1875
void read(std::istream &is)
read serialization
Definition: Maps.h:550
static bool isRegistered()
Definition: Maps.h:1016
T dot(const Vec3< T > &v) const
Dot product.
Definition: Vec3.h:199
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:1060
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1231
static bool isRegistered()
Definition: Maps.h:1239
AffineMap::Ptr getAffineMap() const
Definition: Maps.h:2328
void accumPreTranslation(const Vec3d &v)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:511
bool normalize(T eps=T(1.0e-7))
this = normalized this
Definition: Vec3.h:328
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:1288
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:761
Mat3d applyIJC(const Mat3d &in) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1310
const Mat4d & getConstMat4() const
Definition: Maps.h:645
boost::shared_ptr< MyType > Ptr
Definition: Maps.h:2568
ScaleTranslateMap(const ScaleTranslateMap &other)
Definition: Maps.h:1216
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:2448
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...
ScaleMap()
Definition: Maps.h:690
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
void accumPostTranslation(const Vec3d &v)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:536
Vec3< double > Vec3d
Definition: Vec3.h:605
Vec4< T0 > transform(const Vec4< T0 > &v) const
Transform a Vec4 by post-multiplication.
Definition: Mat4.h:1012
const BBoxd & getBBox() const
Return the bounding box that defines the frustum in pre-image space.
Definition: Maps.h:2342
Mat3d applyIJC(const Mat3d &in) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1762
NonlinearFrustumMap(const NonlinearFrustumMap &other)
Definition: Maps.h:1912
UnitaryMap(const Mat4d &m)
Definition: Maps.h:1654
UnitaryMap()
default constructor makes an Idenity.
Definition: Maps.h:1624
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:2082
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of under the map.
Definition: Maps.h:1274
AffineMap::Ptr getAffineMap() const
Return a AffineMap equivalent to this map.
Definition: Maps.h:867
T & y()
Definition: Vec3.h:95
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:1171
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
math::BBox< Vec3d > BBoxd
Definition: Types.h:84
void accumPostShear(Axis axis0, Axis axis1, double shear)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:541
NonlinearFrustumMap()
Definition: Maps.h:1877
Mat3d applyIJC(const Mat3d &in) const
Return the Jacobian Curvature for the linear second map.
Definition: Maps.h:2218
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:1046
Int32 ValueType
Definition: Coord.h:55
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
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:229
static bool isRegistered()
Definition: Maps.h:2010
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:725
void read(std::istream &is)
Definition: Maps.h:2644
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:439
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:1432
MapBase::Ptr inverseMap() const
Not implemented, since there is currently no map type that can represent the inverse of a frustum...
Definition: Maps.h:2005
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1760
void write(std::ostream &os) const
Definition: Maps.h:2650
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:1900
static void registerMap()
Definition: Maps.h:1703
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:2049
Mat3 transpose() const
returns transpose of this
Definition: Mat3.h:455
bool isLinear() const
Return true (a UnitaryMap is always linear).
Definition: Maps.h:1716
~UnitaryMap()
Definition: Maps.h:1690
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:1743
OPENVDB_API Mat4d approxInverse(const Mat4d &mat)
Returns the left pseudoInverse of the input matrix when the 3x3 part is symmetric otherwise it zeros ...
Mat3 inverse(T tolerance=0) const
Definition: Mat3.h:466
double determinant(const Vec3d &) const
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:476
Definition: Exceptions.h:82
Vec3< typename MatType::value_type > getScale(const MatType &mat)
Definition: Mat.h:614
MatType scale(const Vec3< typename MatType::value_type > &scaling)
Definition: Mat.h:595
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:1813
UnitaryMap(const UnitaryMap &other)
Definition: Maps.h:1679
Definition: Exceptions.h:84
bool operator==(const TranslationMap &other) const
Definition: Maps.h:1092
CompoundMap< SymmetricMap, UnitaryMap > PolarDecomposedMap
Definition: Maps.h:72
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
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:1339
void setToRotation(Axis axis, T angle)
Sets the matrix to a rotation about the given axis.
Definition: Mat4.h:797
static void registerMap()
Definition: Maps.h:729
void accumPreScale(const Vec3d &v)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:506
OPENVDB_API boost::shared_ptr< SymmetricMap > createSymmetricMap(const Mat3d &m)
Utility methods.
Mat3d applyIJC(const Mat3d &mat) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1062
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: BBox.h:157
OPENVDB_API boost::shared_ptr< MapBase > simplify(boost::shared_ptr< AffineMap > affine)
reduces an AffineMap to a ScaleMap or a ScaleTranslateMap when it can
static Name mapType()
Definition: Maps.h:396
double getDepth() const
Return the unscaled frustm depth.
Definition: Maps.h:2337
double getGamma() const
Definition: Maps.h:2339
bool isLinear() const
Return true (an AffineMap is always linear).
Definition: Maps.h:399
Vec3d voxelSize() const
Return the size of a voxel at the center of the near plane.
Definition: Maps.h:2305
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:384
AffineMap(const Mat3d &m)
Definition: Maps.h:341
const Coord & max() const
Definition: Coord.h:258
boost::shared_ptr< const UnitaryMap > ConstPtr
Definition: Maps.h:1621
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:1294
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:1775
void read(std::istream &is)
read serialization
Definition: Maps.h:1078
void writeString(std::ostream &os, const Name &name)
Definition: Name.h:58
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1012
bool operator!=(const AffineMap &other) const
Definition: Maps.h:424
boost::shared_ptr< AffineMap > Ptr
Definition: Maps.h:326
bool isScaleTranslate() const
Return true if the map is equivalent to a ScaleTranslateMap.
Definition: Maps.h:494
~ScaleMap()
Definition: Maps.h:718
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const
Definition: Maps.h:1763
boost::shared_ptr< FullyDecomposedMap > createDecomposedMap()
on-demand decomposition of the affine map
Definition: Maps.h:572
AffineMap::Ptr getAffineMap() const
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1796
Mat4 inverse(T tolerance=0) const
Definition: Mat4.h:492
static const Mat4< double > & identity()
Predefined constant for identity matrix.
Definition: Mat4.h:149
bool operator==(const NonlinearFrustumMap &other) const
Definition: Maps.h:2051
static void registerMap()
Definition: Maps.h:388
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:1889
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:782
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:1152
void read(std::istream &is)
read serialization
Definition: Maps.h:2354
Name type() const
Return NonlinearFrustumMap.
Definition: Maps.h:2019
Mat3d applyIJC(const Mat3d &m) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:469
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:847
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:815
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:1736
void read(std::istream &is)
read serialization
Definition: Maps.h:1346
std::map< Name, MapBase::MapFactory > MapDictionary
Definition: Maps.h:288
double determinant(const Vec3d &) const
Return the product of the scale values, ignores argument.
Definition: Maps.h:1324
Creates the composition of two maps, each of which could be a composition. In the case that each comp...
Definition: Maps.h:66
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
const FirstMapType & firstMap() const
Definition: Maps.h:2638
ScaleMap(const ScaleMap &other)
Definition: Maps.h:708
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1300
bool operator==(const AffineMap &other) const
Definition: Maps.h:416
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:56
UnitaryMap(Axis axis, double radians)
Definition: Maps.h:1635
Axis
Definition: Math.h:762
void setToRotation(const Quat< T > &q)
Set this matrix to the rotation matrix specified by the quaternion.
Definition: Mat3.h:270
MyType & operator=(const MyType &other)
Definition: Maps.h:2601
AffineMap::Ptr inverse() const
Return AffineMap::Ptr to the inverse of this map.
Definition: Maps.h:581
bool isApproxEqual(const Hermite &lhs, const Hermite &rhs)
Definition: Hermite.h:470
static MapBase::Ptr create()
Return a MapBase::Ptr to a new AffineMap.
Definition: Maps.h:380
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:382
void setTranslation(const Vec3< T > &t)
Definition: Mat4.h:321
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 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:1849
void setMat3(const Mat3< T > &m)
Set upper left to a Mat3.
Definition: Mat4.h:297
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:1789
bool isType() const
Return true if this map is of concrete type MapT (e.g., AffineMap).
Definition: Maps.h:173
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1053
void accumPostScale(const Vec3d &v)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:531
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1302
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:1037
bool hasUniformScale() const
Return true if the values have the same magitude (eg. -1, 1, -1 would be a rotation).
Definition: Maps.h:743
CompoundMap< SymmetricMap, UnitaryAndTranslationMap > FullyDecomposedMap
Definition: Maps.h:71
static bool isRegistered()
Definition: Maps.h:386
AffineMap(const Mat4d &m)
Definition: Maps.h:349
bool operator!=(const ScaleMap &other) const
Definition: Maps.h:864
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
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:1341
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:1083
bool hasSimpleAffine() const
Return true if the second map is a uniform scale, Rotation and translation.
Definition: Maps.h:2351
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
boost::shared_ptr< MapBase > Ptr
Definition: Maps.h:161
double determinant(const Vec3d &) const
Return the product of the scale values, ignores argument.
Definition: Maps.h:805
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:2443
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:769
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:817
~TranslationMap()
Definition: Maps.h:1007
bool isScale() const
Return true if the map is equivalent to a ScaleMap.
Definition: Maps.h:492
AffineMap::Ptr getAffineMap() const
Return AffineMap::Ptr to a deep copy of the current AffineMap.
Definition: Maps.h:578
bool hasUniformScale() const
Return false ( test if this is unitary with translation )
Definition: Maps.h:402
Vec3d applyMap(const Vec3d &in) const
Return the image of under the map.
Definition: Maps.h:1266
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:2418
Vec3d voxelSize() const
Return .
Definition: Maps.h:1071
static void registerMap()
Definition: Maps.h:2012
bool operator==(const MyType &other) const
Definition: Maps.h:2591
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:1090
Name type() const
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:736
ScaleTranslateMap()
Definition: Maps.h:1177
TranslationMap(const TranslationMap &other)
Definition: Maps.h:1005
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleMap.
Definition: Maps.h:721
Mat4d getMat4() const
Return the matrix representation of this AffineMap.
Definition: Maps.h:644
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:1938
void read(std::istream &is)
read serialization
Definition: Maps.h:829
MapBase()
Definition: Maps.h:270
void write(std::ostream &os) const
write serialization
Definition: Maps.h:1784
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
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
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:446
double determinant() const
Return 1.
Definition: Maps.h:1068
Vec3d applyJT(const Vec3d &in, const Vec3d &isloc) const
Definition: Maps.h:2145
void setFirstMap(const FirstMapType &first)
Definition: Maps.h:2641
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:2395
static Name mapType()
Return NonlinearFrustumMap.
Definition: Maps.h:2021
double determinant() const
Return the determinant of the Jacobian.
Definition: Maps.h:478
bool isAffine(const Mat4< T > &m)
Definition: Mat4.h:1337
bool operator!=(const NonlinearFrustumMap &other) const
Definition: Maps.h:2073
AffineMap::Ptr getAffineMap() const
Definition: Maps.h:2626
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1758