Go to the documentation of this file.
33 #ifndef OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED
34 #define OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED
62 class ScaleTranslateMap;
63 class UniformScaleMap;
64 class UniformScaleTranslateMap;
67 class NonlinearFrustumMap;
82 template<
typename T>
struct is_linear {
static const bool value =
false; };
102 static const bool value =
true;
106 template<
typename T>
struct is_scale {
static const bool value =
false; };
174 virtual Name type()
const = 0;
177 template<
typename MapT>
bool isType()
const {
return this->type() == MapT::mapType(); }
180 virtual bool isEqual(
const MapBase& other)
const = 0;
183 virtual bool isLinear()
const = 0;
185 virtual bool hasUniformScale()
const = 0;
187 virtual Vec3d applyMap(
const Vec3d& in)
const = 0;
188 virtual Vec3d applyInverseMap(
const Vec3d& in)
const = 0;
191 virtual Vec3d applyIJT(
const Vec3d& in)
const = 0;
195 virtual Vec3d applyIJT(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
198 virtual Mat3d applyIJC(
const Mat3d& m)
const = 0;
202 virtual double determinant()
const = 0;
203 virtual double determinant(
const Vec3d&)
const = 0;
207 virtual Vec3d voxelSize()
const = 0;
211 virtual Vec3d voxelSize(
const Vec3d&)
const = 0;
214 virtual void read(std::istream&) = 0;
215 virtual void write(std::ostream&)
const = 0;
217 virtual std::string str()
const = 0;
235 virtual Vec3d applyJacobian(
const Vec3d& in)
const = 0;
241 virtual Vec3d applyJacobian(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
245 virtual Vec3d applyInverseJacobian(
const Vec3d& in)
const = 0;
251 virtual Vec3d applyInverseJacobian(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
256 virtual Vec3d applyJT(
const Vec3d& in)
const = 0;
263 virtual Vec3d applyJT(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
276 template<
typename MapT>
279 return other.
isType<MapT>() && (
self == *static_cast<const MapT*>(&other));
300 static bool isRegistered(
const Name&);
306 static void unregisterMap(
const Name&);
334 mMatrix(
Mat4d::identity()),
335 mMatrixInv(
Mat4d::identity()),
336 mJacobianInv(
Mat3d::identity()),
338 mVoxelSize(
Vec3d(1,1,1)),
347 Mat4d mat4(Mat4d::identity());
350 updateAcceleration();
357 "Tried to initialize an affine transform from a non-affine 4x4 matrix");
359 updateAcceleration();
364 mMatrix(other.mMatrix),
365 mMatrixInv(other.mMatrixInv),
366 mJacobianInv(other.mJacobianInv),
367 mDeterminant(other.mDeterminant),
368 mVoxelSize(other.mVoxelSize),
369 mIsDiagonal(other.mIsDiagonal),
370 mIsIdentity(other.mIsIdentity)
376 mMatrix(first.mMatrix * second.mMatrix)
378 updateAcceleration();
390 static bool isRegistered() {
return MapRegistry::isRegistered(AffineMap::mapType()); }
394 MapRegistry::registerMap(
395 AffineMap::mapType(),
408 Mat3d mat = mMatrix.getMat3();
409 const double det = mat.
det();
413 mat *= (1.0 / pow(std::abs(det), 1.0/3.0));
418 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
423 if (!mMatrix.eq(other.mMatrix)) {
return false; }
424 if (!mMatrixInv.eq(other.mMatrixInv)) {
return false; }
432 mMatrix = other.mMatrix;
433 mMatrixInv = other.mMatrixInv;
435 mJacobianInv = other.mJacobianInv;
436 mDeterminant = other.mDeterminant;
437 mVoxelSize = other.mVoxelSize;
438 mIsDiagonal = other.mIsDiagonal;
439 mIsIdentity = other.mIsIdentity;
455 return applyInverseJacobian(in);
460 return mMatrixInv.transform3x3(in);
469 return Vec3d( m[ 0] * in[0] + m[ 1] * in[1] + m[ 2] * in[2],
470 m[ 4] * in[0] + m[ 5] * in[1] + m[ 6] * in[2],
471 m[ 8] * in[0] + m[ 9] * in[1] + m[10] * in[2] );
480 return mJacobianInv.
transpose()* m * mJacobianInv;
491 Vec3d voxelSize()
const override {
return mVoxelSize; }
510 void accumPreRotation(
Axis axis,
double radians)
513 mMatrix.preRotate(axis, radians);
514 updateAcceleration();
519 updateAcceleration();
523 mMatrix.preTranslate(v);
524 updateAcceleration();
528 mMatrix.preShear(axis0, axis1,
shear);
529 updateAcceleration();
535 void accumPostRotation(
Axis axis,
double radians)
538 mMatrix.postRotate(axis, radians);
539 updateAcceleration();
543 mMatrix.postScale(v);
544 updateAcceleration();
548 mMatrix.postTranslate(v);
549 updateAcceleration();
553 mMatrix.postShear(axis0, axis1,
shear);
554 updateAcceleration();
560 void read(std::istream& is)
override { mMatrix.read(is); updateAcceleration(); }
562 void write(std::ostream& os)
const override { mMatrix.write(os); }
564 std::string
str()
const override
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);
598 return StaticPtrCast<MapBase, AffineMap>(affineMap);
603 affineMap->accumPreScale(s);
604 return StaticPtrCast<MapBase, AffineMap>(affineMap);
609 affineMap->accumPreShear(axis0, axis1,
shear);
621 affineMap->accumPostRotation(axis, radians);
627 affineMap->accumPostTranslation(t);
628 return StaticPtrCast<MapBase, AffineMap>(affineMap);
633 affineMap->accumPostScale(s);
634 return StaticPtrCast<MapBase, AffineMap>(affineMap);
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;
692 mScaleValuesInverse(
Vec3d(1,1,1)),
693 mInvScaleSqr(1,1,1), mInvTwiceScale(0.5,0.5,0.5){}
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)
730 static bool isRegistered() {
return MapRegistry::isRegistered(ScaleMap::mapType()); }
734 MapRegistry::registerMap(
749 std::abs(mScaleValues.x()), std::abs(mScaleValues.y()),
double(5e-7));
751 std::abs(mScaleValues.x()), std::abs(mScaleValues.z()),
double(5e-7));
759 in.
x() * mScaleValues.x(),
760 in.
y() * mScaleValues.y(),
761 in.
z() * mScaleValues.z());
767 in.
x() * mScaleValuesInverse.x(),
768 in.
y() * mScaleValuesInverse.y(),
769 in.
z() * mScaleValuesInverse.z());
779 return applyInverseJacobian(in);
800 for (
int i = 0; i < 3; i++) {
801 tmp.
setRow(i, in.
row(i) * mScaleValuesInverse(i));
803 for (
int i = 0; i < 3; i++) {
804 tmp.
setCol(i, tmp.
col(i) * mScaleValuesInverse(i));
815 return mScaleValues.x() * mScaleValues.y() * mScaleValues.z();
829 Vec3d voxelSize()
const override {
return mVoxelSize; }
837 void read(std::istream& is)
override
839 mScaleValues.read(is);
841 mScaleValuesInverse.read(is);
842 mInvScaleSqr.read(is);
843 mInvTwiceScale.read(is);
846 void write(std::ostream& os)
const override
848 mScaleValues.write(os);
849 mVoxelSize.write(os);
850 mScaleValuesInverse.write(os);
851 mInvScaleSqr.write(os);
852 mInvTwiceScale.write(os);
855 std::string
str()
const override
857 std::ostringstream buffer;
858 buffer <<
" - scale: " << mScaleValues << std::endl;
859 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
863 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
868 if (!mScaleValues.eq(other.mScaleValues)) {
return false; }
888 affineMap->accumPreRotation(axis, radians);
892 MapBase::Ptr preTranslate(
const Vec3d&)
const override;
893 MapBase::Ptr preScale(
const Vec3d&)
const override;
897 affineMap->accumPreShear(axis0, axis1,
shear);
909 affineMap->accumPostRotation(axis, radians);
912 MapBase::Ptr postTranslate(
const Vec3d&)
const override;
913 MapBase::Ptr postScale(
const Vec3d&)
const override;
917 affineMap->accumPostShear(axis0, axis1,
shear);
923 Vec3d mScaleValues, mVoxelSize, mScaleValuesInverse, mInvScaleSqr, mInvTwiceScale;
947 const Vec3d& invScale = getInvScale();
951 static bool isRegistered() {
return MapRegistry::isRegistered(UniformScaleMap::mapType()); }
954 MapRegistry::registerMap(
955 UniformScaleMap::mapType(),
956 UniformScaleMap::create);
962 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
982 ScaleMap::preScale(
const Vec3d& v)
const
984 const Vec3d new_scale(v * mScaleValues);
994 ScaleMap::postScale(
const Vec3d& v)
const
1023 static bool isRegistered() {
return MapRegistry::isRegistered(TranslationMap::mapType()); }
1027 MapRegistry::registerMap(
1028 TranslationMap::mapType(),
1029 TranslationMap::create);
1053 return applyInverseJacobian(in);
1075 return applyIJC(mat);
1092 void read(std::istream& is)
override { mTranslation.read(is); }
1094 void write(std::ostream& os)
const override { mTranslation.write(os); }
1096 std::string
str()
const override
1098 std::ostringstream buffer;
1099 buffer <<
" - translation: " << mTranslation << std::endl;
1100 return buffer.str();
1103 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1108 return mTranslation.eq(other.mTranslation);
1116 Mat4d matrix(Mat4d::identity());
1129 affineMap->accumPreRotation(axis, radians);
1143 affineMap->accumPreShear(axis0, axis1,
shear);
1154 affineMap->accumPostRotation(axis, radians);
1168 affineMap->accumPostShear(axis0, axis1,
shear);
1192 mTranslation(
Vec3d(0,0,0)),
1193 mScaleValues(
Vec3d(1,1,1)),
1194 mVoxelSize(
Vec3d(1,1,1)),
1195 mScaleValuesInverse(
Vec3d(1,1,1)),
1196 mInvScaleSqr(1,1,1),
1197 mInvTwiceScale(0.5,0.5,0.5)
1203 mTranslation(translate),
1204 mScaleValues(
scale),
1211 mScaleValuesInverse = 1.0 / mScaleValues;
1212 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1213 mInvTwiceScale = mScaleValuesInverse / 2;
1218 mTranslation(translate.getTranslation()),
1220 mVoxelSize(
std::abs(mScaleValues(0)),
1221 std::abs(mScaleValues(1)),
1222 std::abs(mScaleValues(2))),
1225 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1226 mInvTwiceScale = mScaleValuesInverse / 2;
1231 mTranslation(other.mTranslation),
1232 mScaleValues(other.mScaleValues),
1233 mVoxelSize(other.mVoxelSize),
1234 mScaleValuesInverse(other.mScaleValuesInverse),
1235 mInvScaleSqr(other.mInvScaleSqr),
1236 mInvTwiceScale(other.mInvTwiceScale)
1249 mScaleValuesInverse, -mScaleValuesInverse * mTranslation));
1252 static bool isRegistered() {
return MapRegistry::isRegistered(ScaleTranslateMap::mapType()); }
1256 MapRegistry::registerMap(
1257 ScaleTranslateMap::mapType(),
1258 ScaleTranslateMap::create);
1272 std::abs(mScaleValues.x()), std::abs(mScaleValues.y()),
double(5e-7));
1274 std::abs(mScaleValues.x()), std::abs(mScaleValues.z()),
double(5e-7));
1282 in.
x() * mScaleValues.x() + mTranslation.x(),
1283 in.
y() * mScaleValues.y() + mTranslation.y(),
1284 in.
z() * mScaleValues.z() + mTranslation.z());
1290 (in.
x() - mTranslation.x() ) * mScaleValuesInverse.x(),
1291 (in.
y() - mTranslation.y() ) * mScaleValuesInverse.y(),
1292 (in.
z() - mTranslation.z() ) * mScaleValuesInverse.z());
1320 in.
x() * mScaleValuesInverse.x(),
1321 in.
y() * mScaleValuesInverse.y(),
1322 in.
z() * mScaleValuesInverse.z());
1328 for (
int i=0; i<3; i++){
1329 tmp.
setRow(i, in.
row(i)*mScaleValuesInverse(i));
1331 for (
int i=0; i<3; i++){
1332 tmp.
setCol(i, tmp.
col(i)*mScaleValuesInverse(i));
1337 return applyIJC(in);
1344 return mScaleValues.x() * mScaleValues.y() * mScaleValues.z();
1364 void read(std::istream& is)
override
1366 mTranslation.read(is);
1367 mScaleValues.read(is);
1368 mVoxelSize.read(is);
1369 mScaleValuesInverse.read(is);
1370 mInvScaleSqr.read(is);
1371 mInvTwiceScale.read(is);
1374 void write(std::ostream& os)
const override
1376 mTranslation.write(os);
1377 mScaleValues.write(os);
1378 mVoxelSize.write(os);
1379 mScaleValuesInverse.write(os);
1380 mInvScaleSqr.write(os);
1381 mInvTwiceScale.write(os);
1384 std::string
str()
const override
1386 std::ostringstream buffer;
1387 buffer <<
" - translation: " << mTranslation << std::endl;
1388 buffer <<
" - scale: " << mScaleValues << std::endl;
1389 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
1390 return buffer.str();
1393 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1398 if (!mScaleValues.eq(other.mScaleValues)) {
return false; }
1399 if (!mTranslation.eq(other.mTranslation)) {
return false; }
1409 affineMap->accumPostTranslation(mTranslation);
1419 affineMap->accumPreRotation(axis, radians);
1424 const Vec3d& s = mScaleValues;
1425 const Vec3d scaled_trans( t.
x() * s.
x(),
1436 affineMap->accumPreShear(axis0, axis1,
shear);
1447 affineMap->accumPostRotation(axis, radians);
1460 affineMap->accumPostShear(axis0, axis1,
shear);
1466 Vec3d mTranslation, mScaleValues, mVoxelSize, mScaleValuesInverse,
1467 mInvScaleSqr, mInvTwiceScale;
1472 ScaleMap::postTranslate(
const Vec3d& t)
const
1479 ScaleMap::preTranslate(
const Vec3d& t)
const
1482 const Vec3d& s = mScaleValues;
1483 const Vec3d scaled_trans( t.
x() * s.
x(),
1514 const Vec3d& scaleInv = getInvScale();
1515 const Vec3d& trans = getTranslation();
1521 return MapRegistry::isRegistered(UniformScaleTranslateMap::mapType());
1526 MapRegistry::registerMap(
1527 UniformScaleTranslateMap::mapType(), UniformScaleTranslateMap::create);
1533 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1546 const Vec3d new_trans = this->getTranslation() +
scale * t;
1561 UniformScaleMap::postTranslate(
const Vec3d& t)
const
1569 UniformScaleMap::preTranslate(
const Vec3d& t)
const
1577 TranslationMap::preScale(
const Vec3d& v)
const
1588 TranslationMap::postScale(
const Vec3d& v)
const
1593 const Vec3d trans(mTranslation.x()*v.
x(),
1594 mTranslation.y()*v.
y(),
1595 mTranslation.z()*v.
z());
1602 ScaleTranslateMap::preScale(
const Vec3d& v)
const
1604 const Vec3d new_scale( v * mScaleValues );
1614 ScaleTranslateMap::postScale(
const Vec3d& v)
const
1616 const Vec3d new_scale( v * mScaleValues );
1617 const Vec3d new_trans( mTranslation.x()*v.
x(),
1618 mTranslation.y()*v.
y(),
1619 mTranslation.z()*v.
z() );
1666 Mat4d matrix(Mat4d::identity());
1675 "4x4 Matrix initializing unitary map was not unitary: not invertible");
1680 "4x4 Matrix initializing unitary map was not unitary: not affine");
1685 "4x4 Matrix initializing unitary map was not unitary: had translation");
1690 "4x4 Matrix initializing unitary map was not unitary");
1698 mAffineMap(other.mAffineMap)
1703 mAffineMap(*(first.getAffineMap()), *(second.getAffineMap()))
1719 static bool isRegistered() {
return MapRegistry::isRegistered(UnitaryMap::mapType()); }
1723 MapRegistry::registerMap(
1724 UnitaryMap::mapType(),
1725 UnitaryMap::create);
1739 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1744 if (mAffineMap!=other.mAffineMap)
return false;
1761 return applyInverseJacobian(in);
1766 return mAffineMap.applyInverseJacobian(in);
1774 return applyInverseMap(in);
1786 return applyIJC(in);
1792 double determinant()
const override {
return mAffineMap.determinant(); }
1803 void read(std::istream& is)
override
1805 mAffineMap.read(is);
1809 void write(std::ostream& os)
const override
1811 mAffineMap.write(os);
1814 std::string
str()
const override
1816 std::ostringstream buffer;
1817 buffer << mAffineMap.str();
1818 return buffer.str();
1831 return StaticPtrCast<MapBase, UnitaryMap>(unitaryMap);
1838 affineMap->accumPreTranslation(t);
1846 affineMap->accumPreScale(v);
1854 affineMap->accumPreShear(axis0, axis1,
shear);
1864 return StaticPtrCast<MapBase, UnitaryMap>(unitaryMap);
1871 affineMap->accumPostTranslation(t);
1879 affineMap->accumPostScale(v);
1887 affineMap->accumPostShear(axis0, axis1,
shear);
1924 MapBase(),mBBox(bb), mTaper(taper), mDepth(depth)
1936 mBBox(bb), mTaper(taper), mDepth(depth)
1938 if (!secondMap->isLinear() ) {
1940 "The second map in the Frustum transfrom must be linear");
1942 mSecondMap = *( secondMap->getAffineMap() );
1949 mTaper(other.mTaper),
1950 mDepth(other.mDepth),
1951 mSecondMap(other.mSecondMap),
1952 mHasSimpleAffine(other.mHasSimpleAffine)
1973 const Vec3d& direction,
1976 double z_near,
double depth,
1984 "The frustum depth must be non-zero and positive");
1986 if (!(up.
length() > 0)) {
1988 "The frustum height must be non-zero and positive");
1990 if (!(aspect > 0)) {
1992 "The frustum aspect ratio must be non-zero and positive");
1996 "The frustum up orientation must be perpendicular to into-frustum direction");
1999 double near_plane_height = 2 * up.
length();
2000 double near_plane_width = aspect * near_plane_height;
2005 mDepth = depth / near_plane_width;
2006 double gamma = near_plane_width / z_near;
2007 mTaper = 1./(mDepth*gamma + 1.);
2009 Vec3d direction_unit = direction;
2012 Mat4d r1(Mat4d::identity());
2014 Mat4d r2(Mat4d::identity());
2018 Vec3d(near_plane_width, near_plane_width, near_plane_width));
2043 "inverseMap() is not implemented for NonlinearFrustumMap");
2045 static bool isRegistered() {
return MapRegistry::isRegistered(NonlinearFrustumMap::mapType()); }
2049 MapRegistry::registerMap(
2050 NonlinearFrustumMap::mapType(),
2051 NonlinearFrustumMap::create);
2072 const Vec3d e1(1,0,0);
2073 if (!applyMap(e1).eq(e1))
return false;
2075 const Vec3d e2(0,1,0);
2076 if (!applyMap(e2).eq(e2))
return false;
2078 const Vec3d e3(0,0,1);
2079 if (!applyMap(e3).eq(e3))
return false;
2084 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
2088 if (mBBox!=other.mBBox)
return false;
2095 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2098 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2101 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2104 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2113 return mSecondMap.applyMap(applyFrustumMap(in));
2119 return applyFrustumInverseMap(mSecondMap.applyInverseMap(in));
2128 Vec3d centered(isloc);
2129 centered = centered - mBBox.min();
2130 centered.
x() -= mXo;
2131 centered.
y() -= mYo;
2134 const double zprime = centered.
z()*mDepthOnLz;
2136 const double scale = (mGamma * zprime + 1.) / mLx;
2137 const double scale2 = mGamma * mDepthOnLz / mLx;
2139 const Vec3d tmp(
scale * in.
x() + scale2 * centered.
x()* in.
z(),
2140 scale * in.
y() + scale2 * centered.
y()* in.
z(),
2141 mDepthOnLz * in.
z());
2143 return mSecondMap.applyJacobian(tmp);
2150 return mSecondMap.applyInverseJacobian(in);
2157 Vec3d centered(isloc);
2158 centered = centered - mBBox.min();
2159 centered.
x() -= mXo;
2160 centered.
y() -= mYo;
2163 const double zprime = centered.
z()*mDepthOnLz;
2165 const double scale = (mGamma * zprime + 1.) / mLx;
2166 const double scale2 = mGamma * mDepthOnLz / mLx;
2169 Vec3d out = mSecondMap.applyInverseJacobian(in);
2171 out.
x() = (out.
x() - scale2 * centered.
x() * out.
z() / mDepthOnLz) /
scale;
2172 out.
y() = (out.
y() - scale2 * centered.
y() * out.
z() / mDepthOnLz) /
scale;
2173 out.
z() = out.
z() / mDepthOnLz;
2181 const Vec3d tmp = mSecondMap.applyJT(in);
2184 Vec3d centered(isloc);
2185 centered = centered - mBBox.min();
2186 centered.
x() -= mXo;
2187 centered.
y() -= mYo;
2190 const double zprime = centered.
z()*mDepthOnLz;
2192 const double scale = (mGamma * zprime + 1.) / mLx;
2193 const double scale2 = mGamma * mDepthOnLz / mLx;
2197 scale2 * centered.
x()* tmp.
x() +
2198 scale2 * centered.
y()* tmp.
y() +
2199 mDepthOnLz * tmp.
z());
2203 return mSecondMap.applyJT(in);
2219 const Vec3d loc = applyFrustumMap(ijk);
2220 const double s = mGamma * loc.
z() + 1.;
2225 " at the singular focal point (e.g. camera)");
2228 const double sinv = 1.0/s;
2229 const double pt0 = mLx * sinv;
2230 const double pt1 = mGamma * pt0;
2231 const double pt2 = pt1 * sinv;
2233 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2236 Mat3d gradE(Mat3d::zero());
2237 for (
int j = 0; j < 3; ++j ) {
2238 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2239 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2240 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2244 for (
int i = 0; i < 3; ++i) {
2245 result(i) = d1_is(0) * gradE(0,i) + d1_is(1) * gradE(1,i) + d1_is(2) * gradE(2,i);
2260 const Vec3d loc = applyFrustumMap(ijk);
2262 const double s = mGamma * loc.
z() + 1.;
2267 " at the singular focal point (e.g. camera)");
2271 const double sinv = 1.0/s;
2272 const double pt0 = mLx * sinv;
2273 const double pt1 = mGamma * pt0;
2274 const double pt2 = pt1 * sinv;
2275 const double pt3 = pt2 * sinv;
2277 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2281 Mat3d matE0(Mat3d::zero());
2282 Mat3d matE1(Mat3d::zero());
2283 for(
int j = 0; j < 3; j++) {
2284 for (
int k = 0; k < 3; k++) {
2286 const double pt4 = 2. * jacinv(2,j) * jacinv(2,k) * pt3;
2288 matE0(j,k) = -(jacinv(0,j) * jacinv(2,k) + jacinv(2,j) * jacinv(0,k)) * pt2 +
2291 matE1(j,k) = -(jacinv(1,j) * jacinv(2,k) + jacinv(2,j) * jacinv(1,k)) * pt2 +
2297 Mat3d gradE(Mat3d::zero());
2298 for (
int j = 0; j < 3; ++j ) {
2299 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2300 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2301 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2304 Mat3d result(Mat3d::zero());
2307 for (
int m = 0; m < 3; ++m ) {
2308 for (
int n = 0; n < 3; ++n) {
2309 for (
int i = 0; i < 3; ++i ) {
2310 for (
int j = 0; j < 3; ++j) {
2311 result(m, n) += gradE(j, m) * gradE(i, n) * d2_is(i, j);
2317 for (
int m = 0; m < 3; ++m ) {
2318 for (
int n = 0; n < 3; ++n) {
2320 matE0(m, n) * d1_is(0) + matE1(m, n) * d1_is(1);
2328 double determinant()
const override {
return mSecondMap.determinant();}
2334 double s = mGamma * loc.
z() + 1.0;
2335 double frustum_determinant = s * s * mDepthOnLzLxLx;
2336 return mSecondMap.determinant() * frustum_determinant;
2342 const Vec3d loc( 0.5*(mBBox.min().x() + mBBox.max().x()),
2343 0.5*(mBBox.min().y() + mBBox.max().y()),
2346 return voxelSize(loc);
2356 Vec3d out, pos = applyMap(loc);
2357 out(0) = (applyMap(loc +
Vec3d(1,0,0)) - pos).length();
2358 out(1) = (applyMap(loc +
Vec3d(0,1,0)) - pos).length();
2359 out(2) = (applyMap(loc +
Vec3d(0,0,1)) - pos).length();
2389 void read(std::istream& is)
override
2400 is.read(reinterpret_cast<char*>(&mTaper),
sizeof(
double));
2401 is.read(reinterpret_cast<char*>(&mDepth),
sizeof(
double));
2407 if(!MapRegistry::isRegistered(type)) {
2412 MapBase::Ptr proxy = math::MapRegistry::createMap(type);
2414 mSecondMap = *(proxy->getAffineMap());
2419 void write(std::ostream& os)
const override
2422 os.write(reinterpret_cast<const char*>(&mTaper),
sizeof(
double));
2423 os.write(reinterpret_cast<const char*>(&mDepth),
sizeof(
double));
2426 mSecondMap.write(os);
2430 std::string
str()
const override
2432 std::ostringstream buffer;
2433 buffer <<
" - taper: " << mTaper << std::endl;
2434 buffer <<
" - depth: " << mDepth << std::endl;
2435 buffer <<
" SecondMap: "<< mSecondMap.type() << std::endl;
2436 buffer << mSecondMap.str() << std::endl;
2437 return buffer.str();
2466 mBBox, mTaper, mDepth, mSecondMap.preShear(
shear, axis0, axis1)));
2495 mBBox, mTaper, mDepth, mSecondMap.postShear(
shear, axis0, axis1)));
2502 mLx = mBBox.extents().x();
2503 mLy = mBBox.extents().y();
2504 mLz = mBBox.extents().z();
2508 " must have at least two index points in each direction.");
2515 mGamma = (1./mTaper - 1) / mDepth;
2517 mDepthOnLz = mDepth/mLz;
2518 mDepthOnLzLxLx = mDepthOnLz/(mLx * mLx);
2521 mHasSimpleAffine =
true;
2522 Vec3d tmp = mSecondMap.voxelSize();
2525 if (!
isApproxEqual(tmp(0), tmp(1))) { mHasSimpleAffine =
false;
return; }
2526 if (!
isApproxEqual(tmp(0), tmp(2))) { mHasSimpleAffine =
false;
return; }
2528 Vec3d trans = mSecondMap.applyMap(
Vec3d(0,0,0));
2530 Vec3d tmp1 = mSecondMap.applyMap(
Vec3d(1,0,0)) - trans;
2531 Vec3d tmp2 = mSecondMap.applyMap(
Vec3d(0,1,0)) - trans;
2532 Vec3d tmp3 = mSecondMap.applyMap(
Vec3d(0,0,1)) - trans;
2535 if (!
isApproxEqual(tmp1.dot(tmp2), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2536 if (!
isApproxEqual(tmp2.dot(tmp3), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2537 if (!
isApproxEqual(tmp3.dot(tmp1), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2546 out = out - mBBox.min();
2551 out.z() *= mDepthOnLz;
2553 double scale = (mGamma * out.z() + 1.)/ mLx;
2562 Vec3d applyFrustumInverseMap(
const Vec3d& in)
const
2566 double invScale = mLx / (mGamma * out.z() + 1.);
2567 out.x() *= invScale;
2568 out.y() *= invScale;
2573 out.z() /= mDepthOnLz;
2576 out = out + mBBox.min();
2588 AffineMap mSecondMap;
2591 double mLx, mLy, mLz;
2592 double mXo, mYo, mGamma, mDepthOnLz, mDepthOnLzLxLx;
2595 bool mHasSimpleAffine;
2605 template<
typename FirstMapType,
typename SecondMapType>
2617 CompoundMap(
const FirstMapType& f,
const SecondMapType& s): mFirstMap(f), mSecondMap(s)
2619 updateAffineMatrix();
2623 mFirstMap(other.mFirstMap),
2624 mSecondMap(other.mSecondMap),
2625 mAffineMap(other.mAffineMap)
2631 return (FirstMapType::mapType() +
Name(
":") + SecondMapType::mapType());
2636 if (mFirstMap != other.mFirstMap)
return false;
2637 if (mSecondMap != other.mSecondMap)
return false;
2638 if (mAffineMap != other.mAffineMap)
return false;
2646 mFirstMap = other.mFirstMap;
2647 mSecondMap = other.mSecondMap;
2648 mAffineMap = other.mAffineMap;
2655 return mAffineMap.isIdentity();
2657 return mFirstMap.isIdentity()&&mSecondMap.isIdentity();
2663 return mAffineMap.isDiagonal();
2665 return mFirstMap.isDiagonal()&&mSecondMap.isDiagonal();
2676 "Constant affine matrix representation not possible for this nonlinear map");
2681 const FirstMapType&
firstMap()
const {
return mFirstMap; }
2682 const SecondMapType&
secondMap()
const {
return mSecondMap; }
2684 void setFirstMap(
const FirstMapType& first) { mFirstMap = first; updateAffineMatrix(); }
2685 void setSecondMap(
const SecondMapType& second) { mSecondMap = second; updateAffineMatrix(); }
2689 mAffineMap.read(is);
2691 mSecondMap.read(is);
2695 mAffineMap.write(os);
2696 mFirstMap.write(os);
2697 mSecondMap.write(os);
2701 void updateAffineMatrix()
2707 mAffineMap =
AffineMap(*first, *second);
2711 FirstMapType mFirstMap;
2712 SecondMapType mSecondMap;
2714 AffineMap mAffineMap;
2721 #endif // OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED
CompoundMap(const FirstMapType &f, const SecondMapType &s)
Definition: Maps.h:2617
void setTranslation(const Vec3< T > &t)
Definition: Mat4.h:360
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:1019
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1771
void setToRotation(const Quat< T > &q)
Set this matrix to the rotation matrix specified by the quaternion.
Definition: Mat3.h:301
static MapBase::Ptr create()
Return a MapBase::Ptr to a new UnitaryMap.
Definition: Maps.h:1710
void read(std::istream &is) override
read serialization
Definition: Maps.h:560
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:498
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:1336
void setMat3(const Mat3< T > &m)
Set upper left to a Mat3.
Definition: Mat4.h:336
const SecondMapType & secondMap() const
Definition: Maps.h:2682
void read(std::istream &is) override
read serialization
Definition: Maps.h:1364
void setCol(int j, const Vec3< T > &v)
Set jth column to vector v.
Definition: Mat3.h:193
Mat4 inverse(T tolerance=0) const
Definition: Mat4.h:531
NonlinearFrustumMap(const NonlinearFrustumMap &other)
Definition: Maps.h:1946
AffineMap::Ptr getAffineMap() const override
Return a AffineMap equivalent to this map.
Definition: Maps.h:875
bool operator!=(const NonlinearFrustumMap &other) const
Definition: Maps.h:2108
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of under the map.
Definition: Maps.h:1287
T & z()
Definition: Vec3.h:112
double determinant(const Vec3d &) const override
Return the product of the scale values, ignores argument.
Definition: Maps.h:1341
A general linear transform using homogeneous coordinates to perform rotation, scaling,...
Definition: Maps.h:327
bool isDiagonal() const
Return true if the underylying matrix is diagonal.
Definition: Maps.h:500
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &) const override
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation)
Definition: Maps.h:778
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1298
bool isValid() const
Definition: Maps.h:2383
static Name mapType()
Definition: Maps.h:740
Name type() const override
Return UnitaryMap.
Definition: Maps.h:1729
OPENVDB_API SharedPtr< FullyDecomposedMap > createFullyDecomposedMap(const Mat4d &m)
General decomposition of a Matrix into a Unitary (e.g. rotation) following a Symmetric (e....
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1032
double determinant() const override
Return the product of the scale values.
Definition: Maps.h:1343
Definition: Exceptions.h:86
UnitaryMap(const Mat3d &m)
Definition: Maps.h:1659
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:2430
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:388
static void registerMap()
Definition: Maps.h:1254
MapBase::Ptr postRotate(double radians, Axis axis) const override
Return a MapBase::Ptr to a new map that is the result of appending the given rotation.
Definition: Maps.h:1860
SharedPtr< UnitaryMap > Ptr
Definition: Maps.h:1637
bool isLinear() const override
Return true (a ScaleMap is always linear).
Definition: Maps.h:743
T & y()
Definition: Vec3.h:111
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:477
Vec3d applyInverseJacobian(const Vec3d &in) const override
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation)
Definition: Maps.h:1765
Axis
Definition: Math.h:856
double determinant() const override
Return the determinant of the Jacobian of linear second map.
Definition: Maps.h:2328
CompoundMap(const MyType &other)
Definition: Maps.h:2622
double determinant() const override
Return the determinant of the Jacobian.
Definition: Maps.h:1792
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1739
Vec3< T > row(int i) const
Get ith row, e.g. Vec3d v = m.row(1);.
Definition: Mat3.h:186
Vec3d applyIJT(const Vec3d &d1_is, const Vec3d &ijk) const override
Definition: Maps.h:2217
bool operator!=(const ScaleTranslateMap &other) const
Definition: Maps.h:1403
MapBase::Ptr preRotate(double radians, Axis axis=X_AXIS) const override
Return a MapBase::Ptr to a new map that is the result of prepending the given rotation to the linear ...
Definition: Maps.h:2442
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const override
Return a MapBase::Ptr to a new map that is the result of prepending the given shear.
Definition: Maps.h:1851
const Mat3d & getConstJacobianInv() const
Definition: Maps.h:647
MapBase::Ptr inverseMap() const override
Not implemented, since there is currently no map type that can represent the inverse of a frustum.
Definition: Maps.h:2040
ScaleMap(const Vec3d &scale)
Definition: Maps.h:695
MapBase::Ptr postTranslate(const Vec3d &t) const override
Return a MapBase::Ptr to a new map that is the result of appending the given translation to the linea...
Definition: Maps.h:2478
static bool isRegistered()
Definition: Maps.h:1023
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1096
double determinant(const Vec3d &) const override
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:486
static bool isRegistered()
Definition: Maps.h:1719
MapBase::Ptr postTranslate(const Vec3d &t) const override
Definition: Maps.h:624
Name readString(std::istream &is)
Definition: Name.h:47
MapBase::Ptr preTranslate(const Vec3d &t) const override
Return a MapBase::Ptr to a new map that is the result of prepending the given translation to the line...
Definition: Maps.h:2449
static void registerMap()
Definition: Maps.h:392
SharedPtr< FullyDecomposedMap > createDecomposedMap()
on-demand decomposition of the affine map
Definition: Maps.h:573
NonlinearFrustumMap()
Definition: Maps.h:1911
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1103
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:443
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1114
AffineMap(const AffineMap &first, const AffineMap &second)
constructor that merges the matrixes for two affine maps
Definition: Maps.h:375
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:1923
ScaleTranslateMap()
Definition: Maps.h:1190
const Vec3d & getTranslation() const
Returns the translation.
Definition: Maps.h:1354
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const override
Return a MapBase::Ptr to a new map that is the result of prepending the given shear to the linear par...
Definition: Maps.h:2463
TranslationMap()
Definition: Maps.h:1008
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:764
MapBase::Ptr postScale(const Vec3d &s) const override
Definition: Maps.h:630
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:1042
void setDepth(double d)
set the frustum depth: distance between near and far plane = frustm depth * frustm x-width
Definition: Maps.h:2370
bool isAffine(const Mat4< T > &m)
Definition: Mat4.h:1350
bool isLinear() const override
Return true (a ScaleTranslateMap is always linear).
Definition: Maps.h:1265
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1048
UnitaryMap(const UnitaryMap &other)
Definition: Maps.h:1696
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: BBox.h:161
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:774
AffineMap(const AffineMap &other)
Definition: Maps.h:362
bool isIdentity(const MatType &m)
Determine if a matrix is an identity matrix.
Definition: Mat.h:892
UnitaryMap(const Vec3d &axis, double radians)
Definition: Maps.h:1645
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1384
Vec3d voxelSize() const override
Return the absolute values of the scale values.
Definition: Maps.h:1347
const Mat4d & getConstMat4() const
Definition: Maps.h:646
Vec3d voxelSize(const Vec3d &) const override
Returns the lengths of the images of the segments (0,0,0) − (1,0,0), (0,0,0) − (0,...
Definition: Maps.h:1799
static void registerMap()
Definition: Maps.h:1025
void writeString(std::ostream &os, const Name &name)
Definition: Name.h:58
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:685
Name type() const
Definition: Maps.h:2628
MapBase::Ptr preRotate(double radians, Axis axis) const override
Return a MapBase::Ptr to a new map that is the result of prepending the given rotation.
Definition: Maps.h:1827
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the linear second map applied to in.
Definition: Maps.h:2122
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:863
Tolerance for floating-point comparison.
Definition: Math.h:117
OPENVDB_API SharedPtr< PolarDecomposedMap > createPolarDecomposedMap(const Mat3d &m)
Decomposes a general linear into translation following polar decomposition.
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1062
Definition: version.h:217
void read(std::istream &is) override
read serialization
Definition: Maps.h:837
SharedPtr< MyType > Ptr
Definition: Maps.h:2611
Mat3d applyIJC(const Mat3d &m) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:479
AffineMap & operator=(const AffineMap &other)
Definition: Maps.h:430
void accumPostTranslation(const Vec3d &v)
Definition: Maps.h:546
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:562
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1064
Vec3d applyJT(const Vec3d &in, const Vec3d &isloc) const override
Return the Jacobian Transpose of the map applied to vector in at indexloc.
Definition: Maps.h:2180
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:846
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const override
Return a MapBase::Ptr to a new map that is the result of appending the given shear to the linear part...
Definition: Maps.h:2492
MapBase::Ptr postTranslate(const Vec3d &t) const override
Definition: Maps.h:1158
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:399
Vec3d voxelSize() const override
Return the size of a voxel at the center of the near plane.
Definition: Maps.h:2340
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:2111
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &isloc) const override
Return the Inverse Jacobian defined at isloc of the map applied to in.
Definition: Maps.h:2153
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:855
MapBase::Ptr postScale(const Vec3d &s) const override
Return a MapBase::Ptr to a new map that is the result of appending the given scale to the linear part...
Definition: Maps.h:2485
bool hasUniformScale() const override
Return false (by convention true)
Definition: Maps.h:1737
double determinant(const Vec3d &) const override
Return the product of the scale values, ignores argument.
Definition: Maps.h:812
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:450
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the linear second map applied to in.
Definition: Maps.h:2207
double getTaper() const
Return the taper value.
Definition: Maps.h:2368
AffineMap(const Mat3d &m)
Definition: Maps.h:345
MapBase::Ptr copy() const override
Returns a MapBase::Ptr to a deep copy of *this.
Definition: Maps.h:1712
bool operator==(const MyType &other) const
Definition: Maps.h:2634
Mat3< T > getMat3() const
Definition: Mat4.h:343
ScaleTranslateMap(const ScaleTranslateMap &other)
Definition: Maps.h:1229
Vec3d voxelSize(const Vec3d &loc) const override
Returns the lengths of the images of the three segments from loc to loc + (1,0,0),...
Definition: Maps.h:2354
Vec3d asVec3d() const
Definition: Coord.h:171
static bool isEqualBase(const MapT &self, const MapBase &other)
Definition: Maps.h:277
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1374
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1261
static void registerMap()
Definition: Maps.h:732
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:1752
OPENVDB_API SharedPtr< SymmetricMap > createSymmetricMap(const Mat3d &m)
Utility methods.
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: Coord.h:517
const Vec3d & getScale() const
Returns the scale values.
Definition: Maps.h:1352
bool operator==(const AffineMap &other) const
Definition: Maps.h:420
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:787
static Name mapType()
Return NonlinearFrustumMap.
Definition: Maps.h:2056
T length() const
Length of the vector.
Definition: Vec3.h:225
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleTranslateMap.
Definition: Maps.h:1242
void setToRotation(Axis axis, T angle)
Sets the matrix to a rotation about the given axis.
Definition: Mat4.h:829
void write(std::ostream &os) const
Definition: Maps.h:2693
static Name mapType()
Definition: Maps.h:400
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:1246
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const override
Return the transpose of the inverse Jacobian (Identity for TranslationMap) of the map applied to in,...
Definition: Maps.h:1068
double determinant(const Vec3d &loc) const override
Definition: Maps.h:2332
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:724
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:772
Vec3d applyInverseJacobian(const Vec3d &in) const override
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation)
Definition: Maps.h:2149
bool isIdentity() const
Return true if the underlying matrix is approximately an identity.
Definition: Maps.h:498
void setFirstMap(const FirstMapType &first)
Definition: Maps.h:2684
double determinant() const override
Return 1.
Definition: Maps.h:1081
T dot(const Vec3< T > &v) const
Dot product.
Definition: Vec3.h:216
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1406
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1244
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1814
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:793
SharedPtr< MapBase > Ptr
Definition: Maps.h:164
Definition: Exceptions.h:83
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1756
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1094
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:2419
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:358
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:1750
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1393
OPENVDB_API SharedPtr< MapBase > simplify(SharedPtr< AffineMap > affine)
reduces an AffineMap to a ScaleMap or a ScaleTranslateMap when it can
bool operator!=(const AffineMap &other) const
Definition: Maps.h:428
void accumPreScale(const Vec3d &v)
Definition: Maps.h:516
static MapBase::Ptr create()
Return a MapBase::Ptr to a new AffineMap.
Definition: Maps.h:384
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature for the linear second map.
Definition: Maps.h:2253
Vec3d applyInverseJacobian(const Vec3d &in) const override
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation)
Definition: Maps.h:1057
void read(std::istream &is)
Definition: Maps.h:2687
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian (Identity for TranslationMap) of the map applied to in.
Definition: Maps.h:1071
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:914
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1309
Vec3d applyInverseJacobian(const Vec3d &in) const override
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation)
Definition: Maps.h:1305
Vec3d voxelSize(const Vec3d &) const override
Return (1,1,1).
Definition: Maps.h:1086
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:2117
Vec3d applyJacobian(const Vec3d &in, const Vec3d &isloc) const override
Return the Jacobian defined at isloc applied to in.
Definition: Maps.h:2124
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:795
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:1785
bool isUnitary(const MatType &m)
Determine if a matrix is unitary (i.e., rotation or reflection).
Definition: Mat.h:921
UnitaryMap(const Mat4d &m)
Definition: Maps.h:1671
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &) const override
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation)
Definition: Maps.h:1052
std::shared_ptr< T > SharedPtr
Definition: Types.h:139
Vec3d voxelSize(const Vec3d &) const override
Definition: Maps.h:494
void read(std::istream &is) override
read serialization
Definition: Maps.h:1092
static bool isRegistered()
Definition: Maps.h:730
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1311
static void registerMap()
Definition: Maps.h:2047
Definition: Exceptions.h:88
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:720
Mat4d getMat4() const
Return the matrix representation of this AffineMap.
Definition: Maps.h:645
static void registerMap()
Definition: Maps.h:1721
Int32 ValueType
Definition: Coord.h:60
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1821
MapBase::Ptr postTranslate(const Vec3d &t) const override
Return a MapBase::Ptr to a new map that is the result of appending the given translation.
Definition: Maps.h:1868
double getGamma() const
Definition: Maps.h:2374
static Name mapType()
Definition: Maps.h:1033
AffineMap::Ptr inverse() const
Return AffineMap::Ptr to the inverse of this map.
Definition: Maps.h:582
static MapBase::Ptr create()
Return a MapBase::Ptr to a new NonlinearFrustumMap.
Definition: Maps.h:2033
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:386
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1046
MapBase::Ptr preTranslate(const Vec3d &t) const override
Definition: Maps.h:1422
bool isLinear() const override
Return true (a UnitaryMap is always linear).
Definition: Maps.h:1734
bool hasUniformScale() const override
Return false ( test if this is unitary with translation )
Definition: Maps.h:406
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:448
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:1184
static bool isRegistered()
Definition: Maps.h:2045
std::string str() const override
string serialization, useful for debugging
Definition: Maps.h:564
const FirstMapType & firstMap() const
Definition: Maps.h:2681
MapBase::Ptr postScale(const Vec3d &v) const override
Return a MapBase::Ptr to a new map that is the result of appending the given scale.
Definition: Maps.h:1876
UnitaryMap(Axis axis, double radians)
Definition: Maps.h:1652
MatType scale(const Vec3< typename MatType::value_type > &s)
Return a matrix that scales by s.
Definition: Mat.h:647
Mat3 inverse(T tolerance=0) const
Definition: Mat3.h:513
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:739
TranslationMap(const TranslationMap &other)
Definition: Maps.h:1010
void read(std::istream &is) override
read serialization
Definition: Maps.h:2389
UnitaryMap()
default constructor makes an Idenity.
Definition: Maps.h:1641
bool isLinear() const override
Return false (a NonlinearFrustumMap is never linear).
Definition: Maps.h:2059
bool hasUniformScale() const override
Return false (by convention false)
Definition: Maps.h:2062
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:822
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:808
MapBase::Ptr preScale(const Vec3d &s) const override
Return a MapBase::Ptr to a new map that is the result of prepending the given scale to the linear par...
Definition: Maps.h:2456
MapBase()
Definition: Maps.h:274
Mat3 transpose() const
returns transpose of this
Definition: Mat3.h:502
void accumPostShear(Axis axis0, Axis axis1, double shear)
Definition: Maps.h:551
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1317
SharedPtr< AffineMap > Ptr
Definition: Maps.h:330
Vec3d voxelSize(const Vec3d &) const override
Return the absolute values of the scale values, ignores argument.
Definition: Maps.h:1349
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:726
void setRow(int i, const Vec3< T > &v)
Set ith row to vector v.
Definition: Mat3.h:175
ScaleTranslateMap(const Vec3d &scale, const Vec3d &translate)
Definition: Maps.h:1201
bool hasTranslation(const Mat4< T > &m)
Definition: Mat4.h:1355
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:445
Vec4< T0 > transform(const Vec4< T0 > &v) const
Transform a Vec4 by post-multiplication.
Definition: Mat4.h:1044
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the second map applied to in.
Definition: Maps.h:2202
bool hasUniformScale() const override
Return true if the scale values have the same magnitude (eg. -1, 1, -1 would be a rotation).
Definition: Maps.h:1269
Vec3d applyInverseJacobian(const Vec3d &in) const override
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation)
Definition: Maps.h:459
MapBase::Ptr preTranslate(const Vec3d &t) const override
Definition: Maps.h:1133
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:271
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:482
void read(std::istream &is) override
read serialization
Definition: Maps.h:1803
double determinant() const override
Return the determinant of the Jacobian.
Definition: Maps.h:488
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:1714
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1773
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1017
bool isInvertible(const MatType &m)
Determine if a matrix is invertible.
Definition: Mat.h:901
bool isDiagonal(const MatType &mat)
Determine if a matrix is diagonal.
Definition: Mat.h:934
bool isScaleTranslate() const
Return true if the map is equivalent to a ScaleTranslateMap.
Definition: Maps.h:504
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:1361
void accumPreTranslation(const Vec3d &v)
Definition: Maps.h:521
T det() const
Determinant of matrix.
Definition: Mat3.h:527
Mat3d applyIJC(const Mat3d &mat) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1073
A specialized linear transform that performs a unitary maping i.e. rotation and or reflection.
Definition: Maps.h:1634
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:177
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Definition: Maps.h:1754
T & x()
Reference to the component, e.g. v.x() = 4.5f;.
Definition: Vec3.h:110
OPENVDB_API Mat4d approxInverse(const Mat4d &mat)
Returns the left pseudoInverse of the input matrix when the 3x3 part is symmetric otherwise it zeros ...
bool isIdentity() const
Return true if the map is equivalent to an identity.
Definition: Maps.h:2065
static bool isRegistered()
Definition: Maps.h:390
T * asPointer()
Definition: Vec3.h:119
const AffineMap & secondMap() const
Return MapBase::Ptr& to the second map.
Definition: Maps.h:2380
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1296
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1784
CompoundMap< CompoundMap< UnitaryMap, ScaleMap >, UnitaryMap > SpectralDecomposedMap
Definition: Maps.h:72
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:1433
Vec3< double > Vec3d
Definition: Vec3.h:689
double determinant(const Vec3d &) const override
Return 1.
Definition: Maps.h:1079
bool isIdentity() const
Definition: Maps.h:2652
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleMap.
Definition: Maps.h:722
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:2084
Vec3d applyInverseJacobian(const Vec3d &in) const override
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation)
Definition: Maps.h:783
bool normalize(T eps=T(1.0e-7))
this = normalized this
Definition: Vec3.h:387
double determinant() const override
Return the product of the scale values.
Definition: Maps.h:814
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:894
static Name mapType()
Definition: Maps.h:1262
Abstract base class for maps.
Definition: Maps.h:161
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:756
UnitaryMap(const UnitaryMap &first, const UnitaryMap &second)
Definition: Maps.h:1702
ScaleMap(const ScaleMap &other)
Definition: Maps.h:709
AffineMap()
Definition: Maps.h:333
bool isLinear() const override
Return true (an AffineMap is always linear).
Definition: Maps.h:403
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &) const override
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation)
Definition: Maps.h:454
MapBase::Ptr preScale(const Vec3d &v) const override
Return a MapBase::Ptr to a new map that is the result of prepending the given scale.
Definition: Maps.h:1843
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Definition: Maps.h:465
Vec3d applyMap(const Vec3d &in) const override
Return the image of under the map.
Definition: Maps.h:1279
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:826
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:418
MapBase::Ptr postTranslate(const Vec3d &t) const override
Definition: Maps.h:1450
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &) const override
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation)
Definition: Maps.h:1760
bool isType() const
Return true if this map is of concrete type MapT (e.g., AffineMap).
Definition: Maps.h:177
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:2035
bool operator==(const ScaleTranslateMap &other) const
Definition: Maps.h:1395
bool operator==(const ScaleMap &other) const
Definition: Maps.h:865
static MapBase::Ptr create()
Return a MapBase::Ptr to a new TranslationMap.
Definition: Maps.h:1015
const BBoxd & getBBox() const
Return the bounding box that defines the frustum in pre-image space.
Definition: Maps.h:2377
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:636
Vec3d voxelSize() const override
Returns the lengths of the images of the segments (0,0,0) − (1,0,0), (0,0,0) − (0,...
Definition: Maps.h:1798
const Vec3d & getScale() const
Return the scale values that define the map.
Definition: Maps.h:819
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:1165
Vec3< T > col(int j) const
Get jth column, e.g. Vec3d v = m.col(0);.
Definition: Mat3.h:202
SharedPtr< const MyType > ConstPtr
Definition: Maps.h:2612
Vec3< typename MatType::value_type > getScale(const MatType &mat)
Return a Vec3 representing the lengths of the passed matrix's upper 3×3's rows.
Definition: Mat.h:665
Vec3d voxelSize(const Vec3d &) const override
Definition: Maps.h:833
void setSecondMap(const SecondMapType &second)
Definition: Maps.h:2685
AffineMap::Ptr getAffineMap() const
Definition: Maps.h:2669
bool hasSimpleAffine() const
Return true if the second map is a uniform scale, Rotation and translation.
Definition: Maps.h:2386
Threadsafe singleton object for accessing the map type-name dictionary. Associates a map type-name wi...
Definition: Maps.h:289
OPENVDB_API uint32_t getFormatVersion(std::ios_base &)
Return the file format version number associated with the given input stream.
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:125
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const override
Return a MapBase::Ptr to a new map that is the result of appending the given shear.
Definition: Maps.h:1884
SharedPtr< const MapBase > ConstPtr
Definition: Maps.h:165
const Coord & min() const
Definition: Coord.h:344
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:1140
float Round(float x)
Return x rounded to the nearest integer.
Definition: Math.h:773
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:1934
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:1359
TranslationMap(const Vec3d &t)
Definition: Maps.h:1009
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:1357
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:606
static bool isRegistered()
Definition: Maps.h:1252
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:797
bool operator==(const UnitaryMap &other) const
Definition: Maps.h:1741
Ptr(*)() MapFactory
Definition: Maps.h:166
Mat4< double > Mat4d
Definition: Mat4.h:1361
AffineMap::Ptr getAffineMap() const override
Definition: Maps.h:2363
A specialized linear transform that performs a translation.
Definition: Maps.h:1001
bool hasUniformScale() const override
Return false (by convention true)
Definition: Maps.h:1039
double determinant(const Vec3d &) const override
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:1790
void accumPostScale(const Vec3d &v)
Definition: Maps.h:541
double getDepth() const
Return the unscaled frustm depth.
Definition: Maps.h:2372
bool operator==(const NonlinearFrustumMap &other) const
Definition: Maps.h:2086
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:1457
MyType & operator=(const MyType &other)
Definition: Maps.h:2644
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:789
const Vec3d & getTranslation() const
Return the translation vector.
Definition: Maps.h:1089
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:1044
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1325
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:1905
void setTaper(double t)
set the taper value, the ratio of nearplane width / far plane width
Definition: Maps.h:2366
Definition: Exceptions.h:40
MapBase::Ptr preTranslate(const Vec3d &t) const override
Definition: Maps.h:594
Mat3< double > Mat3d
Definition: Mat3.h:843
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1782
static Name mapType()
Return UnitaryMap.
Definition: Maps.h:1731
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to a deep copy of the current AffineMap.
Definition: Maps.h:579
std::map< Name, MapBase::MapFactory > MapDictionary
Definition: Maps.h:292
Creates the composition of two maps, each of which could be a composition. In the case that each comp...
Definition: Maps.h:69
bool isDiagonal() const
Definition: Maps.h:2661
ScaleTranslateMap(const ScaleMap &scale, const TranslationMap &translate)
Definition: Maps.h:1216
ScaleMap()
Definition: Maps.h:691
Vec3d voxelSize() const override
Return (1,1,1).
Definition: Maps.h:1084
Name type() const override
Return NonlinearFrustumMap.
Definition: Maps.h:2054
MapBase::Ptr preTranslate(const Vec3d &t) const override
Return a MapBase::Ptr to a new map that is the result of prepending the given translation.
Definition: Maps.h:1835
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:467
Map traits.
Definition: Maps.h:82
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1780
std::string Name
Definition: Name.h:44
bool hasUniformScale() const override
Return true if the values have the same magitude (eg. -1, 1, -1 would be a rotation).
Definition: Maps.h:746
MapBase::Ptr preScale(const Vec3d &s) const override
Definition: Maps.h:600
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &) const override
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation)
Definition: Maps.h:1302
MapBase::Ptr postRotate(double radians, Axis axis=X_AXIS) const override
Return a MapBase::Ptr to a new map that is the result of appending the given rotation to the linear p...
Definition: Maps.h:2471
void accumPreShear(Axis axis0, Axis axis1, double shear)
Definition: Maps.h:526
static Name mapType()
Definition: Maps.h:2629
bool operator!=(const MyType &other) const
Definition: Maps.h:2642
bool isLinear() const override
Return true (a TranslationMap is always linear).
Definition: Maps.h:1036
AffineMap(const Mat4d &m)
Definition: Maps.h:353
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:109
math::BBox< Vec3d > BBoxd
Definition: Types.h:91
Mat3d applyIJC(const Mat3d &d2_is, const Vec3d &d1_is, const Vec3d &ijk) const override
Definition: Maps.h:2258
bool operator!=(const UnitaryMap &other) const
Definition: Maps.h:1748
CompoundMap()
Definition: Maps.h:2615
bool operator!=(const TranslationMap &other) const
Definition: Maps.h:1111
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1315
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:1972
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1809
bool isScale() const
Return true if the map is equivalent to a ScaleMap.
Definition: Maps.h:502
const Coord & max() const
Definition: Coord.h:345
bool operator!=(const ScaleMap &other) const
Definition: Maps.h:872
Mat3d applyIJC(const Mat3d &mat, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:1074
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:824
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:475
bool operator==(const TranslationMap &other) const
Definition: Maps.h:1105