33 #ifndef OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED 34 #define OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED 41 #include <openvdb/io/io.h> 42 #include <openvdb/util/Name.h> 43 #include <openvdb/Types.h> 44 #include <boost/shared_ptr.hpp> 60 class ScaleTranslateMap;
61 class UniformScaleMap;
62 class UniformScaleTranslateMap;
65 class NonlinearFrustumMap;
80 template<
typename T>
struct is_linear {
static const bool value =
false; };
100 static const bool value =
true;
104 template<
typename T>
struct is_scale {
static const bool value =
false; };
162 typedef boost::shared_ptr<MapBase>
Ptr;
164 typedef Ptr (*MapFactory)();
168 virtual boost::shared_ptr<AffineMap> getAffineMap()
const = 0;
171 virtual Name type()
const = 0;
174 template<
typename MapT>
bool isType()
const {
return this->type() == MapT::mapType(); }
177 virtual bool isEqual(
const MapBase& other)
const = 0;
180 virtual bool isLinear()
const = 0;
182 virtual bool hasUniformScale()
const = 0;
184 virtual Vec3d applyMap(
const Vec3d& in)
const = 0;
185 virtual Vec3d applyInverseMap(
const Vec3d& in)
const = 0;
188 virtual Vec3d applyIJT(
const Vec3d& in)
const = 0;
192 virtual Vec3d applyIJT(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
195 virtual Mat3d applyIJC(
const Mat3d& m)
const = 0;
199 virtual double determinant()
const = 0;
200 virtual double determinant(
const Vec3d&)
const = 0;
204 virtual Vec3d voxelSize()
const = 0;
208 virtual Vec3d voxelSize(
const Vec3d&)
const = 0;
211 virtual void read(std::istream&) = 0;
212 virtual void write(std::ostream&)
const = 0;
214 virtual std::string str()
const = 0;
232 virtual Vec3d applyJacobian(
const Vec3d& in)
const = 0;
238 virtual Vec3d applyJacobian(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
242 virtual Vec3d applyInverseJacobian(
const Vec3d& in)
const = 0;
248 virtual Vec3d applyInverseJacobian(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
253 virtual Vec3d applyJT(
const Vec3d& in)
const = 0;
260 virtual Vec3d applyJT(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
273 template<
typename MapT>
276 return other.
isType<MapT>() && (
self == *static_cast<const MapT*>(&other));
297 static bool isRegistered(
const Name&);
300 static void registerMap(
const Name&, MapBase::MapFactory);
303 static void unregisterMap(
const Name&);
327 typedef boost::shared_ptr<AffineMap>
Ptr;
328 typedef boost::shared_ptr<const AffineMap>
ConstPtr;
331 mMatrix(
Mat4d::identity()),
332 mMatrixInv(
Mat4d::identity()),
333 mJacobianInv(
Mat3d::identity()),
335 mVoxelSize(
Vec3d(1,1,1)),
347 updateAcceleration();
354 "Tried to initialize an affine transform from a non-affine 4x4 matrix");
356 updateAcceleration();
361 mMatrix(other.mMatrix),
362 mMatrixInv(other.mMatrixInv),
363 mJacobianInv(other.mJacobianInv),
364 mDeterminant(other.mDeterminant),
365 mVoxelSize(other.mVoxelSize),
366 mIsDiagonal(other.mIsDiagonal),
367 mIsIdentity(other.mIsIdentity)
373 mMatrix(first.mMatrix * second.mMatrix)
375 updateAcceleration();
387 static bool isRegistered() {
return MapRegistry::isRegistered(AffineMap::mapType()); }
391 MapRegistry::registerMap(
392 AffineMap::mapType(),
405 Mat3d mat = mMatrix.getMat3();
406 const double det = mat.
det();
410 mat *= (1.f / pow(std::abs(det),1./3.));
415 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
420 if (!mMatrix.eq(other.mMatrix)) {
return false; }
421 if (!mMatrixInv.eq(other.mMatrixInv)) {
return false; }
429 mMatrix = other.mMatrix;
430 mMatrixInv = other.mMatrixInv;
432 mJacobianInv = other.mJacobianInv;
433 mDeterminant = other.mDeterminant;
434 mVoxelSize = other.mVoxelSize;
435 mIsDiagonal = other.mIsDiagonal;
436 mIsIdentity = other.mIsIdentity;
460 return Vec3d( m[ 0] * in[0] + m[ 1] * in[1] + m[ 2] * in[2],
461 m[ 4] * in[0] + m[ 5] * in[1] + m[ 6] * in[2],
462 m[ 8] * in[0] + m[ 9] * in[1] + m[10] * in[2] );
471 return mJacobianInv.
transpose()* m * mJacobianInv;
482 Vec3d voxelSize()
const {
return mVoxelSize; }
501 void accumPreRotation(
Axis axis,
double radians)
504 mMatrix.preRotate(axis, radians);
505 updateAcceleration();
510 updateAcceleration();
514 mMatrix.preTranslate(v);
515 updateAcceleration();
519 mMatrix.preShear(axis0, axis1, shear);
520 updateAcceleration();
526 void accumPostRotation(
Axis axis,
double radians)
529 mMatrix.postRotate(axis, radians);
530 updateAcceleration();
534 mMatrix.postScale(v);
535 updateAcceleration();
539 mMatrix.postTranslate(v);
540 updateAcceleration();
544 mMatrix.postShear(axis0, axis1, shear);
545 updateAcceleration();
554 updateAcceleration();
566 std::ostringstream buffer;
567 buffer <<
" - mat4:\n" << mMatrix.str() << std::endl;
568 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
591 affineMap->accumPreRotation(axis, radians);
597 affineMap->accumPreTranslation(t);
603 affineMap->accumPreScale(s);
609 affineMap->accumPreShear(axis0, axis1, shear);
621 affineMap->accumPostRotation(axis, radians);
627 affineMap->accumPostTranslation(t);
633 affineMap->accumPostScale(s);
639 affineMap->accumPostShear(axis0, axis1, shear);
650 void updateAcceleration() {
651 Mat3d mat3 = mMatrix.getMat3();
652 mDeterminant = mat3.
det();
656 "Tried to initialize an affine transform from a nearly singular matrix");
658 mMatrixInv = mMatrix.inverse();
663 mVoxelSize(0) = (applyMap(
Vec3d(1,0,0)) - pos).length();
664 mVoxelSize(1) = (applyMap(
Vec3d(0,1,0)) - pos).length();
665 mVoxelSize(2) = (applyMap(
Vec3d(0,0,1)) - pos).length();
676 bool mIsDiagonal, mIsIdentity;
688 typedef boost::shared_ptr<ScaleMap>
Ptr;
689 typedef boost::shared_ptr<const ScaleMap>
ConstPtr;
692 mScaleValuesInverse(
Vec3d(1,1,1)),
693 mInvScaleSqr(1,1,1), mInvTwiceScale(0.5,0.5,0.5){}
698 mVoxelSize(
Vec3d(std::abs(scale(0)),std::abs(scale(1)), std::abs(scale(2))))
700 double determinant = scale[0]* scale[1] * scale[2];
704 mScaleValuesInverse = 1.0 / mScaleValues;
705 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
706 mInvTwiceScale = mScaleValuesInverse / 2;
711 mScaleValues(other.mScaleValues),
712 mVoxelSize(other.mVoxelSize),
713 mScaleValuesInverse(other.mScaleValuesInverse),
714 mInvScaleSqr(other.mInvScaleSqr),
715 mInvTwiceScale(other.mInvTwiceScale)
728 static bool isRegistered() {
return MapRegistry::isRegistered(ScaleMap::mapType()); }
732 MapRegistry::registerMap(
747 std::abs(mScaleValues.x()), std::abs(mScaleValues.y()),
double(5e-7));
749 std::abs(mScaleValues.x()), std::abs(mScaleValues.z()),
double(5e-7));
757 in.
x() * mScaleValues.x(),
758 in.
y() * mScaleValues.y(),
759 in.
z() * mScaleValues.z());
765 in.
x() * mScaleValuesInverse.x(),
766 in.
y() * mScaleValuesInverse.y(),
767 in.
z() * mScaleValuesInverse.z());
796 for (
int i = 0; i < 3; i++) {
797 tmp.
setRow(i, in.
row(i) * mScaleValuesInverse(i));
799 for (
int i = 0; i < 3; i++) {
800 tmp.
setCol(i, tmp.
col(i) * mScaleValuesInverse(i));
808 double determinant()
const {
return mScaleValues.x() * mScaleValues.y() * mScaleValues.z(); }
821 Vec3d voxelSize()
const {
return mVoxelSize; }
832 mScaleValues.read(is);
834 mScaleValuesInverse.read(is);
835 mInvScaleSqr.read(is);
836 mInvTwiceScale.read(is);
841 mScaleValues.write(os);
842 mVoxelSize.write(os);
843 mScaleValuesInverse.write(os);
844 mInvScaleSqr.write(os);
845 mInvTwiceScale.write(os);
850 std::ostringstream buffer;
851 buffer <<
" - scale: " << mScaleValues << std::endl;
852 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
856 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
861 if (!mScaleValues.eq(other.mScaleValues)) {
return false; }
881 affineMap->accumPreRotation(axis, radians);
892 affineMap->accumPreShear(axis0, axis1, shear);
904 affineMap->accumPostRotation(axis, radians);
915 affineMap->accumPostShear(axis0, axis1, shear);
921 Vec3d mScaleValues, mVoxelSize, mScaleValuesInverse, mInvScaleSqr, mInvTwiceScale;
930 typedef boost::shared_ptr<UniformScaleMap>
Ptr;
931 typedef boost::shared_ptr<const UniformScaleMap>
ConstPtr;
945 const Vec3d& invScale = getInvScale();
949 static bool isRegistered() {
return MapRegistry::isRegistered(UniformScaleMap::mapType()); }
952 MapRegistry::registerMap(
953 UniformScaleMap::mapType(),
954 UniformScaleMap::create);
960 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
980 ScaleMap::preScale(
const Vec3d& v)
const 982 const Vec3d new_scale(v * mScaleValues);
992 ScaleMap::postScale(
const Vec3d& v)
const 1002 typedef boost::shared_ptr<TranslationMap>
Ptr;
1003 typedef boost::shared_ptr<const TranslationMap>
ConstPtr;
1019 static bool isRegistered() {
return MapRegistry::isRegistered(TranslationMap::mapType()); }
1023 MapRegistry::registerMap(
1024 TranslationMap::mapType(),
1025 TranslationMap::create);
1081 void read(std::istream& is) { mTranslation.read(is); }
1083 void write(std::ostream& os)
const { mTranslation.write(os); }
1088 std::ostringstream buffer;
1089 buffer <<
" - translation: " << mTranslation << std::endl;
1090 return buffer.str();
1093 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
1098 return mTranslation.eq(other.mTranslation);
1119 affineMap->accumPreRotation(axis, radians);
1133 affineMap->accumPreShear(axis0, axis1, shear);
1144 affineMap->accumPostRotation(axis, radians);
1158 affineMap->accumPostShear(axis0, axis1, shear);
1177 typedef boost::shared_ptr<ScaleTranslateMap>
Ptr;
1178 typedef boost::shared_ptr<const ScaleTranslateMap>
ConstPtr;
1182 mTranslation(
Vec3d(0,0,0)),
1183 mScaleValues(
Vec3d(1,1,1)),
1184 mVoxelSize(
Vec3d(1,1,1)),
1185 mScaleValuesInverse(
Vec3d(1,1,1)),
1186 mInvScaleSqr(1,1,1),
1187 mInvTwiceScale(0.5,0.5,0.5)
1193 mTranslation(translate),
1194 mScaleValues(scale),
1195 mVoxelSize(std::abs(scale(0)), std::abs(scale(1)), std::abs(scale(2)))
1197 const double determinant = scale[0]* scale[1] * scale[2];
1201 mScaleValuesInverse = 1.0 / mScaleValues;
1202 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1203 mInvTwiceScale = mScaleValuesInverse / 2;
1208 mTranslation(translate.getTranslation()),
1210 mVoxelSize(std::abs(mScaleValues(0)),
1211 std::abs(mScaleValues(1)),
1212 std::abs(mScaleValues(2))),
1213 mScaleValuesInverse(1.0 / scale.
getScale())
1215 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1216 mInvTwiceScale = mScaleValuesInverse / 2;
1221 mTranslation(other.mTranslation),
1222 mScaleValues(other.mScaleValues),
1223 mVoxelSize(other.mVoxelSize),
1224 mScaleValuesInverse(other.mScaleValuesInverse),
1225 mInvScaleSqr(other.mInvScaleSqr),
1226 mInvTwiceScale(other.mInvTwiceScale)
1239 mScaleValuesInverse, -mScaleValuesInverse * mTranslation));
1242 static bool isRegistered() {
return MapRegistry::isRegistered(ScaleTranslateMap::mapType()); }
1246 MapRegistry::registerMap(
1247 ScaleTranslateMap::mapType(),
1248 ScaleTranslateMap::create);
1262 std::abs(mScaleValues.x()), std::abs(mScaleValues.y()),
double(5e-7));
1264 std::abs(mScaleValues.x()), std::abs(mScaleValues.z()),
double(5e-7));
1272 in.
x() * mScaleValues.x() + mTranslation.x(),
1273 in.
y() * mScaleValues.y() + mTranslation.y(),
1274 in.
z() * mScaleValues.z() + mTranslation.z());
1280 (in.
x() - mTranslation.x() ) * mScaleValuesInverse.x(),
1281 (in.
y() - mTranslation.y() ) * mScaleValuesInverse.y(),
1282 (in.
z() - mTranslation.z() ) * mScaleValuesInverse.z());
1308 in.
x() * mScaleValuesInverse.x(),
1309 in.
y() * mScaleValuesInverse.y(),
1310 in.
z() * mScaleValuesInverse.z());
1316 for (
int i=0; i<3; i++){
1317 tmp.
setRow(i, in.
row(i)*mScaleValuesInverse(i));
1319 for (
int i=0; i<3; i++){
1320 tmp.
setCol(i, tmp.
col(i)*mScaleValuesInverse(i));
1329 double determinant()
const {
return mScaleValues.x()*mScaleValues.y()*mScaleValues.z(); }
1351 mTranslation.read(is);
1352 mScaleValues.read(is);
1353 mVoxelSize.read(is);
1354 mScaleValuesInverse.read(is);
1355 mInvScaleSqr.read(is);
1356 mInvTwiceScale.read(is);
1361 mTranslation.write(os);
1362 mScaleValues.write(os);
1363 mVoxelSize.write(os);
1364 mScaleValuesInverse.write(os);
1365 mInvScaleSqr.write(os);
1366 mInvTwiceScale.write(os);
1371 std::ostringstream buffer;
1372 buffer <<
" - translation: " << mTranslation << std::endl;
1373 buffer <<
" - scale: " << mScaleValues << std::endl;
1374 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
1375 return buffer.str();
1378 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
1383 if (!mScaleValues.eq(other.mScaleValues)) {
return false; }
1384 if (!mTranslation.eq(other.mTranslation)) {
return false; }
1394 affineMap->accumPostTranslation(mTranslation);
1404 affineMap->accumPreRotation(axis, radians);
1409 const Vec3d& s = mScaleValues;
1410 const Vec3d scaled_trans( t.
x() * s.
x(),
1421 affineMap->accumPreShear(axis0, axis1, shear);
1432 affineMap->accumPostRotation(axis, radians);
1445 affineMap->accumPostShear(axis0, axis1, shear);
1451 Vec3d mTranslation, mScaleValues, mVoxelSize, mScaleValuesInverse,
1452 mInvScaleSqr, mInvTwiceScale;
1457 ScaleMap::postTranslate(
const Vec3d& t)
const 1464 ScaleMap::preTranslate(
const Vec3d& t)
const 1467 const Vec3d& s = mScaleValues;
1468 const Vec3d scaled_trans( t.
x() * s.
x(),
1480 typedef boost::shared_ptr<UniformScaleTranslateMap>
Ptr;
1481 typedef boost::shared_ptr<const UniformScaleTranslateMap>
ConstPtr;
1499 const Vec3d& scaleInv = getInvScale();
1500 const Vec3d& trans = getTranslation();
1506 return MapRegistry::isRegistered(UniformScaleTranslateMap::mapType());
1511 MapRegistry::registerMap(
1512 UniformScaleTranslateMap::mapType(),
1513 UniformScaleTranslateMap::create);
1519 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
1532 const Vec3d new_trans = this->getTranslation() + scale * t;
1547 UniformScaleMap::postTranslate(
const Vec3d& t)
const 1555 UniformScaleMap::preTranslate(
const Vec3d& t)
const 1563 TranslationMap::preScale(
const Vec3d& v)
const 1574 TranslationMap::postScale(
const Vec3d& v)
const 1579 const Vec3d trans(mTranslation.x()*v.
x(),
1580 mTranslation.y()*v.
y(),
1581 mTranslation.z()*v.
z());
1588 ScaleTranslateMap::preScale(
const Vec3d& v)
const 1590 const Vec3d new_scale( v * mScaleValues );
1600 ScaleTranslateMap::postScale(
const Vec3d& v)
const 1602 const Vec3d new_scale( v * mScaleValues );
1603 const Vec3d new_trans( mTranslation.x()*v.
x(),
1604 mTranslation.y()*v.
y(),
1605 mTranslation.z()*v.
z() );
1623 typedef boost::shared_ptr<UnitaryMap>
Ptr;
1661 "4x4 Matrix initializing unitary map was not unitary: not invertible");
1666 "4x4 Matrix initializing unitary map was not unitary: not affine");
1671 "4x4 Matrix initializing unitary map was not unitary: had translation");
1676 "4x4 Matrix initializing unitary map was not unitary");
1684 mAffineMap(other.mAffineMap)
1689 mAffineMap(*(first.getAffineMap()), *(second.getAffineMap()))
1704 static bool isRegistered() {
return MapRegistry::isRegistered(UnitaryMap::mapType()); }
1708 MapRegistry::registerMap(
1709 UnitaryMap::mapType(),
1710 UnitaryMap::create);
1724 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
1729 if (mAffineMap!=other.mAffineMap)
return false;
1755 return applyInverseMap(in);
1783 mAffineMap.read(is);
1789 mAffineMap.write(os);
1794 std::ostringstream buffer;
1795 buffer << mAffineMap.str();
1796 return buffer.str();
1813 affineMap->accumPreTranslation(t);
1819 affineMap->accumPreScale(v);
1825 affineMap->accumPreShear(axis0, axis1, shear);
1843 affineMap->accumPostTranslation(t);
1849 affineMap->accumPostScale(v);
1855 affineMap->accumPostShear(axis0, axis1, shear);
1877 typedef boost::shared_ptr<NonlinearFrustumMap>
Ptr;
1878 typedef boost::shared_ptr<const NonlinearFrustumMap>
ConstPtr;
1893 MapBase(),mBBox(bb), mTaper(taper), mDepth(depth)
1905 mBBox(bb), mTaper(taper), mDepth(depth)
1907 if (!secondMap->isLinear() ) {
1909 "The second map in the Frustum transfrom must be linear");
1911 mSecondMap = *( secondMap->getAffineMap() );
1918 mTaper(other.mTaper),
1919 mDepth(other.mDepth),
1920 mSecondMap(other.mSecondMap),
1921 mHasSimpleAffine(other.mHasSimpleAffine)
1942 const Vec3d& direction,
1945 double z_near,
double depth,
1953 "The frustum depth must be non-zero and positive");
1955 if (!(up.
length() > 0)) {
1957 "The frustum height must be non-zero and positive");
1959 if (!(aspect > 0)) {
1961 "The frustum aspect ratio must be non-zero and positive");
1965 "The frustum up orientation must be perpendicular to into-frustum direction");
1968 double near_plane_height = 2 * up.
length();
1969 double near_plane_width = aspect * near_plane_height;
1974 mDepth = depth / near_plane_width;
1975 double gamma = near_plane_width / z_near;
1976 mTaper = 1./(mDepth*gamma + 1.);
1978 Vec3d direction_unit = direction;
1987 Vec3d(near_plane_width, near_plane_width, near_plane_width));
1991 Mat4d mat = scale * r2 * r1;
2011 "inverseMap() is not implemented for NonlinearFrustumMap");
2013 static bool isRegistered() {
return MapRegistry::isRegistered(NonlinearFrustumMap::mapType()); }
2017 MapRegistry::registerMap(
2018 NonlinearFrustumMap::mapType(),
2019 NonlinearFrustumMap::create);
2040 const Vec3d e1(1,0,0);
2041 if (!applyMap(e1).eq(e1))
return false;
2043 const Vec3d e2(0,1,0);
2044 if (!applyMap(e2).eq(e2))
return false;
2046 const Vec3d e3(0,0,1);
2047 if (!applyMap(e3).eq(e3))
return false;
2052 virtual bool isEqual(
const MapBase& other)
const {
return isEqualBase(*
this, other); }
2056 if (mBBox!=other.mBBox)
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;
2072 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2081 return mSecondMap.applyMap(applyFrustumMap(in));
2087 return applyFrustumInverseMap(mSecondMap.applyInverseMap(in));
2096 Vec3d centered(isloc);
2097 centered = centered - mBBox.min();
2098 centered.
x() -= mXo;
2099 centered.
y() -= mYo;
2102 const double zprime = centered.
z()*mDepthOnLz;
2104 const double scale = (mGamma * zprime + 1.) / mLx;
2105 const double scale2 = mGamma * mDepthOnLz / mLx;
2107 const Vec3d tmp(scale * in.
x() + scale2 * centered.
x()* in.
z(),
2108 scale * in.
y() + scale2 * centered.
y()* in.
z(),
2109 mDepthOnLz * in.
z());
2111 return mSecondMap.applyJacobian(tmp);
2122 Vec3d centered(isloc);
2123 centered = centered - mBBox.min();
2124 centered.
x() -= mXo;
2125 centered.
y() -= mYo;
2128 const double zprime = centered.
z()*mDepthOnLz;
2130 const double scale = (mGamma * zprime + 1.) / mLx;
2131 const double scale2 = mGamma * mDepthOnLz / mLx;
2134 Vec3d out = mSecondMap.applyInverseJacobian(in);
2136 out.
x() = (out.
x() - scale2 * centered.
x() * out.
z() / mDepthOnLz) / scale;
2137 out.
y() = (out.
y() - scale2 * centered.
y() * out.
z() / mDepthOnLz) / scale;
2138 out.
z() = out.
z() / mDepthOnLz;
2149 const Vec3d tmp = mSecondMap.applyJT(in);
2152 Vec3d centered(isloc);
2153 centered = centered - mBBox.min();
2154 centered.
x() -= mXo;
2155 centered.
y() -= mYo;
2158 const double zprime = centered.
z()*mDepthOnLz;
2160 const double scale = (mGamma * zprime + 1.) / mLx;
2161 const double scale2 = mGamma * mDepthOnLz / mLx;
2163 return Vec3d(scale * tmp.
x(),
2165 scale2 * centered.
x()* tmp.
x() +
2166 scale2 * centered.
y()* tmp.
y() +
2167 mDepthOnLz * tmp.
z());
2171 return mSecondMap.applyJT(in);
2187 const Vec3d loc = applyFrustumMap(ijk);
2188 const double s = mGamma * loc.
z() + 1.;
2193 " at the singular focal point (e.g. camera)");
2196 const double sinv = 1.0/s;
2197 const double pt0 = mLx * sinv;
2198 const double pt1 = mGamma * pt0;
2199 const double pt2 = pt1 * sinv;
2201 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2204 Mat3d gradE(Mat3d::zero());
2205 for (
int j = 0; j < 3; ++j ) {
2206 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2207 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2208 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2212 for (
int i = 0; i < 3; ++i) {
2213 result(i) = d1_is(0) * gradE(0,i) + d1_is(1) * gradE(1,i) + d1_is(2) * gradE(2,i);
2228 const Vec3d loc = applyFrustumMap(ijk);
2230 const double s = mGamma * loc.
z() + 1.;
2235 " at the singular focal point (e.g. camera)");
2239 const double sinv = 1.0/s;
2240 const double pt0 = mLx * sinv;
2241 const double pt1 = mGamma * pt0;
2242 const double pt2 = pt1 * sinv;
2243 const double pt3 = pt2 * sinv;
2245 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2249 Mat3d matE0(Mat3d::zero());
2250 Mat3d matE1(Mat3d::zero());
2251 for(
int j = 0; j < 3; j++) {
2252 for (
int k = 0; k < 3; k++) {
2254 const double pt4 = 2. * jacinv(2,j) * jacinv(2,k) * pt3;
2256 matE0(j,k) = -(jacinv(0,j) * jacinv(2,k) + jacinv(2,j) * jacinv(0,k)) * pt2 +
2259 matE1(j,k) = -(jacinv(1,j) * jacinv(2,k) + jacinv(2,j) * jacinv(1,k)) * pt2 +
2265 Mat3d gradE(Mat3d::zero());
2266 for (
int j = 0; j < 3; ++j ) {
2267 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2268 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2269 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2272 Mat3d result(Mat3d::zero());
2275 for (
int m = 0; m < 3; ++m ) {
2276 for (
int n = 0; n < 3; ++n) {
2277 for (
int i = 0; i < 3; ++i ) {
2278 for (
int j = 0; j < 3; ++j) {
2279 result(m, n) += gradE(j, m) * gradE(i, n) * d2_is(i, j);
2285 for (
int m = 0; m < 3; ++m ) {
2286 for (
int n = 0; n < 3; ++n) {
2288 matE0(m, n) * d1_is(0) + matE1(m, n) * d1_is(1);
2302 double s = mGamma * loc.
z() + 1.0;
2303 double frustum_determinant = s * s * mDepthOnLzLxLx;
2304 return mSecondMap.determinant() * frustum_determinant;
2310 const Vec3d loc( 0.5*(mBBox.min().x() + mBBox.max().x()),
2311 0.5*(mBBox.min().y() + mBBox.max().y()),
2314 return voxelSize(loc);
2324 Vec3d out, pos = applyMap(loc);
2325 out(0) = (applyMap(loc +
Vec3d(1,0,0)) - pos).length();
2326 out(1) = (applyMap(loc +
Vec3d(0,1,0)) - pos).length();
2327 out(2) = (applyMap(loc +
Vec3d(0,0,1)) - pos).length();
2368 is.read(reinterpret_cast<char*>(&mTaper),
sizeof(
double));
2369 is.read(reinterpret_cast<char*>(&mDepth),
sizeof(
double));
2375 if(!MapRegistry::isRegistered(type)) {
2380 MapBase::Ptr proxy = math::MapRegistry::createMap(type);
2382 mSecondMap = *(proxy->getAffineMap());
2390 os.write(reinterpret_cast<const char*>(&mTaper),
sizeof(
double));
2391 os.write(reinterpret_cast<const char*>(&mDepth),
sizeof(
double));
2394 mSecondMap.write(os);
2400 std::ostringstream buffer;
2401 buffer <<
" - taper: " << mTaper << std::endl;
2402 buffer <<
" - depth: " << mDepth << std::endl;
2403 buffer <<
" SecondMap: "<< mSecondMap.type() << std::endl;
2404 buffer << mSecondMap.str() << std::endl;
2405 return buffer.str();
2429 mBBox, mTaper, mDepth, mSecondMap.preShear(shear, axis0, axis1)));
2454 mBBox, mTaper, mDepth, mSecondMap.postShear(shear, axis0, axis1)));
2462 mLx = mBBox.extents().x();
2463 mLy = mBBox.extents().y();
2464 mLz = mBBox.extents().z();
2468 " must have at least two index points in each direction.");
2475 mGamma = (1./mTaper - 1) / mDepth;
2477 mDepthOnLz = mDepth/mLz;
2478 mDepthOnLzLxLx = mDepthOnLz/(mLx * mLx);
2481 mHasSimpleAffine =
true;
2482 Vec3d tmp = mSecondMap.voxelSize();
2485 if (!
isApproxEqual(tmp(0), tmp(1))) { mHasSimpleAffine =
false;
return; }
2486 if (!
isApproxEqual(tmp(0), tmp(2))) { mHasSimpleAffine =
false;
return; }
2488 Vec3d trans = mSecondMap.applyMap(
Vec3d(0,0,0));
2490 Vec3d tmp1 = mSecondMap.applyMap(
Vec3d(1,0,0)) - trans;
2491 Vec3d tmp2 = mSecondMap.applyMap(
Vec3d(0,1,0)) - trans;
2492 Vec3d tmp3 = mSecondMap.applyMap(
Vec3d(0,0,1)) - trans;
2495 if (!
isApproxEqual(tmp1.
dot(tmp2), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2496 if (!
isApproxEqual(tmp2.
dot(tmp3), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2497 if (!
isApproxEqual(tmp3.
dot(tmp1), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2506 out = out - mBBox.min();
2511 out.
z() *= mDepthOnLz;
2513 double scale = (mGamma * out.
z() + 1.)/ mLx;
2522 Vec3d applyFrustumInverseMap(
const Vec3d& in)
const 2526 double invScale = mLx / (mGamma * out.
z() + 1.);
2527 out.
x() *= invScale;
2528 out.
y() *= invScale;
2533 out.
z() /= mDepthOnLz;
2536 out = out + mBBox.min();
2551 double mLx, mLy, mLz;
2552 double mXo, mYo, mGamma, mDepthOnLz, mDepthOnLzLxLx;
2555 bool mHasSimpleAffine;
2565 template<
typename FirstMapType,
typename SecondMapType>
2571 typedef boost::shared_ptr<MyType>
Ptr;
2577 CompoundMap(
const FirstMapType& f,
const SecondMapType& s): mFirstMap(f), mSecondMap(s)
2579 updateAffineMatrix();
2583 mFirstMap(other.mFirstMap),
2584 mSecondMap(other.mSecondMap),
2585 mAffineMap(other.mAffineMap)
2591 return (FirstMapType::mapType() +
Name(
":") + SecondMapType::mapType());
2596 if (mFirstMap != other.mFirstMap)
return false;
2597 if (mSecondMap != other.mSecondMap)
return false;
2598 if (mAffineMap != other.mAffineMap)
return false;
2602 bool operator!=(
const MyType& other)
const {
return !(*
this == other); }
2606 mFirstMap = other.mFirstMap;
2607 mSecondMap = other.mSecondMap;
2608 mAffineMap = other.mAffineMap;
2615 return mAffineMap.isIdentity();
2617 return mFirstMap.isIdentity()&&mSecondMap.isIdentity();
2623 return mAffineMap.isDiagonal();
2625 return mFirstMap.isDiagonal()&&mSecondMap.isDiagonal();
2636 "Constant affine matrix representation not possible for this nonlinear map");
2641 const FirstMapType&
firstMap()
const {
return mFirstMap; }
2642 const SecondMapType&
secondMap()
const {
return mSecondMap; }
2644 void setFirstMap(
const FirstMapType& first) { mFirstMap = first; updateAffineMatrix(); }
2645 void setSecondMap(
const SecondMapType& second) { mSecondMap = second; updateAffineMatrix(); }
2649 mAffineMap.read(is);
2651 mSecondMap.read(is);
2655 mAffineMap.write(os);
2656 mFirstMap.write(os);
2657 mSecondMap.write(os);
2661 void updateAffineMatrix()
2667 mAffineMap =
AffineMap(*first, *second);
2671 FirstMapType mFirstMap;
2672 SecondMapType mSecondMap;
2681 #endif // OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED bool hasUniformScale() const
Return true if the values have the same magitude (eg. -1, 1, -1 would be a rotation).
Definition: Maps.h:744
const AffineMap & secondMap() const
Return MapBase::Ptr& to the second map.
Definition: Maps.h:2348
Vec3d applyMap(const Vec3d &in) const
Return the image of under the map.
Definition: Maps.h:1269
static MapBase::Ptr create()
Return a MapBase::Ptr to a new UnitaryMap.
Definition: Maps.h:1695
bool hasUniformScale() const
Return false (by convention true)
Definition: Maps.h:1035
void accumPostShear(Axis axis0, Axis axis1, double shear)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:542
boost::shared_ptr< const ScaleMap > ConstPtr
Definition: Maps.h:689
double determinant(const Vec3d &) const
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:477
NonlinearFrustumMap(const NonlinearFrustumMap &other)
Definition: Maps.h:1915
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:383
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1042
bool isScaleTranslate() const
Return true if the map is equivalent to a ScaleTranslateMap.
Definition: Maps.h:495
double determinant(const Vec3d &) const
Return 1.
Definition: Maps.h:1069
AffineMap & operator=(const AffineMap &other)
Definition: Maps.h:427
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:1903
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1303
Vec3d voxelSize() const
Return the absolute values of the scale values.
Definition: Maps.h:1331
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:600
double determinant(const Vec3d &) const
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:1768
T dot(const Vec3< T > &v) const
Dot product.
Definition: Vec3.h:203
Mat3d applyIJC(const Mat3d &mat) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1065
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleTranslateMap.
Definition: Maps.h:1232
~ScaleTranslateMap()
Definition: Maps.h:1229
static MapBase::Ptr create()
Return a MapBase::Ptr to a new NonlinearFrustumMap.
Definition: Maps.h:2001
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1761
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...
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:450
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:1846
void accumPostScale(const Vec3d &v)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:532
void read(std::istream &is)
read serialization
Definition: Maps.h:1349
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:1054
static Name mapType()
Definition: Maps.h:738
boost::shared_ptr< NonlinearFrustumMap > Ptr
Definition: Maps.h:1877
T & z()
Definition: Vec3.h:99
Vec3d voxelSize() const
Returns the lengths of the images of the segments , , .
Definition: Maps.h:1777
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:814
bool isDiagonal() const
Return true if the underylying matrix is diagonal.
Definition: Maps.h:491
double determinant() const
Return the product of the scale values.
Definition: Maps.h:1329
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:485
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const
Definition: Maps.h:804
void setToRotation(Axis axis, T angle)
Sets the matrix to a rotation about the given axis.
Definition: Mat4.h:825
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
AffineMap::Ptr getAffineMap() const
Return a AffineMap equivalent to this map.
Definition: Maps.h:868
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:1346
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: Coord.h:472
UnitaryMap(const UnitaryMap &first, const UnitaryMap &second)
Definition: Maps.h:1688
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:1442
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:772
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:1746
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:630
CompoundMap(const FirstMapType &f, const SecondMapType &s)
Definition: Maps.h:2577
void read(std::istream &is)
read serialization
Definition: Maps.h:1781
const FirstMapType & firstMap() const
Definition: Maps.h:2641
static void registerMap()
Definition: Maps.h:1244
static const Mat4< double > & identity()
Predefined constant for identity matrix.
Definition: Mat4.h:152
Vec3d applyIJT(const Vec3d &d1_is, const Vec3d &ijk) const
Definition: Maps.h:2185
UnitaryMap(const Mat3d &m)
Definition: Maps.h:1645
double determinant(const Vec3d &) const
Return the product of the scale values, ignores argument.
Definition: Maps.h:806
Name type() const
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:396
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:1435
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:468
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:445
NonlinearFrustumMap()
Definition: Maps.h:1880
Mat3d applyIJC(const Mat3d &in) const
Return the Jacobian Curvature for the linear second map.
Definition: Maps.h:2221
bool hasUniformScale() const
Return false ( test if this is unitary with translation )
Definition: Maps.h:403
OPENVDB_API Mat4d approxInverse(const Mat4d &mat)
Returns the left pseudoInverse of the input matrix when the 3x3 part is symmetric otherwise it zeros ...
const Vec3d & getScale() const
Return the scale values that define the map.
Definition: Maps.h:811
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:385
CompoundMap()
Definition: Maps.h:2575
static void registerMap()
Definition: Maps.h:2015
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:848
bool isIdentity() const
Definition: Maps.h:2612
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:1724
boost::shared_ptr< AffineMap > Ptr
Definition: Maps.h:327
static bool isRegistered()
Definition: Maps.h:1704
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1741
void read(std::istream &is)
read serialization
Definition: Maps.h:1081
void writeString(std::ostream &os, const Name &name)
Definition: Name.h:58
static bool isRegistered()
Definition: Maps.h:1019
std::string str() const
string serialization, useful for debugging
Definition: Maps.h:564
math::BBox< Vec3d > BBoxd
Definition: Types.h:86
bool operator!=(const ScaleMap &other) const
Definition: Maps.h:865
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:97
static void registerMap()
Definition: Maps.h:389
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const
Definition: Maps.h:1324
static Name mapType()
Definition: Maps.h:2589
bool isUnitary(const MatType &m)
Determine if a matrix is unitary (i.e., rotation or reflection).
Definition: Mat.h:897
MapBase::Ptr copy() const
Returns a MapBase::Ptr to a deep copy of *this.
Definition: Maps.h:1697
std::string Name
Definition: Name.h:44
void read(std::istream &is)
read serialization
Definition: Maps.h:830
ScaleMap(const ScaleMap &other)
Definition: Maps.h:709
Int32 ValueType
Definition: Coord.h:55
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:1840
Vec3d applyJacobian(const Vec3d &in, const Vec3d &isloc) const
Return the Jacobian defined at isloc applied to in.
Definition: Maps.h:2092
static Name mapType()
Definition: Maps.h:1252
~AffineMap()
Definition: Maps.h:378
Definition: Exceptions.h:78
~TranslationMap()
Definition: Maps.h:1010
const BBoxd & getBBox() const
Return the bounding box that defines the frustum in pre-image space.
Definition: Maps.h:2345
static void registerMap()
Definition: Maps.h:1021
CompoundMap< SymmetricMap, UnitaryAndTranslationMap > FullyDecomposedMap
Definition: Maps.h:72
bool operator==(const UnitaryMap &other) const
Definition: Maps.h:1726
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:1060
AffineMap(const AffineMap &other)
Definition: Maps.h:359
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:2322
bool hasUniformScale() const
Return false (by convention false)
Definition: Maps.h:2030
static void registerMap()
Definition: Maps.h:730
AffineMap(const Mat3d &m)
Definition: Maps.h:342
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:1148
Mat3d applyIJC(const Mat3d &in) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1313
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:826
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:1342
void setTaper(double t)
set the taper value, the ratio of nearplane width / far plane width
Definition: Maps.h:2334
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:1816
void write(std::ostream &os) const
write serialization
Definition: Maps.h:558
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:667
Vec3< T > col(int j) const
Get jth column, e.g. Vec3d v = m.col(0);.
Definition: Mat3.h:191
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:1378
AffineMap(const Mat4d &m)
Definition: Maps.h:350
ScaleTranslateMap(const ScaleMap &scale, const TranslationMap &translate)
Definition: Maps.h:1206
A specialized linear transform that performs a unitary maping i.e. rotation and or reflection...
Definition: Maps.h:1620
Mat3 transpose() const
returns transpose of this
Definition: Mat3.h:498
static bool isRegistered()
Definition: Maps.h:728
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:726
boost::shared_ptr< ScaleTranslateMap > Ptr
Definition: Maps.h:1177
bool hasUniformScale() const
Return false (by convention true)
Definition: Maps.h:1722
OPENVDB_API boost::shared_ptr< MapBase > simplify(boost::shared_ptr< AffineMap > affine)
reduces an AffineMap to a ScaleMap or a ScaleTranslateMap when it can
void setSecondMap(const SecondMapType &second)
Definition: Maps.h:2645
This map is composed of three steps. First it will take a box of size (Lx X Ly X Lz) defined by a mem...
Definition: Maps.h:1874
Vec3d applyJT(const Vec3d &in, const Vec3d &isloc) const
Definition: Maps.h:2148
T * asPointer()
Definition: Vec3.h:106
void write(std::ostream &os) const
write serialization
Definition: Maps.h:1083
static bool isRegistered()
Definition: Maps.h:2013
AffineMap::Ptr getAffineMap() const
Return AffineMap::Ptr to a deep copy of the current AffineMap.
Definition: Maps.h:579
static Name mapType()
Return UnitaryMap.
Definition: Maps.h:1716
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:1038
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:685
A specialized linear transform that performs a translation.
Definition: Maps.h:999
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:636
bool operator!=(const ScaleTranslateMap &other) const
Definition: Maps.h:1388
bool operator!=(const UnitaryMap &other) const
Definition: Maps.h:1733
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:2116
Name type() const
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1251
AffineMap::Ptr getAffineMap() const
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1391
MapBase::Ptr inverseMap() const
Not implemented, since there is currently no map type that can represent the inverse of a frustum...
Definition: Maps.h:2008
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:724
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:1892
ScaleMap()
Definition: Maps.h:691
const Vec3d & getTranslation() const
Return the translation vector.
Definition: Maps.h:1079
boost::shared_ptr< const ScaleTranslateMap > ConstPtr
Definition: Maps.h:1178
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:1735
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1044
CompoundMap(const MyType &other)
Definition: Maps.h:2582
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:1852
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:791
bool operator!=(const AffineMap &other) const
Definition: Maps.h:425
void write(std::ostream &os) const
write serialization
Definition: Maps.h:1787
double determinant() const
Return 1.
Definition: Maps.h:1071
boost::shared_ptr< MyType > Ptr
Definition: Maps.h:2571
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:1418
bool isApproxEqual(const Type &a, const Type &b)
Return true if a is equal to b to within the default floating-point comparison tolerance.
Definition: Math.h:370
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:1810
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:1123
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const
Definition: Maps.h:473
MyType & operator=(const MyType &other)
Definition: Maps.h:2604
double determinant() const
Return the determinant of the Jacobian of linear second map.
Definition: Maps.h:2296
OPENVDB_API boost::shared_ptr< SymmetricMap > createSymmetricMap(const Mat3d &m)
Utility methods.
static MapBase::Ptr create()
Return a MapBase::Ptr to a new AffineMap.
Definition: Maps.h:381
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1056
AffineMap::Ptr getAffineMap() const
Definition: Maps.h:2629
Creates the composition of two maps, each of which could be a composition. In the case that each comp...
Definition: Maps.h:67
Name type() const
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:737
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:889
const Vec3d & getScale() const
Returns the scale values.
Definition: Maps.h:1337
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:1049
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1286
bool isScale() const
Return true if the map is equivalent to a ScaleMap.
Definition: Maps.h:493
static bool isRegistered()
Definition: Maps.h:1242
void accumPostTranslation(const Vec3d &v)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:537
AffineMap::Ptr getAffineMap() const
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1104
bool isDiagonal() const
Definition: Maps.h:2621
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:2451
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:1174
Mat4 inverse(T tolerance=0) const
Definition: Mat4.h:527
#define OPENVDB_VERSION_NAME
Definition: version.h:43
Vec3< double > Vec3d
Definition: Vec3.h:651
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:789
void read(std::istream &is)
read serialization
Definition: Maps.h:2357
void setMat3(const Mat3< T > &m)
Set upper left to a Mat3.
Definition: Mat4.h:332
UnitaryMap(const Vec3d &axis, double radians)
Definition: Maps.h:1631
bool operator!=(const TranslationMap &other) const
Definition: Maps.h:1101
~ScaleMap()
Definition: Maps.h:719
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1015
bool operator==(const TranslationMap &other) const
Definition: Maps.h:1095
SpectralDecomposedMap SymmetricMap
Definition: Maps.h:71
double getTaper() const
Return the taper value.
Definition: Maps.h:2336
std::map< Name, MapBase::MapFactory > MapDictionary
Definition: Maps.h:289
void write(std::ostream &os) const
write serialization
Definition: Maps.h:1359
const SecondMapType & secondMap() const
Definition: Maps.h:2642
Map traits.
Definition: Maps.h:80
boost::shared_ptr< MapBase > Ptr
Definition: Maps.h:162
Vec3< T > row(int i) const
Get ith row, e.g. Vec3d v = m.row(1);.
Definition: Mat3.h:175
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:1699
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:1407
void write(std::ostream &os) const
Definition: Maps.h:2653
UnitaryMap(const Mat4d &m)
Definition: Maps.h:1657
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:816
bool hasUniformScale() const
Return true if the scale values have the same magnitude (eg. -1, 1, -1 would be a rotation)...
Definition: Maps.h:1259
bool hasSimpleAffine() const
Return true if the second map is a uniform scale, Rotation and translation.
Definition: Maps.h:2354
T & x()
Reference to the component, e.g. v.x() = 4.5f;.
Definition: Vec3.h:97
AffineMap::Ptr getAffineMap() const
Definition: Maps.h:2331
const Vec3d & getTranslation() const
Returns the translation.
Definition: Maps.h:1339
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:1093
void setDepth(double d)
set the frustum depth: distance between near and far plane = frustm depth * frustm x-width ...
Definition: Maps.h:2338
bool isLinear() const
Return true (a UnitaryMap is always linear).
Definition: Maps.h:1719
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:2416
void write(std::ostream &os) const
write serialization
Definition: Maps.h:2387
OPENVDB_API uint32_t getFormatVersion(std::ios_base &)
Return the file format version number associated with the given input stream.
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:2426
const Mat4d & getConstMat4() const
Definition: Maps.h:646
Vec3d asVec3d() const
Definition: Coord.h:159
static bool isRegistered()
Definition: Maps.h:387
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleMap.
Definition: Maps.h:722
MapBase()
Definition: Maps.h:271
bool isAffine(const Mat4< T > &m)
Definition: Mat4.h:1366
Mat3d applyIJC(const Mat3d &mat, const Vec3d &, const Vec3d &) const
Definition: Maps.h:1066
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const
Definition: Maps.h:1766
virtual ~MapBase()
Definition: Maps.h:166
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:1288
UnitaryMap()
default constructor makes an Idenity.
Definition: Maps.h:1627
A general linear transform using homogeneous coordinates to perform rotation, scaling, shear and translation.
Definition: Maps.h:324
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:1017
Definition: Exceptions.h:39
Mat3d applyIJC(const Mat3d &m) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:470
Tolerance for floating-point comparison.
Definition: Math.h:125
Vec3d voxelSize(const Vec3d &) const
Return .
Definition: Maps.h:1076
boost::shared_ptr< const TranslationMap > ConstPtr
Definition: Maps.h:1003
UnitaryMap(const UnitaryMap &other)
Definition: Maps.h:1682
MatType scale(const Vec3< typename MatType::value_type > &s)
Return a matrix that scales by s.
Definition: Mat.h:594
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:452
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:1941
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:754
TranslationMap(const TranslationMap &other)
Definition: Maps.h:1008
boost::shared_ptr< TranslationMap > Ptr
Definition: Maps.h:1002
Abstract base class for maps.
Definition: Maps.h:159
boost::shared_ptr< const NonlinearFrustumMap > ConstPtr
Definition: Maps.h:1878
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:1155
T length() const
Length of the vector.
Definition: Vec3.h:212
ScaleTranslateMap(const ScaleTranslateMap &other)
Definition: Maps.h:1219
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:458
void accumPreScale(const Vec3d &v)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:507
MapBase::Ptr inverseMap() const
Return a new map representing the inverse of this map.
Definition: Maps.h:1236
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:2398
Mat3 inverse(T tolerance=0) const
Definition: Mat3.h:509
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:1744
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:1293
void accumPreShear(Axis axis0, Axis axis1, double shear)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:517
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:2118
CompoundMap< CompoundMap< UnitaryMap, ScaleMap >, UnitaryMap > SpectralDecomposedMap
Definition: Maps.h:70
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:1737
Name type() const
Definition: Maps.h:2588
Mat3d applyIJC(const Mat3d &d2_is, const Vec3d &d1_is, const Vec3d &ijk) const
Definition: Maps.h:2226
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the linear second map applied to in.
Definition: Maps.h:2090
bool isIdentity() const
Return true if the underlying matrix is approximately an identity.
Definition: Maps.h:489
Mat3< T > getMat3() const
Definition: Mat4.h:339
static void registerMap()
Definition: Maps.h:1706
Vec3d voxelSize() const
Return .
Definition: Maps.h:1074
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:912
boost::shared_ptr< FullyDecomposedMap > createDecomposedMap()
on-demand decomposition of the affine map
Definition: Maps.h:573
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:781
bool isValid() const
Definition: Maps.h:2351
~UnitaryMap()
Definition: Maps.h:1693
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:1291
bool normalize(T eps=T(1.0e-7))
this = normalized this
Definition: Vec3.h:348
bool isLinear() const
Return true (a TranslationMap is always linear).
Definition: Maps.h:1032
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:2421
void setTranslation(const Vec3< T > &t)
Definition: Mat4.h:356
bool operator==(const AffineMap &other) const
Definition: Maps.h:417
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:1778
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:1063
TranslationMap()
Definition: Maps.h:1006
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:1369
AffineMap::Ptr getAffineMap() const
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1799
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:440
Vec3< typename MatType::value_type > getScale(const MatType &mat)
Return a Vec3 representing the lengths of the passed matrix's upper 3x3's rows.
Definition: Mat.h:612
void setRow(int i, const Vec3< T > &v)
Set ith row to vector v.
Definition: Mat3.h:164
bool operator==(const NonlinearFrustumMap &other) const
Definition: Maps.h:2054
Vec3d voxelSize(const Vec3d &) const
Definition: Maps.h:1334
boost::shared_ptr< const MapBase > ConstPtr
Definition: Maps.h:163
const Coord & min() const
Definition: Coord.h:332
static Name mapType()
Return NonlinearFrustumMap.
Definition: Maps.h:2024
UnitaryMap(Axis axis, double radians)
Definition: Maps.h:1638
bool operator==(const ScaleTranslateMap &other) const
Definition: Maps.h:1380
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:415
bool isInvertible(const MatType &m)
Determine if a matrix is invertible.
Definition: Mat.h:877
OPENVDB_API boost::shared_ptr< PolarDecomposedMap > createPolarDecomposedMap(const Mat3d &m)
Decomposes a general linear into translation following polar decomposition.
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:1130
double determinant() const
Return the product of the scale values.
Definition: Maps.h:808
CompoundMap< UnitaryMap, TranslationMap > UnitaryAndTranslationMap
Definition: Maps.h:67
ScaleMap(const Vec3d &scale)
Definition: Maps.h:695
Name type() const
Return NonlinearFrustumMap.
Definition: Maps.h:2022
boost::shared_ptr< const UnitaryMap > ConstPtr
Definition: Maps.h:1624
bool isIdentity() const
Return true if the map is equivalent to an identity.
Definition: Maps.h:2033
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of under the map.
Definition: Maps.h:1277
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:442
T & y()
Definition: Vec3.h:98
Definition: version.h:109
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:450
bool operator==(const MyType &other) const
Definition: Maps.h:2594
boost::shared_ptr< const AffineMap > ConstPtr
Definition: Maps.h:328
Name type() const
Return UnitaryMap.
Definition: Maps.h:1714
const Coord & max() const
Definition: Coord.h:333
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:2052
AffineMap()
Definition: Maps.h:330
void setCol(int j, const Vec3< T > &v)
Set jth column to vector v.
Definition: Mat3.h:182
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:2446
void accumPreTranslation(const Vec3d &v)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:512
Vec3d applyJacobian(const Vec3d &in) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:447
AffineMap(const AffineMap &first, const AffineMap &second)
constructor that merges the matrixes for two affine maps
Definition: Maps.h:372
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:259
bool isLinear() const
Return true (a ScaleTranslateMap is always linear).
Definition: Maps.h:1255
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:1751
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the second map applied to in.
Definition: Maps.h:2170
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:818
AffineMap::Ptr inverse() const
Return AffineMap::Ptr to the inverse of this map.
Definition: Maps.h:582
Definition: Exceptions.h:84
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:1739
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:783
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const
Return the Jacobian of the map applied to in.
Definition: Maps.h:770
bool hasTranslation(const Mat4< T > &m)
Definition: Mat4.h:1371
double determinant() const
Return the determinant of the Jacobian.
Definition: Maps.h:1770
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: BBox.h:165
Name readString(std::istream &is)
Definition: Name.h:47
void read(std::istream &is)
Definition: Maps.h:2647
bool isLinear() const
Return true (an AffineMap is always linear).
Definition: Maps.h:400
bool isLinear() const
Return false (a NonlinearFrustumMap is never linear).
Definition: Maps.h:2027
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:2441
Name type() const
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1028
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1234
double getDepth() const
Return the unscaled frustm depth.
Definition: Maps.h:2340
virtual bool isEqual(const MapBase &other) const
Return true if this map is equal to the given map.
Definition: Maps.h:856
Definition: Exceptions.h:82
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:2085
Vec3d voxelSize() const
Return the size of a voxel at the center of the near plane.
Definition: Maps.h:2308
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:1792
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:624
Axis
Definition: Math.h:856
Vec3d applyMap(const Vec3d &in) const
Return the image of in under the map.
Definition: Maps.h:2079
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:1344
bool operator!=(const MyType &other) const
Definition: Maps.h:2602
MapBase::Ptr copy() const
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:2003
Threadsafe singleton object for accessing the map type-name dictionary. Associates a map type-name wi...
Definition: Maps.h:286
T det() const
Determinant of matrix.
Definition: Mat3.h:523
double determinant(const Vec3d &loc) const
Definition: Maps.h:2300
double determinant() const
Return the determinant of the Jacobian.
Definition: Maps.h:479
ScaleTranslateMap(const Vec3d &scale, const Vec3d &translate)
Definition: Maps.h:1191
static MapBase::Ptr create()
Return a MapBase::Ptr to a new TranslationMap.
Definition: Maps.h:1013
Mat3d applyIJC(const Mat3d &in) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1765
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1305
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:594
Vec4< T0 > transform(const Vec4< T0 > &v) const
Transform a Vec4 by post-multiplication.
Definition: Mat4.h:1040
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:71
TranslationMap(const Vec3d &t)
Definition: Maps.h:1007
Mat3d applyIJC(const Mat3d &in) const
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:793
CompoundMap< SymmetricMap, UnitaryMap > PolarDecomposedMap
Definition: Maps.h:73
void setFirstMap(const FirstMapType &first)
Definition: Maps.h:2644
void write(std::ostream &os) const
write serialization
Definition: Maps.h:839
const Mat3d & getConstJacobianInv() const
Definition: Maps.h:647
static bool isEqualBase(const MapT &self, const MapBase &other)
Definition: Maps.h:274
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:1297
CompoundMap< FirstMapType, SecondMapType > MyType
Definition: Maps.h:2569
bool operator==(const ScaleMap &other) const
Definition: Maps.h:858
ScaleTranslateMap()
Definition: Maps.h:1180
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:1822
void setToRotation(const Quat< T > &q)
Set this matrix to the rotation matrix specified by the quaternion.
Definition: Mat3.h:297
std::string str() const
string serialization, useful for debuging
Definition: Maps.h:1086
void read(std::istream &is)
read serialization
Definition: Maps.h:551
boost::shared_ptr< const MyType > ConstPtr
Definition: Maps.h:2572
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:777
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1299
static Name mapType()
Definition: Maps.h:397
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:606
boost::shared_ptr< ScaleMap > Ptr
Definition: Maps.h:688
float Round(float x)
Return x rounded to the nearest integer.
Definition: Math.h:785
Mat4d getMat4() const
Return the matrix representation of this AffineMap.
Definition: Maps.h:645
boost::shared_ptr< UnitaryMap > Ptr
Definition: Maps.h:1623
bool isLinear() const
Return true (a ScaleMap is always linear).
Definition: Maps.h:741
bool isDiagonal(const MatType &mat)
Determine if a matrix is diagonal.
Definition: Mat.h:910
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:762
Vec3d applyJT(const Vec3d &in, const Vec3d &) const
Definition: Maps.h:456
Vec3d applyJT(const Vec3d &in) const
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1753
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the linear second map applied to in.
Definition: Maps.h:2175
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:775
Vec3d applyInverseMap(const Vec3d &in) const
Return the pre-image of in under the map.
Definition: Maps.h:1040
double determinant(const Vec3d &) const
Return the product of the scale values, ignores argument.
Definition: Maps.h:1327
bool isIdentity(const MatType &m)
Determine if a matrix is an identity matrix.
Definition: Mat.h:868
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:466
~NonlinearFrustumMap()
Definition: Maps.h:1999
Vec3d applyIJT(const Vec3d &in) const
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1763
bool isType() const
Return true if this map is of concrete type MapT (e.g., AffineMap).
Definition: Maps.h:174
double getGamma() const
Definition: Maps.h:2342
bool operator!=(const NonlinearFrustumMap &other) const
Definition: Maps.h:2076
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:1047
static Name mapType()
Definition: Maps.h:1029