33 #ifndef OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED 34 #define OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED 59 class ScaleTranslateMap;
60 class UniformScaleMap;
61 class UniformScaleTranslateMap;
64 class NonlinearFrustumMap;
79 template<
typename T>
struct is_linear {
static const bool value =
false; };
83 template<>
struct is_linear<UnitaryMap> {
static const bool value =
true; };
99 static const bool value =
true;
103 template<
typename T>
struct is_scale {
static const bool value =
false; };
163 using MapFactory =
Ptr (*)();
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&);
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.0 / pow(std::abs(det), 1.0/3.0));
415 bool isEqual(
const MapBase& other)
const override {
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;
452 return applyInverseJacobian(in);
457 return mMatrixInv.transform3x3(in);
466 return Vec3d( m[ 0] * in[0] + m[ 1] * in[1] + m[ 2] * in[2],
467 m[ 4] * in[0] + m[ 5] * in[1] + m[ 6] * in[2],
468 m[ 8] * in[0] + m[ 9] * in[1] + m[10] * in[2] );
477 return mJacobianInv.
transpose()* m * mJacobianInv;
488 Vec3d voxelSize()
const override {
return mVoxelSize; }
507 void accumPreRotation(
Axis axis,
double radians)
510 mMatrix.preRotate(axis, radians);
511 updateAcceleration();
516 updateAcceleration();
520 mMatrix.preTranslate(v);
521 updateAcceleration();
525 mMatrix.preShear(axis0, axis1, shear);
526 updateAcceleration();
532 void accumPostRotation(
Axis axis,
double radians)
535 mMatrix.postRotate(axis, radians);
536 updateAcceleration();
540 mMatrix.postScale(v);
541 updateAcceleration();
545 mMatrix.postTranslate(v);
546 updateAcceleration();
550 mMatrix.postShear(axis0, axis1, shear);
551 updateAcceleration();
557 void read(std::istream& is)
override { mMatrix.read(is); updateAcceleration(); }
559 void write(std::ostream& os)
const override { mMatrix.write(os); }
561 std::string
str()
const override 563 std::ostringstream buffer;
564 buffer <<
" - mat4:\n" << mMatrix.str() << std::endl;
565 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
588 affineMap->accumPreRotation(axis, radians);
594 affineMap->accumPreTranslation(t);
595 return StaticPtrCast<MapBase, AffineMap>(affineMap);
600 affineMap->accumPreScale(s);
601 return StaticPtrCast<MapBase, AffineMap>(affineMap);
606 affineMap->accumPreShear(axis0, axis1, shear);
618 affineMap->accumPostRotation(axis, radians);
624 affineMap->accumPostTranslation(t);
625 return StaticPtrCast<MapBase, AffineMap>(affineMap);
630 affineMap->accumPostScale(s);
631 return StaticPtrCast<MapBase, AffineMap>(affineMap);
636 affineMap->accumPostShear(axis0, axis1, shear);
647 void updateAcceleration() {
648 Mat3d mat3 = mMatrix.getMat3();
649 mDeterminant = mat3.
det();
653 "Tried to initialize an affine transform from a nearly singular matrix");
655 mMatrixInv = mMatrix.inverse();
660 mVoxelSize(0) = (applyMap(
Vec3d(1,0,0)) - pos).length();
661 mVoxelSize(1) = (applyMap(
Vec3d(0,1,0)) - pos).length();
662 mVoxelSize(2) = (applyMap(
Vec3d(0,0,1)) - pos).length();
673 bool mIsDiagonal, mIsIdentity;
689 mScaleValuesInverse(
Vec3d(1,1,1)),
690 mInvScaleSqr(1,1,1), mInvTwiceScale(0.5,0.5,0.5){}
695 mVoxelSize(
Vec3d(std::abs(scale(0)),std::abs(scale(1)), std::abs(scale(2))))
697 double determinant = scale[0]* scale[1] * scale[2];
701 mScaleValuesInverse = 1.0 / mScaleValues;
702 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
703 mInvTwiceScale = mScaleValuesInverse / 2;
708 mScaleValues(other.mScaleValues),
709 mVoxelSize(other.mVoxelSize),
710 mScaleValuesInverse(other.mScaleValuesInverse),
711 mInvScaleSqr(other.mInvScaleSqr),
712 mInvTwiceScale(other.mInvTwiceScale)
727 static bool isRegistered() {
return MapRegistry::isRegistered(ScaleMap::mapType()); }
731 MapRegistry::registerMap(
746 std::abs(mScaleValues.x()), std::abs(mScaleValues.y()),
double(5e-7));
748 std::abs(mScaleValues.x()), std::abs(mScaleValues.z()),
double(5e-7));
756 in.
x() * mScaleValues.x(),
757 in.
y() * mScaleValues.y(),
758 in.
z() * mScaleValues.z());
764 in.
x() * mScaleValuesInverse.x(),
765 in.
y() * mScaleValuesInverse.y(),
766 in.
z() * mScaleValuesInverse.z());
776 return applyInverseJacobian(in);
797 for (
int i = 0; i < 3; i++) {
798 tmp.
setRow(i, in.
row(i) * mScaleValuesInverse(i));
800 for (
int i = 0; i < 3; i++) {
801 tmp.
setCol(i, tmp.
col(i) * mScaleValuesInverse(i));
812 return mScaleValues.x() * mScaleValues.y() * mScaleValues.z();
826 Vec3d voxelSize()
const override {
return mVoxelSize; }
834 void read(std::istream& is)
override 836 mScaleValues.read(is);
838 mScaleValuesInverse.read(is);
839 mInvScaleSqr.read(is);
840 mInvTwiceScale.read(is);
843 void write(std::ostream& os)
const override 845 mScaleValues.write(os);
846 mVoxelSize.write(os);
847 mScaleValuesInverse.write(os);
848 mInvScaleSqr.write(os);
849 mInvTwiceScale.write(os);
852 std::string
str()
const override 854 std::ostringstream buffer;
855 buffer <<
" - scale: " << mScaleValues << std::endl;
856 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
860 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
865 if (!mScaleValues.eq(other.mScaleValues)) {
return false; }
885 affineMap->accumPreRotation(axis, radians);
894 affineMap->accumPreShear(axis0, axis1, shear);
906 affineMap->accumPostRotation(axis, radians);
914 affineMap->accumPostShear(axis0, axis1, shear);
920 Vec3d mScaleValues, mVoxelSize, mScaleValuesInverse, mInvScaleSqr, mInvTwiceScale;
944 const Vec3d& invScale = getInvScale();
948 static bool isRegistered() {
return MapRegistry::isRegistered(UniformScaleMap::mapType()); }
951 MapRegistry::registerMap(
952 UniformScaleMap::mapType(),
953 UniformScaleMap::create);
959 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
979 ScaleMap::preScale(
const Vec3d& v)
const 981 const Vec3d new_scale(v * mScaleValues);
991 ScaleMap::postScale(
const Vec3d& v)
const 1020 static bool isRegistered() {
return MapRegistry::isRegistered(TranslationMap::mapType()); }
1024 MapRegistry::registerMap(
1025 TranslationMap::mapType(),
1026 TranslationMap::create);
1050 return applyInverseJacobian(in);
1072 return applyIJC(mat);
1089 void read(std::istream& is)
override { mTranslation.read(is); }
1091 void write(std::ostream& os)
const override { mTranslation.write(os); }
1093 std::string
str()
const override 1095 std::ostringstream buffer;
1096 buffer <<
" - translation: " << mTranslation << std::endl;
1097 return buffer.str();
1100 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1105 return mTranslation.eq(other.mTranslation);
1126 affineMap->accumPreRotation(axis, radians);
1140 affineMap->accumPreShear(axis0, axis1, shear);
1151 affineMap->accumPostRotation(axis, radians);
1165 affineMap->accumPostShear(axis0, axis1, shear);
1189 mTranslation(
Vec3d(0,0,0)),
1190 mScaleValues(
Vec3d(1,1,1)),
1191 mVoxelSize(
Vec3d(1,1,1)),
1192 mScaleValuesInverse(
Vec3d(1,1,1)),
1193 mInvScaleSqr(1,1,1),
1194 mInvTwiceScale(0.5,0.5,0.5)
1200 mTranslation(translate),
1201 mScaleValues(scale),
1202 mVoxelSize(std::abs(scale(0)), std::abs(scale(1)), std::abs(scale(2)))
1204 const double determinant = scale[0]* scale[1] * scale[2];
1208 mScaleValuesInverse = 1.0 / mScaleValues;
1209 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1210 mInvTwiceScale = mScaleValuesInverse / 2;
1215 mTranslation(translate.getTranslation()),
1217 mVoxelSize(std::abs(mScaleValues(0)),
1218 std::abs(mScaleValues(1)),
1219 std::abs(mScaleValues(2))),
1220 mScaleValuesInverse(1.0 / scale.
getScale())
1222 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1223 mInvTwiceScale = mScaleValuesInverse / 2;
1228 mTranslation(other.mTranslation),
1229 mScaleValues(other.mScaleValues),
1230 mVoxelSize(other.mVoxelSize),
1231 mScaleValuesInverse(other.mScaleValuesInverse),
1232 mInvScaleSqr(other.mInvScaleSqr),
1233 mInvTwiceScale(other.mInvTwiceScale)
1246 mScaleValuesInverse, -mScaleValuesInverse * mTranslation));
1249 static bool isRegistered() {
return MapRegistry::isRegistered(ScaleTranslateMap::mapType()); }
1253 MapRegistry::registerMap(
1254 ScaleTranslateMap::mapType(),
1255 ScaleTranslateMap::create);
1269 std::abs(mScaleValues.x()), std::abs(mScaleValues.y()),
double(5e-7));
1271 std::abs(mScaleValues.x()), std::abs(mScaleValues.z()),
double(5e-7));
1279 in.
x() * mScaleValues.x() + mTranslation.x(),
1280 in.
y() * mScaleValues.y() + mTranslation.y(),
1281 in.
z() * mScaleValues.z() + mTranslation.z());
1287 (in.
x() - mTranslation.x() ) * mScaleValuesInverse.x(),
1288 (in.
y() - mTranslation.y() ) * mScaleValuesInverse.y(),
1289 (in.
z() - mTranslation.z() ) * mScaleValuesInverse.z());
1317 in.
x() * mScaleValuesInverse.x(),
1318 in.
y() * mScaleValuesInverse.y(),
1319 in.
z() * mScaleValuesInverse.z());
1325 for (
int i=0; i<3; i++){
1326 tmp.
setRow(i, in.
row(i)*mScaleValuesInverse(i));
1328 for (
int i=0; i<3; i++){
1329 tmp.
setCol(i, tmp.
col(i)*mScaleValuesInverse(i));
1334 return applyIJC(in);
1341 return mScaleValues.x() * mScaleValues.y() * mScaleValues.z();
1361 void read(std::istream& is)
override 1363 mTranslation.read(is);
1364 mScaleValues.read(is);
1365 mVoxelSize.read(is);
1366 mScaleValuesInverse.read(is);
1367 mInvScaleSqr.read(is);
1368 mInvTwiceScale.read(is);
1371 void write(std::ostream& os)
const override 1373 mTranslation.write(os);
1374 mScaleValues.write(os);
1375 mVoxelSize.write(os);
1376 mScaleValuesInverse.write(os);
1377 mInvScaleSqr.write(os);
1378 mInvTwiceScale.write(os);
1381 std::string
str()
const override 1383 std::ostringstream buffer;
1384 buffer <<
" - translation: " << mTranslation << std::endl;
1385 buffer <<
" - scale: " << mScaleValues << std::endl;
1386 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
1387 return buffer.str();
1390 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1395 if (!mScaleValues.eq(other.mScaleValues)) {
return false; }
1396 if (!mTranslation.eq(other.mTranslation)) {
return false; }
1406 affineMap->accumPostTranslation(mTranslation);
1416 affineMap->accumPreRotation(axis, radians);
1421 const Vec3d& s = mScaleValues;
1422 const Vec3d scaled_trans( t.
x() * s.
x(),
1433 affineMap->accumPreShear(axis0, axis1, shear);
1444 affineMap->accumPostRotation(axis, radians);
1457 affineMap->accumPostShear(axis0, axis1, shear);
1463 Vec3d mTranslation, mScaleValues, mVoxelSize, mScaleValuesInverse,
1464 mInvScaleSqr, mInvTwiceScale;
1469 ScaleMap::postTranslate(
const Vec3d& t)
const 1476 ScaleMap::preTranslate(
const Vec3d& t)
const 1479 const Vec3d& s = mScaleValues;
1480 const Vec3d scaled_trans( t.
x() * s.
x(),
1511 const Vec3d& scaleInv = getInvScale();
1512 const Vec3d& trans = getTranslation();
1518 return MapRegistry::isRegistered(UniformScaleTranslateMap::mapType());
1523 MapRegistry::registerMap(
1524 UniformScaleTranslateMap::mapType(), UniformScaleTranslateMap::create);
1530 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1543 const Vec3d new_trans = this->getTranslation() + scale * t;
1558 UniformScaleMap::postTranslate(
const Vec3d& t)
const 1566 UniformScaleMap::preTranslate(
const Vec3d& t)
const 1574 TranslationMap::preScale(
const Vec3d& v)
const 1585 TranslationMap::postScale(
const Vec3d& v)
const 1590 const Vec3d trans(mTranslation.x()*v.
x(),
1591 mTranslation.y()*v.
y(),
1592 mTranslation.z()*v.
z());
1599 ScaleTranslateMap::preScale(
const Vec3d& v)
const 1601 const Vec3d new_scale( v * mScaleValues );
1611 ScaleTranslateMap::postScale(
const Vec3d& v)
const 1613 const Vec3d new_scale( v * mScaleValues );
1614 const Vec3d new_trans( mTranslation.x()*v.
x(),
1615 mTranslation.y()*v.
y(),
1616 mTranslation.z()*v.
z() );
1672 "4x4 Matrix initializing unitary map was not unitary: not invertible");
1677 "4x4 Matrix initializing unitary map was not unitary: not affine");
1682 "4x4 Matrix initializing unitary map was not unitary: had translation");
1687 "4x4 Matrix initializing unitary map was not unitary");
1695 mAffineMap(other.mAffineMap)
1700 mAffineMap(*(first.getAffineMap()), *(second.getAffineMap()))
1704 ~UnitaryMap()
override =
default;
1713 return MapBase::Ptr(
new UnitaryMap(mAffineMap.getMat4().inverse()));
1716 static bool isRegistered() {
return MapRegistry::isRegistered(UnitaryMap::mapType()); }
1720 MapRegistry::registerMap(
1721 UnitaryMap::mapType(),
1722 UnitaryMap::create);
1736 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1741 if (mAffineMap!=other.mAffineMap)
return false;
1745 bool operator!=(
const UnitaryMap& other)
const {
return !(*
this == other); }
1758 return applyInverseJacobian(in);
1763 return mAffineMap.applyInverseJacobian(in);
1771 return applyInverseMap(in);
1783 return applyIJC(in);
1789 double determinant()
const override {
return mAffineMap.determinant(); }
1800 void read(std::istream& is)
override 1802 mAffineMap.read(is);
1806 void write(std::ostream& os)
const override 1808 mAffineMap.write(os);
1811 std::string
str()
const override 1813 std::ostringstream buffer;
1814 buffer << mAffineMap.str();
1815 return buffer.str();
1826 UnitaryMap first(axis, radians);
1828 return StaticPtrCast<MapBase, UnitaryMap>(unitaryMap);
1835 affineMap->accumPreTranslation(t);
1843 affineMap->accumPreScale(v);
1851 affineMap->accumPreShear(axis0, axis1, shear);
1859 UnitaryMap second(axis, radians);
1861 return StaticPtrCast<MapBase, UnitaryMap>(unitaryMap);
1868 affineMap->accumPostTranslation(t);
1876 affineMap->accumPostScale(v);
1884 affineMap->accumPostShear(axis0, axis1, shear);
1921 MapBase(),mBBox(bb), mTaper(taper), mDepth(depth)
1933 mBBox(bb), mTaper(taper), mDepth(depth)
1935 if (!secondMap->isLinear() ) {
1937 "The second map in the Frustum transfrom must be linear");
1939 mSecondMap = *( secondMap->getAffineMap() );
1946 mTaper(other.mTaper),
1947 mDepth(other.mDepth),
1948 mSecondMap(other.mSecondMap),
1949 mHasSimpleAffine(other.mHasSimpleAffine)
1970 const Vec3d& direction,
1973 double z_near,
double depth,
1981 "The frustum depth must be non-zero and positive");
1983 if (!(up.
length() > 0)) {
1985 "The frustum height must be non-zero and positive");
1987 if (!(aspect > 0)) {
1989 "The frustum aspect ratio must be non-zero and positive");
1993 "The frustum up orientation must be perpendicular to into-frustum direction");
1996 double near_plane_height = 2 * up.
length();
1997 double near_plane_width = aspect * near_plane_height;
2002 mDepth = depth / near_plane_width;
2003 double gamma = near_plane_width / z_near;
2004 mTaper = 1./(mDepth*gamma + 1.);
2006 Vec3d direction_unit = direction;
2015 Vec3d(near_plane_width, near_plane_width, near_plane_width));
2019 Mat4d mat = scale * r2 * r1;
2040 "inverseMap() is not implemented for NonlinearFrustumMap");
2042 static bool isRegistered() {
return MapRegistry::isRegistered(NonlinearFrustumMap::mapType()); }
2046 MapRegistry::registerMap(
2047 NonlinearFrustumMap::mapType(),
2048 NonlinearFrustumMap::create);
2069 const Vec3d e1(1,0,0);
2070 if (!applyMap(e1).eq(e1))
return false;
2072 const Vec3d e2(0,1,0);
2073 if (!applyMap(e2).eq(e2))
return false;
2075 const Vec3d e3(0,0,1);
2076 if (!applyMap(e3).eq(e3))
return false;
2081 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
2085 if (mBBox!=other.mBBox)
return false;
2092 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
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;
2110 return mSecondMap.applyMap(applyFrustumMap(in));
2116 return applyFrustumInverseMap(mSecondMap.applyInverseMap(in));
2125 Vec3d centered(isloc);
2126 centered = centered - mBBox.min();
2127 centered.
x() -= mXo;
2128 centered.
y() -= mYo;
2131 const double zprime = centered.
z()*mDepthOnLz;
2133 const double scale = (mGamma * zprime + 1.) / mLx;
2134 const double scale2 = mGamma * mDepthOnLz / mLx;
2136 const Vec3d tmp(scale * in.
x() + scale2 * centered.
x()* in.
z(),
2137 scale * in.
y() + scale2 * centered.
y()* in.
z(),
2138 mDepthOnLz * in.
z());
2140 return mSecondMap.applyJacobian(tmp);
2147 return mSecondMap.applyInverseJacobian(in);
2154 Vec3d centered(isloc);
2155 centered = centered - mBBox.min();
2156 centered.
x() -= mXo;
2157 centered.
y() -= mYo;
2160 const double zprime = centered.
z()*mDepthOnLz;
2162 const double scale = (mGamma * zprime + 1.) / mLx;
2163 const double scale2 = mGamma * mDepthOnLz / mLx;
2166 Vec3d out = mSecondMap.applyInverseJacobian(in);
2168 out.
x() = (out.
x() - scale2 * centered.
x() * out.
z() / mDepthOnLz) / scale;
2169 out.
y() = (out.
y() - scale2 * centered.
y() * out.
z() / mDepthOnLz) / scale;
2170 out.
z() = out.
z() / mDepthOnLz;
2178 const Vec3d tmp = mSecondMap.applyJT(in);
2181 Vec3d centered(isloc);
2182 centered = centered - mBBox.min();
2183 centered.
x() -= mXo;
2184 centered.
y() -= mYo;
2187 const double zprime = centered.
z()*mDepthOnLz;
2189 const double scale = (mGamma * zprime + 1.) / mLx;
2190 const double scale2 = mGamma * mDepthOnLz / mLx;
2192 return Vec3d(scale * tmp.
x(),
2194 scale2 * centered.
x()* tmp.
x() +
2195 scale2 * centered.
y()* tmp.
y() +
2196 mDepthOnLz * tmp.
z());
2200 return mSecondMap.applyJT(in);
2216 const Vec3d loc = applyFrustumMap(ijk);
2217 const double s = mGamma * loc.
z() + 1.;
2222 " at the singular focal point (e.g. camera)");
2225 const double sinv = 1.0/s;
2226 const double pt0 = mLx * sinv;
2227 const double pt1 = mGamma * pt0;
2228 const double pt2 = pt1 * sinv;
2230 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2233 Mat3d gradE(Mat3d::zero());
2234 for (
int j = 0; j < 3; ++j ) {
2235 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2236 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2237 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2241 for (
int i = 0; i < 3; ++i) {
2242 result(i) = d1_is(0) * gradE(0,i) + d1_is(1) * gradE(1,i) + d1_is(2) * gradE(2,i);
2257 const Vec3d loc = applyFrustumMap(ijk);
2259 const double s = mGamma * loc.
z() + 1.;
2264 " at the singular focal point (e.g. camera)");
2268 const double sinv = 1.0/s;
2269 const double pt0 = mLx * sinv;
2270 const double pt1 = mGamma * pt0;
2271 const double pt2 = pt1 * sinv;
2272 const double pt3 = pt2 * sinv;
2274 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2278 Mat3d matE0(Mat3d::zero());
2279 Mat3d matE1(Mat3d::zero());
2280 for(
int j = 0; j < 3; j++) {
2281 for (
int k = 0; k < 3; k++) {
2283 const double pt4 = 2. * jacinv(2,j) * jacinv(2,k) * pt3;
2285 matE0(j,k) = -(jacinv(0,j) * jacinv(2,k) + jacinv(2,j) * jacinv(0,k)) * pt2 +
2288 matE1(j,k) = -(jacinv(1,j) * jacinv(2,k) + jacinv(2,j) * jacinv(1,k)) * pt2 +
2294 Mat3d gradE(Mat3d::zero());
2295 for (
int j = 0; j < 3; ++j ) {
2296 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2297 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2298 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2301 Mat3d result(Mat3d::zero());
2304 for (
int m = 0; m < 3; ++m ) {
2305 for (
int n = 0; n < 3; ++n) {
2306 for (
int i = 0; i < 3; ++i ) {
2307 for (
int j = 0; j < 3; ++j) {
2308 result(m, n) += gradE(j, m) * gradE(i, n) * d2_is(i, j);
2314 for (
int m = 0; m < 3; ++m ) {
2315 for (
int n = 0; n < 3; ++n) {
2317 matE0(m, n) * d1_is(0) + matE1(m, n) * d1_is(1);
2325 double determinant()
const override {
return mSecondMap.determinant();}
2331 double s = mGamma * loc.
z() + 1.0;
2332 double frustum_determinant = s * s * mDepthOnLzLxLx;
2333 return mSecondMap.determinant() * frustum_determinant;
2339 const Vec3d loc( 0.5*(mBBox.min().x() + mBBox.max().x()),
2340 0.5*(mBBox.min().y() + mBBox.max().y()),
2343 return voxelSize(loc);
2353 Vec3d out, pos = applyMap(loc);
2354 out(0) = (applyMap(loc +
Vec3d(1,0,0)) - pos).length();
2355 out(1) = (applyMap(loc +
Vec3d(0,1,0)) - pos).length();
2356 out(2) = (applyMap(loc +
Vec3d(0,0,1)) - pos).length();
2386 void read(std::istream& is)
override 2397 is.read(reinterpret_cast<char*>(&mTaper),
sizeof(
double));
2398 is.read(reinterpret_cast<char*>(&mDepth),
sizeof(
double));
2404 if(!MapRegistry::isRegistered(type)) {
2409 MapBase::Ptr proxy = math::MapRegistry::createMap(type);
2411 mSecondMap = *(proxy->getAffineMap());
2416 void write(std::ostream& os)
const override 2419 os.write(reinterpret_cast<const char*>(&mTaper),
sizeof(
double));
2420 os.write(reinterpret_cast<const char*>(&mDepth),
sizeof(
double));
2423 mSecondMap.write(os);
2427 std::string
str()
const override 2429 std::ostringstream buffer;
2430 buffer <<
" - taper: " << mTaper << std::endl;
2431 buffer <<
" - depth: " << mDepth << std::endl;
2432 buffer <<
" SecondMap: "<< mSecondMap.type() << std::endl;
2433 buffer << mSecondMap.str() << std::endl;
2434 return buffer.str();
2463 mBBox, mTaper, mDepth, mSecondMap.preShear(shear, axis0, axis1)));
2492 mBBox, mTaper, mDepth, mSecondMap.postShear(shear, axis0, axis1)));
2499 mLx = mBBox.extents().x();
2500 mLy = mBBox.extents().y();
2501 mLz = mBBox.extents().z();
2505 " must have at least two index points in each direction.");
2512 mGamma = (1./mTaper - 1) / mDepth;
2514 mDepthOnLz = mDepth/mLz;
2515 mDepthOnLzLxLx = mDepthOnLz/(mLx * mLx);
2518 mHasSimpleAffine =
true;
2519 Vec3d tmp = mSecondMap.voxelSize();
2522 if (!
isApproxEqual(tmp(0), tmp(1))) { mHasSimpleAffine =
false;
return; }
2523 if (!
isApproxEqual(tmp(0), tmp(2))) { mHasSimpleAffine =
false;
return; }
2525 Vec3d trans = mSecondMap.applyMap(
Vec3d(0,0,0));
2527 Vec3d tmp1 = mSecondMap.applyMap(
Vec3d(1,0,0)) - trans;
2528 Vec3d tmp2 = mSecondMap.applyMap(
Vec3d(0,1,0)) - trans;
2529 Vec3d tmp3 = mSecondMap.applyMap(
Vec3d(0,0,1)) - trans;
2532 if (!
isApproxEqual(tmp1.
dot(tmp2), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2533 if (!
isApproxEqual(tmp2.
dot(tmp3), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2534 if (!
isApproxEqual(tmp3.
dot(tmp1), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2543 out = out - mBBox.min();
2548 out.
z() *= mDepthOnLz;
2550 double scale = (mGamma * out.
z() + 1.)/ mLx;
2559 Vec3d applyFrustumInverseMap(
const Vec3d& in)
const 2563 double invScale = mLx / (mGamma * out.
z() + 1.);
2564 out.
x() *= invScale;
2565 out.
y() *= invScale;
2570 out.
z() /= mDepthOnLz;
2573 out = out + mBBox.min();
2588 double mLx, mLy, mLz;
2589 double mXo, mYo, mGamma, mDepthOnLz, mDepthOnLzLxLx;
2592 bool mHasSimpleAffine;
2602 template<
typename FirstMapType,
typename SecondMapType>
2614 CompoundMap(
const FirstMapType& f,
const SecondMapType& s): mFirstMap(f), mSecondMap(s)
2616 updateAffineMatrix();
2620 mFirstMap(other.mFirstMap),
2621 mSecondMap(other.mSecondMap),
2622 mAffineMap(other.mAffineMap)
2628 return (FirstMapType::mapType() +
Name(
":") + SecondMapType::mapType());
2633 if (mFirstMap != other.mFirstMap)
return false;
2634 if (mSecondMap != other.mSecondMap)
return false;
2635 if (mAffineMap != other.mAffineMap)
return false;
2643 mFirstMap = other.mFirstMap;
2644 mSecondMap = other.mSecondMap;
2645 mAffineMap = other.mAffineMap;
2652 return mAffineMap.isIdentity();
2654 return mFirstMap.isIdentity()&&mSecondMap.isIdentity();
2660 return mAffineMap.isDiagonal();
2662 return mFirstMap.isDiagonal()&&mSecondMap.isDiagonal();
2673 "Constant affine matrix representation not possible for this nonlinear map");
2678 const FirstMapType&
firstMap()
const {
return mFirstMap; }
2679 const SecondMapType&
secondMap()
const {
return mSecondMap; }
2681 void setFirstMap(
const FirstMapType& first) { mFirstMap = first; updateAffineMatrix(); }
2682 void setSecondMap(
const SecondMapType& second) { mSecondMap = second; updateAffineMatrix(); }
2686 mAffineMap.read(is);
2688 mSecondMap.read(is);
2692 mAffineMap.write(os);
2693 mFirstMap.write(os);
2694 mSecondMap.write(os);
2698 void updateAffineMatrix()
2704 mAffineMap =
AffineMap(*first, *second);
2708 FirstMapType mFirstMap;
2709 SecondMapType mSecondMap;
2718 #endif // OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED
static MapBase::Ptr create()
Return a MapBase::Ptr to a new NonlinearFrustumMap.
Definition: Maps.h:2030
ScaleTranslateMap(const ScaleTranslateMap &other)
Definition: Maps.h:1226
UnitaryMap(const UnitaryMap &first, const UnitaryMap &second)
Definition: Maps.h:1699
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1381
bool isAffine(const Mat4< T > &m)
Definition: Mat4.h:1363
Vec3d voxelSize() const override
Return the size of a voxel at the center of the near plane.
Definition: Maps.h:2337
static Name mapType()
Definition: Maps.h:737
MapBase::Ptr preTranslate(const Vec3d &t) const override
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation...
Definition: Maps.h:1419
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:1302
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1014
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:451
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:823
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
CompoundMap< CompoundMap< UnitaryMap, ScaleMap >, UnitaryMap > SpectralDecomposedMap
Definition: Maps.h:69
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:1865
void read(std::istream &is) override
read serialization
Definition: Maps.h:1089
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:1049
void setCol(int j, const Vec3< T > &v)
Set jth column to vector v.
Definition: Mat3.h:192
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1093
static Name mapType()
Definition: Maps.h:1030
AffineMap(const AffineMap &other)
Definition: Maps.h:359
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:1354
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1061
AffineMap::Ptr getAffineMap() const override
Return a AffineMap equivalent to this map.
Definition: Maps.h:872
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:1266
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:1848
void read(std::istream &is) override
read serialization
Definition: Maps.h:834
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:1931
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:2037
std::string str() const override
string serialization, useful for debugging
Definition: Maps.h:561
bool operator==(const TranslationMap &other) const
Definition: Maps.h:1102
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Apply the Jacobian of this map to a vector. For a linear map this is equivalent to applying the map e...
Definition: Maps.h:1751
double determinant() const override
Return the determinant of the Jacobian.
Definition: Maps.h:1789
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:442
bool isLinear() const override
Return true (a TranslationMap is always linear).
Definition: Maps.h:1033
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:2446
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:792
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:472
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:474
bool operator!=(const TranslationMap &other) const
Definition: Maps.h:1108
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:1016
AffineMap::Ptr getAffineMap() const override
Definition: Maps.h:2360
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:2114
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1258
Definition: version.h:109
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:2146
void read(std::istream &is) override
read serialization
Definition: Maps.h:2386
static Name mapType()
Definition: Maps.h:397
OPENVDB_API SharedPtr< FullyDecomposedMap > createFullyDecomposedMap(const Mat4d &m)
General decomposition of a Matrix into a Unitary (e.g. rotation) following a Symmetric (e...
A general linear transform using homogeneous coordinates to perform rotation, scaling, shear and translation.
Definition: Maps.h:324
bool hasUniformScale() const override
Return false ( test if this is unitary with translation )
Definition: Maps.h:403
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 appropraite operation to the ...
Definition: Maps.h:891
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1043
void setRow(int i, const Vec3< T > &v)
Set ith row to vector v.
Definition: Mat3.h:174
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:2460
static void registerMap()
Definition: Maps.h:2044
ScaleMap(const ScaleMap &other)
Definition: Maps.h:706
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1768
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1295
Vec3d applyIJT(const Vec3d &d1_is, const Vec3d &ijk) const override
Definition: Maps.h:2214
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:2427
Vec3d asVec3d() const
Definition: Coord.h:167
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:2081
double getDepth() const
Return the unscaled frustm depth.
Definition: Maps.h:2369
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1736
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:1757
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1308
SharedPtr< AffineMap > Ptr
Definition: Maps.h:327
bool isDiagonal() const
Return true if the underylying matrix is diagonal.
Definition: Maps.h:497
T length() const
Length of the vector.
Definition: Vec3.h:224
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:266
T & z()
Definition: Vec3.h:111
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:101
Vec3d voxelSize(const Vec3d &) const override
Return the absolute values of the scale values, ignores argument.
Definition: Maps.h:1346
void read(std::istream &is) override
read serialization
Definition: Maps.h:1361
NonlinearFrustumMap()
Definition: Maps.h:1908
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:683
static void registerMap()
Definition: Maps.h:729
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature for the linear second map.
Definition: Maps.h:2250
void read(std::istream &is) override
read serialization
Definition: Maps.h:1800
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1091
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:502
void accumPostShear(Axis axis0, Axis axis1, double shear)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:548
bool hasUniformScale() const override
Return false (by convention true)
Definition: Maps.h:1734
Mat3d applyIJC(const Mat3d &mat) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1070
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:2150
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:780
static Name mapType()
Return UnitaryMap.
Definition: Maps.h:1728
bool isIdentity(const MatType &m)
Determine if a matrix is an identity matrix.
Definition: Mat.h:855
MapBase::Ptr postTranslate(const Vec3d &t) const override
Return a MapBase::Ptr to a new map that is the result of postfixing the appropriate operation...
Definition: Maps.h:1155
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:682
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:1358
static MapBase::Ptr create()
Return a MapBase::Ptr to a new AffineMap.
Definition: Maps.h:381
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:1299
const Mat4d & getConstMat4() const
Definition: Maps.h:643
void setTaper(double t)
set the taper value, the ratio of nearplane width / far plane width
Definition: Maps.h:2363
static bool isRegistered()
Definition: Maps.h:1020
static bool isRegistered()
Definition: Maps.h:727
UnitaryMap(const Mat3d &m)
Definition: Maps.h:1656
bool operator!=(const UnitaryMap &other) const
Definition: Maps.h:1745
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:456
void accumPostTranslation(const Vec3d &v)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:543
void accumPostScale(const Vec3d &v)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:538
bool operator!=(const AffineMap &other) const
Definition: Maps.h:425
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:1824
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:1881
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1314
static bool isRegistered()
Definition: Maps.h:1716
static void registerMap()
Definition: Maps.h:1022
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const override
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:633
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:852
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:1782
bool operator!=(const ScaleMap &other) const
Definition: Maps.h:869
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:628
const BBoxd & getBBox() const
Return the bounding box that defines the frustum in pre-image space.
Definition: Maps.h:2374
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1371
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1100
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1403
bool isScale() const
Return true if the map is equivalent to a ScaleMap.
Definition: Maps.h:499
Vec3d applyJacobian(const Vec3d &in, const Vec3d &isloc) const override
Return the Jacobian defined at isloc applied to in.
Definition: Maps.h:2121
static bool isRegistered()
Definition: Maps.h:2042
Name type() const override
Return NonlinearFrustumMap.
Definition: Maps.h:2051
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:723
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:1356
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:445
MatType scale(const Vec3< typename MatType::value_type > &s)
Return a matrix that scales by s.
Definition: Mat.h:610
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1806
Mat3d applyIJC(const Mat3d &mat, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:1071
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:2416
const FirstMapType & firstMap() const
Definition: Maps.h:2678
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:1762
double getGamma() const
Definition: Maps.h:2371
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:819
bool isLinear() const override
Return true (a ScaleTranslateMap is always linear).
Definition: Maps.h:1262
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1811
SharedPtr< MyType > Ptr
Definition: Maps.h:2608
bool hasUniformScale() const override
Return false (by convention true)
Definition: Maps.h:1036
double determinant(const Vec3d &) const override
Return the product of the scale values, ignores argument.
Definition: Maps.h:1338
Vec3d voxelSize() const override
Return .
Definition: Maps.h:1081
static bool isRegistered()
Definition: Maps.h:387
bool isIdentity() const
Return true if the map is equivalent to an identity.
Definition: Maps.h:2062
const Vec3d & getTranslation() const
Return the translation vector.
Definition: Maps.h:1086
math::BBox< Vec3d > BBoxd
Definition: Types.h:87
Vec3< T > row(int i) const
Get ith row, e.g. Vec3d v = m.row(1);.
Definition: Mat3.h:185
bool isScaleTranslate() const
Return true if the map is equivalent to a ScaleTranslateMap.
Definition: Maps.h:501
bool isType() const
Return true if this map is of concrete type MapT (e.g., AffineMap).
Definition: Maps.h:174
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1322
const Coord & min() const
Definition: Coord.h:339
static void registerMap()
Definition: Maps.h:389
const Vec3d & getScale() const
Returns the scale values.
Definition: Maps.h:1349
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:1920
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:1243
A specialized linear transform that performs a unitary maping i.e. rotation and or reflection...
Definition: Maps.h:1631
MyType & operator=(const MyType &other)
Definition: Maps.h:2641
void write(std::ostream &os) const override
write serialization
Definition: Maps.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:1779
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:464
void write(std::ostream &os) const
Definition: Maps.h:2690
const AffineMap & secondMap() const
Return MapBase::Ptr& to the second map.
Definition: Maps.h:2377
ScaleMap()
Definition: Maps.h:688
T * asPointer()
Definition: Vec3.h:118
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1770
void accumPreScale(const Vec3d &v)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:513
Mat4d getMat4() const
Return the matrix representation of this AffineMap.
Definition: Maps.h:642
AffineMap::Ptr inverse() const
Return AffineMap::Ptr to the inverse of this map.
Definition: Maps.h:579
Vec3d voxelSize(const Vec3d &loc) const override
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:2351
A specialized linear transform that performs a translation.
Definition: Maps.h:998
Creates the composition of two maps, each of which could be a composition. In the case that each comp...
Definition: Maps.h:66
ScaleTranslateMap(const Vec3d &scale, const Vec3d &translate)
Definition: Maps.h:1198
OPENVDB_API Mat4d approxInverse(const Mat4d &mat)
Returns the left pseudoInverse of the input matrix when the 3x3 part is symmetric otherwise it zeros ...
void read(std::istream &is) override
read serialization
Definition: Maps.h:557
AffineMap(const Mat3d &m)
Definition: Maps.h:342
void accumPreShear(Axis axis0, Axis axis1, double shear)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:523
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:440
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:769
Vec3d applyMap(const Vec3d &in) const override
Return the image of under the map.
Definition: Maps.h:1276
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:1181
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:2482
#define OPENVDB_VERSION_NAME
Definition: version.h:43
AffineMap(const Mat4d &m)
Definition: Maps.h:350
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:1777
MapBase::Ptr preTranslate(const Vec3d &t) const override
Return a MapBase::Ptr to a new map that is the result of prepending the appropriate operation...
Definition: Maps.h:1130
Vec3< double > Vec3d
Definition: Vec3.h:708
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:2489
ScaleTranslateMap()
Definition: Maps.h:1187
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleTranslateMap.
Definition: Maps.h:1239
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:1857
void setDepth(double d)
set the frustum depth: distance between near and far plane = frustm depth * frustm x-width ...
Definition: Maps.h:2367
T det() const
Determinant of matrix.
Definition: Mat3.h:533
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:1065
Name readString(std::istream &is)
Definition: Name.h:47
bool operator==(const UnitaryMap &other) const
Definition: Maps.h:1738
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:2468
bool operator==(const AffineMap &other) const
Definition: Maps.h:417
void setFirstMap(const FirstMapType &first)
Definition: Maps.h:2681
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1390
bool hasUniformScale() const override
Return false (by convention false)
Definition: Maps.h:2059
const SecondMapType & secondMap() const
Definition: Maps.h:2679
Mat3< T > getMat3() const
Definition: Mat4.h:351
double determinant(const Vec3d &) const override
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:1787
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:736
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1753
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:1969
MapBase()
Definition: Maps.h:271
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:775
T dot(const Vec3< T > &v) const
Dot product.
Definition: Vec3.h:215
AffineMap()
Definition: Maps.h:330
bool normalize(T eps=T(1.0e-7))
this = normalized this
Definition: Vec3.h:376
CompoundMap()
Definition: Maps.h:2612
UnitaryMap(const Vec3d &axis, double radians)
Definition: Maps.h:1642
Vec3< T > col(int j) const
Get jth column, e.g. Vec3d v = m.col(0);.
Definition: Mat3.h:201
Definition: Exceptions.h:39
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:1749
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:1041
bool hasSimpleAffine() const
Return true if the second map is a uniform scale, Rotation and translation.
Definition: Maps.h:2383
double determinant(const Vec3d &loc) const override
Definition: Maps.h:2329
bool hasUniformScale() const override
Return true if the values have the same magitude (eg. -1, 1, -1 would be a rotation).
Definition: Maps.h:743
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:1832
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleMap.
Definition: Maps.h:719
OPENVDB_API SharedPtr< PolarDecomposedMap > createPolarDecomposedMap(const Mat3d &m)
Decomposes a general linear into translation following polar decomposition.
SharedPtr< UnitaryMap > Ptr
Definition: Maps.h:1634
UnitaryMap(const Mat4d &m)
Definition: Maps.h:1668
T & x()
Reference to the component, e.g. v.x() = 4.5f;.
Definition: Vec3.h:109
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:447
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1029
bool operator==(const MyType &other) const
Definition: Maps.h:2631
T & y()
Definition: Vec3.h:110
bool operator==(const ScaleTranslateMap &other) const
Definition: Maps.h:1392
Mat3d applyIJC(const Mat3d &d2_is, const Vec3d &d1_is, const Vec3d &ijk) const override
Definition: Maps.h:2255
TranslationMap(const TranslationMap &other)
Definition: Maps.h:1007
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1241
Int32 ValueType
Definition: Coord.h:56
const Vec3d & getScale() const
Return the scale values that define the map.
Definition: Maps.h:816
Mat3 transpose() const
returns transpose of this
Definition: Mat3.h:508
bool isLinear() const override
Return true (a ScaleMap is always linear).
Definition: Maps.h:740
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:383
static Name mapType()
Definition: Maps.h:1259
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:2439
Vec4< T0 > transform(const Vec4< T0 > &v) const
Transform a Vec4 by post-multiplication.
Definition: Mat4.h:1052
double determinant() const override
Return the product of the scale values.
Definition: Maps.h:1340
ScaleMap(const Vec3d &scale)
Definition: Maps.h:692
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:784
UnitaryMap()
default constructor makes an Idenity.
Definition: Maps.h:1638
MapBase::Ptr postTranslate(const Vec3d &t) const override
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:1447
const Coord & max() const
Definition: Coord.h:340
UnitaryMap(const UnitaryMap &other)
Definition: Maps.h:1693
CompoundMap(const MyType &other)
Definition: Maps.h:2619
AffineMap::Ptr getAffineMap() const
Definition: Maps.h:2666
MapBase::Ptr preTranslate(const Vec3d &t) const override
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation...
Definition: Maps.h:591
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:2032
Definition: Exceptions.h:82
SharedPtr< const MyType > ConstPtr
Definition: Maps.h:2609
Vec3d voxelSize(const Vec3d &) const override
Return the lengths of the images of the segments , , .
Definition: Maps.h:830
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:860
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:559
Mat3d applyIJC(const Mat3d &m) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:476
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: BBox.h:168
bool isUnitary(const MatType &m)
Determine if a matrix is unitary (i.e., rotation or reflection).
Definition: Mat.h:884
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to a deep copy of the current AffineMap.
Definition: Maps.h:576
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:1039
static Name mapType()
Return NonlinearFrustumMap.
Definition: Maps.h:2053
static void registerMap()
Definition: Maps.h:1251
ScaleTranslateMap(const ScaleMap &scale, const TranslationMap &translate)
Definition: Maps.h:1213
TranslationMap()
Definition: Maps.h:1005
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:753
Name type() const override
Return UnitaryMap.
Definition: Maps.h:1726
double determinant(const Vec3d &) const override
Return the product of the scale values, ignores argument.
Definition: Maps.h:809
static void registerMap()
Definition: Maps.h:1718
Mat4 inverse(T tolerance=0) const
Definition: Mat4.h:539
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1781
MapBase::Ptr preScale(const Vec3d &s) const override
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation...
Definition: Maps.h:597
MapBase::Ptr postScale(const Vec3d &s) const override
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:627
void setSecondMap(const SecondMapType &second)
Definition: Maps.h:2682
OPENVDB_API uint32_t getFormatVersion(std::ios_base &)
Return the file format version number associated with the given input stream.
std::string Name
Definition: Name.h:44
void writeString(std::ostream &os, const Name &name)
Definition: Name.h:58
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:821
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:771
double getTaper() const
Return the taper value.
Definition: Maps.h:2365
Vec3d voxelSize(const Vec3d &) const override
Return .
Definition: Maps.h:1083
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:2204
bool isLinear() const override
Return true (an AffineMap is always linear).
Definition: Maps.h:400
Abstract base class for maps.
Definition: Maps.h:158
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:1902
SharedPtr< const MapBase > ConstPtr
Definition: Maps.h:162
MapBase::Ptr copy() const override
Returns a MapBase::Ptr to a deep copy of *this.
Definition: Maps.h:1709
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:1747
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1059
Definition: Exceptions.h:88
Vec3d voxelSize() const override
Returns the lengths of the images of the segments , , .
Definition: Maps.h:1796
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 appropriate operation...
Definition: Maps.h:1137
Map traits.
Definition: Maps.h:79
double determinant() const override
Return the determinant of the Jacobian of linear second map.
Definition: Maps.h:2325
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1045
bool operator==(const NonlinearFrustumMap &other) const
Definition: Maps.h:2083
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Definition: Maps.h:462
OPENVDB_API SharedPtr< SymmetricMap > createSymmetricMap(const Mat3d &m)
Utility methods.
bool operator!=(const MyType &other) const
Definition: Maps.h:2639
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:1873
std::shared_ptr< T > SharedPtr
Definition: Types.h:130
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:2108
void setToRotation(Axis axis, T angle)
Sets the matrix to a rotation about the given axis.
Definition: Mat4.h:837
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:2453
bool isIdentity() const
Return true if the underlying matrix is approximately an identity.
Definition: Maps.h:495
UnitaryMap(Axis axis, double radians)
Definition: Maps.h:1649
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:1840
Mat3 inverse(T tolerance=0) const
Definition: Mat3.h:519
float Round(float x)
Return x rounded to the nearest integer.
Definition: Math.h:785
bool isDiagonal() const
Definition: Maps.h:2658
void setToRotation(const Quat< T > &q)
Set this matrix to the rotation matrix specified by the quaternion.
Definition: Mat3.h:307
const Mat3d & getConstJacobianInv() const
Definition: Maps.h:644
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:415
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the second map applied to in.
Definition: Maps.h:2199
static MapBase::Ptr create()
Return a MapBase::Ptr to a new TranslationMap.
Definition: Maps.h:1012
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:794
Axis
Definition: Math.h:856
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of under the map.
Definition: Maps.h:1284
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:396
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1293
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:385
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:2475
TranslationMap(const Vec3d &t)
Definition: Maps.h:1006
bool isIdentity() const
Definition: Maps.h:2649
bool hasTranslation(const Mat4< T > &m)
Definition: Mat4.h:1368
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 appropraite operation...
Definition: Maps.h:1430
CompoundMap(const FirstMapType &f, const SecondMapType &s)
Definition: Maps.h:2614
static const Mat4< double > & identity()
Predefined constant for identity matrix.
Definition: Mat4.h:152
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the linear second map applied to in.
Definition: Maps.h:2119
Threadsafe singleton object for accessing the map type-name dictionary. Associates a map type-name wi...
Definition: Maps.h:286
AffineMap & operator=(const AffineMap &other)
Definition: Maps.h:427
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:786
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:71
bool isDiagonal(const MatType &mat)
Determine if a matrix is diagonal.
Definition: Mat.h:897
SharedPtr< FullyDecomposedMap > createDecomposedMap()
on-demand decomposition of the affine map
Definition: Maps.h:570
Name type() const
Definition: Maps.h:2625
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:1333
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 appropraite operation...
Definition: Maps.h:603
bool isValid() const
Definition: Maps.h:2380
Definition: Exceptions.h:86
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:790
OPENVDB_API SharedPtr< MapBase > simplify(SharedPtr< AffineMap > affine)
reduces an AffineMap to a ScaleMap or a ScaleTranslateMap when it can
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:1068
bool isInvertible(const MatType &m)
Determine if a matrix is invertible.
Definition: Mat.h:864
double determinant(const Vec3d &) const override
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:483
static bool isEqualBase(const MapT &self, const MapBase &other)
Definition: Maps.h:274
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1818
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:2177
double determinant() const override
Return the determinant of the Jacobian.
Definition: Maps.h:485
bool operator!=(const ScaleTranslateMap &other) const
Definition: Maps.h:1400
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1111
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:805
bool isLinear() const override
Return true (a UnitaryMap is always linear).
Definition: Maps.h:1731
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const override
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation to the ...
Definition: Maps.h:911
void accumPreTranslation(const Vec3d &v)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:518
static MapBase::Ptr create()
Return a MapBase::Ptr to a new UnitaryMap.
Definition: Maps.h:1707
AffineMap(const AffineMap &first, const AffineMap &second)
constructor that merges the matrixes for two affine maps
Definition: Maps.h:372
Vec3d voxelSize(const Vec3d &) const override
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:491
static Name mapType()
Definition: Maps.h:2626
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: Coord.h:479
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1306
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:1312
void setTranslation(const Vec3< T > &t)
Definition: Mat4.h:368
Vec3d voxelSize() const override
Return the absolute values of the scale values.
Definition: Maps.h:1344
void read(std::istream &is)
Definition: Maps.h:2684
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const override
Return a MapBase::Ptr to a new map that is the result of postfixing the appropriate operation...
Definition: Maps.h:1162
Vec3d voxelSize(const Vec3d &) const override
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:1797
void setMat3(const Mat3< T > &m)
Set upper left to a Mat3.
Definition: Mat4.h:344
double determinant(const Vec3d &) const override
Return 1.
Definition: Maps.h:1076
MapBase::Ptr postTranslate(const Vec3d &t) const override
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:621
std::map< Name, MapBase::MapFactory > MapDictionary
Definition: Maps.h:289
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:1054
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:1711
bool operator!=(const NonlinearFrustumMap &other) const
Definition: Maps.h:2105
bool isLinear() const override
Return false (a NonlinearFrustumMap is never linear).
Definition: Maps.h:2056
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:761
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:479
double determinant() const override
Return 1.
Definition: Maps.h:1078
bool operator==(const ScaleMap &other) const
Definition: Maps.h:862
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:721
NonlinearFrustumMap(const NonlinearFrustumMap &other)
Definition: Maps.h:1943
SharedPtr< MapBase > Ptr
Definition: Maps.h:161
const Vec3d & getTranslation() const
Returns the translation.
Definition: Maps.h:1351
Tolerance for floating-point comparison.
Definition: Math.h:125
static bool isRegistered()
Definition: Maps.h:1249
double determinant() const override
Return the product of the scale values.
Definition: Maps.h:811
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const override
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:1454