6 #ifndef OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED 7 #define OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED 35 class ScaleTranslateMap;
36 class UniformScaleMap;
37 class UniformScaleTranslateMap;
40 class NonlinearFrustumMap;
79 template<
typename T>
struct is_scale {
static const bool value =
false; };
139 using MapFactory =
Ptr (*)();
147 virtual Name type()
const = 0;
150 template<
typename MapT>
bool isType()
const {
return this->type() == MapT::mapType(); }
153 virtual bool isEqual(
const MapBase& other)
const = 0;
156 virtual bool isLinear()
const = 0;
158 virtual bool hasUniformScale()
const = 0;
160 virtual Vec3d applyMap(
const Vec3d& in)
const = 0;
161 virtual Vec3d applyInverseMap(
const Vec3d& in)
const = 0;
167 virtual Vec3d applyIJT(
const Vec3d& in)
const = 0;
168 virtual Vec3d applyIJT(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
171 virtual Mat3d applyIJC(
const Mat3d& m)
const = 0;
175 virtual double determinant()
const = 0;
176 virtual double determinant(
const Vec3d&)
const = 0;
183 virtual Vec3d voxelSize()
const = 0;
184 virtual Vec3d voxelSize(
const Vec3d&)
const = 0;
187 virtual void read(std::istream&) = 0;
188 virtual void write(std::ostream&)
const = 0;
190 virtual std::string str()
const = 0;
213 virtual Vec3d applyJacobian(
const Vec3d& in)
const = 0;
214 virtual Vec3d applyJacobian(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
223 virtual Vec3d applyInverseJacobian(
const Vec3d& in)
const = 0;
224 virtual Vec3d applyInverseJacobian(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
235 virtual Vec3d applyJT(
const Vec3d& in)
const = 0;
236 virtual Vec3d applyJT(
const Vec3d& in,
const Vec3d& domainPos)
const = 0;
249 template<
typename MapT>
252 return other.
isType<MapT>() && (
self == *static_cast<const MapT*>(&other));
273 static bool isRegistered(
const Name&);
276 static void registerMap(
const Name&, MapBase::MapFactory);
279 static void unregisterMap(
const Name&);
305 mMatrix(
Mat4d::identity()),
306 mMatrixInv(
Mat4d::identity()),
307 mJacobianInv(
Mat3d::identity()),
309 mVoxelSize(
Vec3d(1,1,1)),
318 Mat4d mat4(Mat4d::identity());
321 updateAcceleration();
328 "Tried to initialize an affine transform from a non-affine 4x4 matrix");
330 updateAcceleration();
335 mMatrix(other.mMatrix),
336 mMatrixInv(other.mMatrixInv),
337 mJacobianInv(other.mJacobianInv),
338 mDeterminant(other.mDeterminant),
339 mVoxelSize(other.mVoxelSize),
340 mIsDiagonal(other.mIsDiagonal),
341 mIsIdentity(other.mIsIdentity)
347 mMatrix(first.mMatrix * second.mMatrix)
349 updateAcceleration();
361 static bool isRegistered() {
return MapRegistry::isRegistered(AffineMap::mapType()); }
365 MapRegistry::registerMap(
366 AffineMap::mapType(),
379 Mat3d mat = mMatrix.getMat3();
380 const double det = mat.
det();
384 mat *= (1.0 / pow(std::abs(det), 1.0/3.0));
389 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
394 if (!mMatrix.eq(other.mMatrix)) {
return false; }
395 if (!mMatrixInv.eq(other.mMatrixInv)) {
return false; }
403 mMatrix = other.mMatrix;
404 mMatrixInv = other.mMatrixInv;
406 mJacobianInv = other.mJacobianInv;
407 mDeterminant = other.mDeterminant;
408 mVoxelSize = other.mVoxelSize;
409 mIsDiagonal = other.mIsDiagonal;
410 mIsIdentity = other.mIsIdentity;
426 return applyInverseJacobian(in);
431 return mMatrixInv.transform3x3(in);
440 return Vec3d( m[ 0] * in[0] + m[ 1] * in[1] + m[ 2] * in[2],
441 m[ 4] * in[0] + m[ 5] * in[1] + m[ 6] * in[2],
442 m[ 8] * in[0] + m[ 9] * in[1] + m[10] * in[2] );
451 return mJacobianInv.
transpose()* m * mJacobianInv;
484 mMatrix.preRotate(axis, radians);
485 updateAcceleration();
490 updateAcceleration();
494 mMatrix.preTranslate(v);
495 updateAcceleration();
499 mMatrix.preShear(axis0, axis1, shear);
500 updateAcceleration();
509 mMatrix.postRotate(axis, radians);
510 updateAcceleration();
514 mMatrix.postScale(v);
515 updateAcceleration();
519 mMatrix.postTranslate(v);
520 updateAcceleration();
524 mMatrix.postShear(axis0, axis1, shear);
525 updateAcceleration();
531 void read(std::istream& is)
override { mMatrix.read(is); updateAcceleration(); }
533 void write(std::ostream& os)
const override { mMatrix.write(os); }
535 std::string
str()
const override 537 std::ostringstream buffer;
538 buffer <<
" - mat4:\n" << mMatrix.str() << std::endl;
539 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
562 affineMap->accumPreRotation(axis, radians);
568 affineMap->accumPreTranslation(t);
569 return StaticPtrCast<MapBase, AffineMap>(affineMap);
574 affineMap->accumPreScale(s);
575 return StaticPtrCast<MapBase, AffineMap>(affineMap);
580 affineMap->accumPreShear(axis0, axis1, shear);
592 affineMap->accumPostRotation(axis, radians);
598 affineMap->accumPostTranslation(t);
599 return StaticPtrCast<MapBase, AffineMap>(affineMap);
604 affineMap->accumPostScale(s);
605 return StaticPtrCast<MapBase, AffineMap>(affineMap);
610 affineMap->accumPostShear(axis0, axis1, shear);
621 void updateAcceleration() {
622 Mat3d mat3 = mMatrix.getMat3();
623 mDeterminant = mat3.
det();
627 "Tried to initialize an affine transform from a nearly singular matrix");
629 mMatrixInv = mMatrix.inverse();
634 mVoxelSize(0) = (applyMap(
Vec3d(1,0,0)) - pos).length();
635 mVoxelSize(1) = (applyMap(
Vec3d(0,1,0)) - pos).length();
636 mVoxelSize(2) = (applyMap(
Vec3d(0,0,1)) - pos).length();
647 bool mIsDiagonal, mIsIdentity;
665 mScaleValuesInverse(
Vec3d(1,1,1)),
666 mInvScaleSqr(1,1,1), mInvTwiceScale(0.5,0.5,0.5){}
671 mVoxelSize(
Vec3d(
std::abs(scale(0)),
std::abs(scale(1)),
std::abs(scale(2))))
673 double determinant = scale[0]* scale[1] * scale[2];
677 mScaleValuesInverse = 1.0 / mScaleValues;
678 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
679 mInvTwiceScale = mScaleValuesInverse / 2;
684 mScaleValues(other.mScaleValues),
685 mVoxelSize(other.mVoxelSize),
686 mScaleValuesInverse(other.mScaleValuesInverse),
687 mInvScaleSqr(other.mInvScaleSqr),
688 mInvTwiceScale(other.mInvTwiceScale)
703 static bool isRegistered() {
return MapRegistry::isRegistered(ScaleMap::mapType()); }
707 MapRegistry::registerMap(
722 std::abs(mScaleValues.x()), std::abs(mScaleValues.y()),
double(5e-7));
724 std::abs(mScaleValues.x()), std::abs(mScaleValues.z()),
double(5e-7));
732 in.x() * mScaleValues.x(),
733 in.y() * mScaleValues.y(),
734 in.z() * mScaleValues.z());
740 in.x() * mScaleValuesInverse.x(),
741 in.y() * mScaleValuesInverse.y(),
742 in.z() * mScaleValuesInverse.z());
746 return applyJacobian(in);
754 return applyInverseJacobian(in);
759 return applyInverseMap(in);
779 for (
int i = 0; i < 3; i++) {
780 tmp.
setRow(i, in.row(i) * mScaleValuesInverse(i));
782 for (
int i = 0; i < 3; i++) {
783 tmp.
setCol(i, tmp.
col(i) * mScaleValuesInverse(i));
794 return mScaleValues.x() * mScaleValues.y() * mScaleValues.z();
816 void read(std::istream& is)
override 818 mScaleValues.read(is);
820 mScaleValuesInverse.read(is);
821 mInvScaleSqr.read(is);
822 mInvTwiceScale.read(is);
825 void write(std::ostream& os)
const override 827 mScaleValues.write(os);
828 mVoxelSize.write(os);
829 mScaleValuesInverse.write(os);
830 mInvScaleSqr.write(os);
831 mInvTwiceScale.write(os);
834 std::string
str()
const override 836 std::ostringstream buffer;
837 buffer <<
" - scale: " << mScaleValues << std::endl;
838 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
842 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
847 if (!mScaleValues.eq(other.mScaleValues)) {
return false; }
867 affineMap->accumPreRotation(axis, radians);
876 affineMap->accumPreShear(axis0, axis1, shear);
888 affineMap->accumPostRotation(axis, radians);
896 affineMap->accumPostShear(axis0, axis1, shear);
902 Vec3d mScaleValues, mVoxelSize, mScaleValuesInverse, mInvScaleSqr, mInvTwiceScale;
926 const Vec3d& invScale = getInvScale();
930 static bool isRegistered() {
return MapRegistry::isRegistered(UniformScaleMap::mapType()); }
933 MapRegistry::registerMap(
934 UniformScaleMap::mapType(),
935 UniformScaleMap::create);
941 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
961 ScaleMap::preScale(
const Vec3d& v)
const 963 const Vec3d new_scale(v * mScaleValues);
973 ScaleMap::postScale(
const Vec3d& v)
const 1002 static bool isRegistered() {
return MapRegistry::isRegistered(TranslationMap::mapType()); }
1006 MapRegistry::registerMap(
1007 TranslationMap::mapType(),
1008 TranslationMap::create);
1032 return applyInverseJacobian(in);
1054 return applyIJC(mat);
1071 void read(std::istream& is)
override { mTranslation.read(is); }
1073 void write(std::ostream& os)
const override { mTranslation.write(os); }
1075 std::string
str()
const override 1077 std::ostringstream buffer;
1078 buffer <<
" - translation: " << mTranslation << std::endl;
1079 return buffer.str();
1082 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1087 return mTranslation.eq(other.mTranslation);
1095 Mat4d matrix(Mat4d::identity());
1108 affineMap->accumPreRotation(axis, radians);
1122 affineMap->accumPreShear(axis0, axis1, shear);
1133 affineMap->accumPostRotation(axis, radians);
1147 affineMap->accumPostShear(axis0, axis1, shear);
1173 mTranslation(
Vec3d(0,0,0)),
1174 mScaleValues(
Vec3d(1,1,1)),
1175 mVoxelSize(
Vec3d(1,1,1)),
1176 mScaleValuesInverse(
Vec3d(1,1,1)),
1177 mInvScaleSqr(1,1,1),
1178 mInvTwiceScale(0.5,0.5,0.5)
1184 mTranslation(translate),
1185 mScaleValues(scale),
1186 mVoxelSize(
std::abs(scale(0)),
std::abs(scale(1)),
std::abs(scale(2)))
1188 const double determinant = scale[0]* scale[1] * scale[2];
1192 mScaleValuesInverse = 1.0 / mScaleValues;
1193 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1194 mInvTwiceScale = mScaleValuesInverse / 2;
1199 mTranslation(translate.getTranslation()),
1201 mVoxelSize(
std::abs(mScaleValues(0)),
1202 std::abs(mScaleValues(1)),
1203 std::abs(mScaleValues(2))),
1204 mScaleValuesInverse(1.0 / scale.
getScale())
1206 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1207 mInvTwiceScale = mScaleValuesInverse / 2;
1212 mTranslation(other.mTranslation),
1213 mScaleValues(other.mScaleValues),
1214 mVoxelSize(other.mVoxelSize),
1215 mScaleValuesInverse(other.mScaleValuesInverse),
1216 mInvScaleSqr(other.mInvScaleSqr),
1217 mInvTwiceScale(other.mInvTwiceScale)
1230 mScaleValuesInverse, -mScaleValuesInverse * mTranslation));
1233 static bool isRegistered() {
return MapRegistry::isRegistered(ScaleTranslateMap::mapType()); }
1237 MapRegistry::registerMap(
1238 ScaleTranslateMap::mapType(),
1239 ScaleTranslateMap::create);
1253 std::abs(mScaleValues.x()), std::abs(mScaleValues.y()),
double(5e-7));
1255 std::abs(mScaleValues.x()), std::abs(mScaleValues.z()),
double(5e-7));
1263 in.x() * mScaleValues.x() + mTranslation.x(),
1264 in.y() * mScaleValues.y() + mTranslation.y(),
1265 in.z() * mScaleValues.z() + mTranslation.z());
1271 (in.x() - mTranslation.x() ) * mScaleValuesInverse.x(),
1272 (in.y() - mTranslation.y() ) * mScaleValuesInverse.y(),
1273 (in.z() - mTranslation.z() ) * mScaleValuesInverse.z());
1278 return applyJacobian(in);
1286 return applyInverseJacobian(in);
1291 return in * mScaleValuesInverse;
1303 return applyIJT(in);
1309 in.x() * mScaleValuesInverse.x(),
1310 in.y() * mScaleValuesInverse.y(),
1311 in.z() * mScaleValuesInverse.z());
1317 for (
int i=0; i<3; i++){
1318 tmp.
setRow(i, in.row(i)*mScaleValuesInverse(i));
1320 for (
int i=0; i<3; i++){
1321 tmp.
setCol(i, tmp.
col(i)*mScaleValuesInverse(i));
1326 return applyIJC(in);
1333 return mScaleValues.x() * mScaleValues.y() * mScaleValues.z();
1353 void read(std::istream& is)
override 1355 mTranslation.read(is);
1356 mScaleValues.read(is);
1357 mVoxelSize.read(is);
1358 mScaleValuesInverse.read(is);
1359 mInvScaleSqr.read(is);
1360 mInvTwiceScale.read(is);
1363 void write(std::ostream& os)
const override 1365 mTranslation.write(os);
1366 mScaleValues.write(os);
1367 mVoxelSize.write(os);
1368 mScaleValuesInverse.write(os);
1369 mInvScaleSqr.write(os);
1370 mInvTwiceScale.write(os);
1373 std::string
str()
const override 1375 std::ostringstream buffer;
1376 buffer <<
" - translation: " << mTranslation << std::endl;
1377 buffer <<
" - scale: " << mScaleValues << std::endl;
1378 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
1379 return buffer.str();
1382 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1387 if (!mScaleValues.eq(other.mScaleValues)) {
return false; }
1388 if (!mTranslation.eq(other.mTranslation)) {
return false; }
1398 affineMap->accumPostTranslation(mTranslation);
1408 affineMap->accumPreRotation(axis, radians);
1413 const Vec3d& s = mScaleValues;
1414 const Vec3d scaled_trans( t.
x() * s.
x(),
1425 affineMap->accumPreShear(axis0, axis1, shear);
1436 affineMap->accumPostRotation(axis, radians);
1449 affineMap->accumPostShear(axis0, axis1, shear);
1455 Vec3d mTranslation, mScaleValues, mVoxelSize, mScaleValuesInverse,
1456 mInvScaleSqr, mInvTwiceScale;
1461 ScaleMap::postTranslate(
const Vec3d& t)
const 1468 ScaleMap::preTranslate(
const Vec3d& t)
const 1471 const Vec3d& s = mScaleValues;
1472 const Vec3d scaled_trans( t.
x() * s.
x(),
1503 const Vec3d& scaleInv = getInvScale();
1504 const Vec3d& trans = getTranslation();
1510 return MapRegistry::isRegistered(UniformScaleTranslateMap::mapType());
1515 MapRegistry::registerMap(
1516 UniformScaleTranslateMap::mapType(), UniformScaleTranslateMap::create);
1522 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1535 const Vec3d new_trans = this->getTranslation() + scale * t;
1550 UniformScaleMap::postTranslate(
const Vec3d& t)
const 1558 UniformScaleMap::preTranslate(
const Vec3d& t)
const 1566 TranslationMap::preScale(
const Vec3d& v)
const 1577 TranslationMap::postScale(
const Vec3d& v)
const 1582 const Vec3d trans(mTranslation.x()*v.
x(),
1583 mTranslation.y()*v.
y(),
1584 mTranslation.z()*v.
z());
1591 ScaleTranslateMap::preScale(
const Vec3d& v)
const 1593 const Vec3d new_scale( v * mScaleValues );
1603 ScaleTranslateMap::postScale(
const Vec3d& v)
const 1605 const Vec3d new_scale( v * mScaleValues );
1606 const Vec3d new_trans( mTranslation.x()*v.
x(),
1607 mTranslation.y()*v.
y(),
1608 mTranslation.z()*v.
z() );
1655 Mat4d matrix(Mat4d::identity());
1664 "4x4 Matrix initializing unitary map was not unitary: not invertible");
1669 "4x4 Matrix initializing unitary map was not unitary: not affine");
1674 "4x4 Matrix initializing unitary map was not unitary: had translation");
1679 "4x4 Matrix initializing unitary map was not unitary");
1687 mAffineMap(other.mAffineMap)
1692 mAffineMap(*(first.getAffineMap()), *(second.getAffineMap()))
1696 ~UnitaryMap()
override =
default;
1705 return MapBase::Ptr(
new UnitaryMap(mAffineMap.getMat4().inverse()));
1708 static bool isRegistered() {
return MapRegistry::isRegistered(UnitaryMap::mapType()); }
1712 MapRegistry::registerMap(
1713 UnitaryMap::mapType(),
1714 UnitaryMap::create);
1728 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1733 if (mAffineMap!=other.mAffineMap)
return false;
1737 bool operator!=(
const UnitaryMap& other)
const {
return !(*
this == other); }
1750 return applyInverseJacobian(in);
1755 return mAffineMap.applyInverseJacobian(in);
1763 return applyInverseMap(in);
1775 return applyIJC(in);
1781 double determinant()
const override {
return mAffineMap.determinant(); }
1792 void read(std::istream& is)
override 1794 mAffineMap.read(is);
1798 void write(std::ostream& os)
const override 1800 mAffineMap.write(os);
1803 std::string
str()
const override 1805 std::ostringstream buffer;
1806 buffer << mAffineMap.str();
1807 return buffer.str();
1818 UnitaryMap first(axis, radians);
1820 return StaticPtrCast<MapBase, UnitaryMap>(unitaryMap);
1827 affineMap->accumPreTranslation(t);
1835 affineMap->accumPreScale(v);
1843 affineMap->accumPreShear(axis0, axis1, shear);
1851 UnitaryMap second(axis, radians);
1853 return StaticPtrCast<MapBase, UnitaryMap>(unitaryMap);
1860 affineMap->accumPostTranslation(t);
1868 affineMap->accumPostScale(v);
1876 affineMap->accumPostShear(axis0, axis1, shear);
1913 MapBase(),mBBox(bb), mTaper(taper), mDepth(depth)
1925 mBBox(bb), mTaper(taper), mDepth(depth)
1927 if (!secondMap->isLinear() ) {
1929 "The second map in the Frustum transfrom must be linear");
1931 mSecondMap = *( secondMap->getAffineMap() );
1938 mTaper(other.mTaper),
1939 mDepth(other.mDepth),
1940 mSecondMap(other.mSecondMap),
1941 mHasSimpleAffine(other.mHasSimpleAffine)
1962 const Vec3d& direction,
1965 double z_near,
double depth,
1973 "The frustum depth must be non-zero and positive");
1975 if (!(up.
length() > 0)) {
1977 "The frustum height must be non-zero and positive");
1979 if (!(aspect > 0)) {
1981 "The frustum aspect ratio must be non-zero and positive");
1985 "The frustum up orientation must be perpendicular to into-frustum direction");
1988 double near_plane_height = 2 * up.
length();
1989 double near_plane_width = aspect * near_plane_height;
1994 mDepth = depth / near_plane_width;
1995 double gamma = near_plane_width / z_near;
1996 mTaper = 1./(mDepth*gamma + 1.);
1998 Vec3d direction_unit = direction;
2001 Mat4d r1(Mat4d::identity());
2003 Mat4d r2(Mat4d::identity());
2007 Vec3d(near_plane_width, near_plane_width, near_plane_width));
2011 Mat4d mat = scale * r2 * r1;
2032 "inverseMap() is not implemented for NonlinearFrustumMap");
2034 static bool isRegistered() {
return MapRegistry::isRegistered(NonlinearFrustumMap::mapType()); }
2038 MapRegistry::registerMap(
2039 NonlinearFrustumMap::mapType(),
2040 NonlinearFrustumMap::create);
2061 const Vec3d e1(1,0,0);
2062 if (!applyMap(e1).eq(e1))
return false;
2064 const Vec3d e2(0,1,0);
2065 if (!applyMap(e2).eq(e2))
return false;
2067 const Vec3d e3(0,0,1);
2068 if (!applyMap(e3).eq(e3))
return false;
2073 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
2077 if (mBBox!=other.mBBox)
return false;
2084 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2087 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2090 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2093 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2102 return mSecondMap.applyMap(applyFrustumMap(in));
2108 return applyFrustumInverseMap(mSecondMap.applyInverseMap(in));
2117 Vec3d centered(isloc);
2118 centered = centered - mBBox.min();
2119 centered.
x() -= mXo;
2120 centered.
y() -= mYo;
2123 const double zprime = centered.
z()*mDepthOnLz;
2125 const double scale = (mGamma * zprime + 1.) / mLx;
2126 const double scale2 = mGamma * mDepthOnLz / mLx;
2128 const Vec3d tmp(scale * in.
x() + scale2 * centered.
x()* in.
z(),
2129 scale * in.
y() + scale2 * centered.
y()* in.
z(),
2130 mDepthOnLz * in.
z());
2132 return mSecondMap.applyJacobian(tmp);
2139 return mSecondMap.applyInverseJacobian(in);
2146 Vec3d centered(isloc);
2147 centered = centered - mBBox.min();
2148 centered.
x() -= mXo;
2149 centered.
y() -= mYo;
2152 const double zprime = centered.
z()*mDepthOnLz;
2154 const double scale = (mGamma * zprime + 1.) / mLx;
2155 const double scale2 = mGamma * mDepthOnLz / mLx;
2158 Vec3d out = mSecondMap.applyInverseJacobian(in);
2160 out.
x() = (out.
x() - scale2 * centered.
x() * out.
z() / mDepthOnLz) / scale;
2161 out.
y() = (out.
y() - scale2 * centered.
y() * out.
z() / mDepthOnLz) / scale;
2162 out.
z() = out.
z() / mDepthOnLz;
2170 const Vec3d tmp = mSecondMap.applyJT(in);
2173 Vec3d centered(isloc);
2174 centered = centered - mBBox.min();
2175 centered.
x() -= mXo;
2176 centered.
y() -= mYo;
2179 const double zprime = centered.
z()*mDepthOnLz;
2181 const double scale = (mGamma * zprime + 1.) / mLx;
2182 const double scale2 = mGamma * mDepthOnLz / mLx;
2184 return Vec3d(scale * tmp.
x(),
2186 scale2 * centered.
x()* tmp.
x() +
2187 scale2 * centered.
y()* tmp.
y() +
2188 mDepthOnLz * tmp.
z());
2192 return mSecondMap.applyJT(in);
2208 const Vec3d loc = applyFrustumMap(ijk);
2209 const double s = mGamma * loc.
z() + 1.;
2214 " at the singular focal point (e.g. camera)");
2217 const double sinv = 1.0/s;
2218 const double pt0 = mLx * sinv;
2219 const double pt1 = mGamma * pt0;
2220 const double pt2 = pt1 * sinv;
2222 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2225 Mat3d gradE(Mat3d::zero());
2226 for (
int j = 0; j < 3; ++j ) {
2227 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2228 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2229 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2233 for (
int i = 0; i < 3; ++i) {
2234 result(i) = d1_is(0) * gradE(0,i) + d1_is(1) * gradE(1,i) + d1_is(2) * gradE(2,i);
2249 const Vec3d loc = applyFrustumMap(ijk);
2251 const double s = mGamma * loc.
z() + 1.;
2256 " at the singular focal point (e.g. camera)");
2260 const double sinv = 1.0/s;
2261 const double pt0 = mLx * sinv;
2262 const double pt1 = mGamma * pt0;
2263 const double pt2 = pt1 * sinv;
2264 const double pt3 = pt2 * sinv;
2266 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2270 Mat3d matE0(Mat3d::zero());
2271 Mat3d matE1(Mat3d::zero());
2272 for(
int j = 0; j < 3; j++) {
2273 for (
int k = 0; k < 3; k++) {
2275 const double pt4 = 2. * jacinv(2,j) * jacinv(2,k) * pt3;
2277 matE0(j,k) = -(jacinv(0,j) * jacinv(2,k) + jacinv(2,j) * jacinv(0,k)) * pt2 +
2280 matE1(j,k) = -(jacinv(1,j) * jacinv(2,k) + jacinv(2,j) * jacinv(1,k)) * pt2 +
2286 Mat3d gradE(Mat3d::zero());
2287 for (
int j = 0; j < 3; ++j ) {
2288 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2289 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2290 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2293 Mat3d result(Mat3d::zero());
2296 for (
int m = 0; m < 3; ++m ) {
2297 for (
int n = 0; n < 3; ++n) {
2298 for (
int i = 0; i < 3; ++i ) {
2299 for (
int j = 0; j < 3; ++j) {
2300 result(m, n) += gradE(j, m) * gradE(i, n) * d2_is(i, j);
2306 for (
int m = 0; m < 3; ++m ) {
2307 for (
int n = 0; n < 3; ++n) {
2309 matE0(m, n) * d1_is(0) + matE1(m, n) * d1_is(1);
2317 double determinant()
const override {
return mSecondMap.determinant();}
2323 double s = mGamma * loc.
z() + 1.0;
2324 double frustum_determinant = s * s * mDepthOnLzLxLx;
2325 return mSecondMap.determinant() * frustum_determinant;
2331 const Vec3d loc( 0.5*(mBBox.min().x() + mBBox.max().x()),
2332 0.5*(mBBox.min().y() + mBBox.max().y()),
2335 return voxelSize(loc);
2345 Vec3d out, pos = applyMap(loc);
2346 out(0) = (applyMap(loc +
Vec3d(1,0,0)) - pos).length();
2347 out(1) = (applyMap(loc +
Vec3d(0,1,0)) - pos).length();
2348 out(2) = (applyMap(loc +
Vec3d(0,0,1)) - pos).length();
2378 void read(std::istream& is)
override 2389 is.read(reinterpret_cast<char*>(&mTaper),
sizeof(
double));
2390 is.read(reinterpret_cast<char*>(&mDepth),
sizeof(
double));
2396 if(!MapRegistry::isRegistered(type)) {
2401 MapBase::Ptr proxy = math::MapRegistry::createMap(type);
2403 mSecondMap = *(proxy->getAffineMap());
2408 void write(std::ostream& os)
const override 2411 os.write(reinterpret_cast<const char*>(&mTaper),
sizeof(
double));
2412 os.write(reinterpret_cast<const char*>(&mDepth),
sizeof(
double));
2415 mSecondMap.write(os);
2419 std::string
str()
const override 2421 std::ostringstream buffer;
2422 buffer <<
" - taper: " << mTaper << std::endl;
2423 buffer <<
" - depth: " << mDepth << std::endl;
2424 buffer <<
" SecondMap: "<< mSecondMap.type() << std::endl;
2425 buffer << mSecondMap.str() << std::endl;
2426 return buffer.str();
2455 mBBox, mTaper, mDepth, mSecondMap.preShear(shear, axis0, axis1)));
2484 mBBox, mTaper, mDepth, mSecondMap.postShear(shear, axis0, axis1)));
2491 mLx = mBBox.extents().x();
2492 mLy = mBBox.extents().y();
2493 mLz = mBBox.extents().z();
2497 " must have at least two index points in each direction.");
2504 mGamma = (1./mTaper - 1) / mDepth;
2506 mDepthOnLz = mDepth/mLz;
2507 mDepthOnLzLxLx = mDepthOnLz/(mLx * mLx);
2510 mHasSimpleAffine =
true;
2511 Vec3d tmp = mSecondMap.voxelSize();
2514 if (!
isApproxEqual(tmp(0), tmp(1))) { mHasSimpleAffine =
false;
return; }
2515 if (!
isApproxEqual(tmp(0), tmp(2))) { mHasSimpleAffine =
false;
return; }
2517 Vec3d trans = mSecondMap.applyMap(
Vec3d(0,0,0));
2519 Vec3d tmp1 = mSecondMap.applyMap(
Vec3d(1,0,0)) - trans;
2520 Vec3d tmp2 = mSecondMap.applyMap(
Vec3d(0,1,0)) - trans;
2521 Vec3d tmp3 = mSecondMap.applyMap(
Vec3d(0,0,1)) - trans;
2524 if (!
isApproxEqual(tmp1.
dot(tmp2), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2525 if (!
isApproxEqual(tmp2.
dot(tmp3), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2526 if (!
isApproxEqual(tmp3.
dot(tmp1), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2535 out = out - mBBox.min();
2540 out.
z() *= mDepthOnLz;
2542 double scale = (mGamma * out.
z() + 1.)/ mLx;
2551 Vec3d applyFrustumInverseMap(
const Vec3d& in)
const 2555 double invScale = mLx / (mGamma * out.
z() + 1.);
2556 out.
x() *= invScale;
2557 out.
y() *= invScale;
2562 out.
z() /= mDepthOnLz;
2565 out = out + mBBox.min();
2580 double mLx, mLy, mLz;
2581 double mXo, mYo, mGamma, mDepthOnLz, mDepthOnLzLxLx;
2584 bool mHasSimpleAffine;
2594 template<
typename FirstMapType,
typename SecondMapType>
2606 CompoundMap(
const FirstMapType& f,
const SecondMapType& s): mFirstMap(f), mSecondMap(s)
2608 updateAffineMatrix();
2612 mFirstMap(other.mFirstMap),
2613 mSecondMap(other.mSecondMap),
2614 mAffineMap(other.mAffineMap)
2620 return (FirstMapType::mapType() +
Name(
":") + SecondMapType::mapType());
2625 if (mFirstMap != other.mFirstMap)
return false;
2626 if (mSecondMap != other.mSecondMap)
return false;
2627 if (mAffineMap != other.mAffineMap)
return false;
2635 mFirstMap = other.mFirstMap;
2636 mSecondMap = other.mSecondMap;
2637 mAffineMap = other.mAffineMap;
2644 return mAffineMap.isIdentity();
2646 return mFirstMap.isIdentity()&&mSecondMap.isIdentity();
2652 return mAffineMap.isDiagonal();
2654 return mFirstMap.isDiagonal()&&mSecondMap.isDiagonal();
2665 "Constant affine matrix representation not possible for this nonlinear map");
2670 const FirstMapType&
firstMap()
const {
return mFirstMap; }
2671 const SecondMapType&
secondMap()
const {
return mSecondMap; }
2673 void setFirstMap(
const FirstMapType& first) { mFirstMap = first; updateAffineMatrix(); }
2674 void setSecondMap(
const SecondMapType& second) { mSecondMap = second; updateAffineMatrix(); }
2678 mAffineMap.read(is);
2680 mSecondMap.read(is);
2684 mAffineMap.write(os);
2685 mFirstMap.write(os);
2686 mSecondMap.write(os);
2690 void updateAffineMatrix()
2696 mAffineMap =
AffineMap(*first, *second);
2700 FirstMapType mFirstMap;
2701 SecondMapType mSecondMap;
2710 #endif // OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED bool operator==(const AffineMap &other) const
Definition: Maps.h:391
Vec3d voxelSize(const Vec3d &) const final
Return the absolute values of the scale values, ignores argument.
Definition: Maps.h:1338
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1773
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:1754
void setToRotation(const Quat< T > &q)
Set this matrix to the rotation matrix specified by the quaternion.
Definition: Mat3.h:253
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &) const final
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation) ...
Definition: Maps.h:753
void setTranslation(const Vec3< T > &t)
Definition: Mat4.h:314
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:453
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:359
Definition: Exceptions.h:59
Map traits.
Definition: Maps.h:55
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:565
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleTranslateMap.
Definition: Maps.h:1223
float Round(float x)
Return x rounded to the nearest integer.
Definition: Math.h:819
Vec3d voxelSize(const Vec3d &) const override
Return (1,1,1).
Definition: Maps.h:1065
T dot(const Vec3< T > &v) const
Dot product.
Definition: Vec3.h:191
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to a deep copy of the current AffineMap.
Definition: Maps.h:550
void setToRotation(Axis axis, T angle)
Sets the matrix to a rotation about the given axis.
Definition: Mat4.h:783
void setRow(int i, const Vec3< T > &v)
Set ith row to vector v.
Definition: Mat3.h:141
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:1703
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:2419
Mat3d applyIJC(const Mat3d &m) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:450
bool operator==(const NonlinearFrustumMap &other) const
Definition: Maps.h:2075
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:1865
void accumPostRotation(Axis axis, double radians)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:507
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:421
const Coord & min() const
Definition: Coord.h:321
UnitaryMap(const UnitaryMap &other)
Definition: Maps.h:1685
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:248
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:2343
void accumPreScale(const Vec3d &v)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:487
AffineMap(const Mat4d &m)
Definition: Maps.h:324
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:1036
bool isAffine(const Mat4< T > &m)
Definition: Mat4.h:1304
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:1873
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:699
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:571
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:74
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1810
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:1119
void setSecondMap(const SecondMapType &second)
Definition: Maps.h:2674
AffineMap::Ptr getAffineMap() const override
Definition: Maps.h:2352
static MapBase::Ptr create()
Return a MapBase::Ptr to a new UnitaryMap.
Definition: Maps.h:1699
Vec3d applyIJT(const Vec3d &d1_is, const Vec3d &ijk) const override
Definition: Maps.h:2206
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const final
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1302
Vec3d applyJacobian(const Vec3d &in) const final
Return the Jacobian of the map applied to in.
Definition: Maps.h:749
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
static MapBase::Ptr create()
Return a MapBase::Ptr to a new AffineMap.
Definition: Maps.h:355
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:1912
bool operator==(const ScaleTranslateMap &other) const
Definition: Maps.h:1384
MapBase::Ptr preRotate(double radians, Axis axis) const override
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation to the ...
Definition: Maps.h:864
double getTaper() const
Return the taper value.
Definition: Maps.h:2357
SharedPtr< FullyDecomposedMap > createDecomposedMap()
on-demand decomposition of the affine map
Definition: Maps.h:544
void accumPreRotation(Axis axis, double radians)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:482
void read(std::istream &is) override
read serialization
Definition: Maps.h:531
const Mat3d & getConstJacobianInv() const
Definition: Maps.h:618
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:1050
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:430
AffineMap(const AffineMap &first, const AffineMap &second)
constructor that merges the matrixes for two affine maps
Definition: Maps.h:346
static bool isRegistered()
Definition: Maps.h:1002
const Vec3d & getScale() const
Returns the scale values.
Definition: Maps.h:1341
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:438
TranslationMap(const Vec3d &t)
Definition: Maps.h:988
static bool isEqualBase(const MapT &self, const MapBase &other)
Definition: Maps.h:250
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:1832
Vec3d applyJT(const Vec3d &in) const final
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1298
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1075
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:1031
Vec3d applyInverseMap(const Vec3d &in) const final
Return the pre-image of in under the map.
Definition: Maps.h:737
Mat3d applyIJC(const Mat3d &d2_is, const Vec3d &d1_is, const Vec3d &ijk) const override
Definition: Maps.h:2247
CompoundMap< CompoundMap< UnitaryMap, ScaleMap >, UnitaryMap > SpectralDecomposedMap
Definition: Maps.h:45
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:2452
static void registerMap()
Definition: Maps.h:1004
void setMat3(const Mat3< T > &m)
Set upper left to a Mat3.
Definition: Mat4.h:290
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:1961
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:1023
ScaleTranslateMap(const Vec3d &scale, const Vec3d &translate)
Definition: Maps.h:1182
SharedPtr< UnitaryMap > Ptr
Definition: Maps.h:1626
bool operator==(const TranslationMap &other) const
Definition: Maps.h:1084
static Name mapType()
Definition: Maps.h:371
Mat3< T > getMat3() const
Definition: Mat4.h:297
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1373
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:1021
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1027
CompoundMap(const MyType &other)
Definition: Maps.h:2611
bool operator!=(const NonlinearFrustumMap &other) const
Definition: Maps.h:2097
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1771
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:448
void read(std::istream &is) override
read serialization
Definition: Maps.h:816
Vec3d voxelSize() const final
Return the lengths of the images of the segments (0,0,0) − 1,0,0), (0,0,0) − (0,1,0) and (0,0,0) − (0,0,1).
Definition: Maps.h:811
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:1047
AffineMap::Ptr getAffineMap() const
Definition: Maps.h:2658
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1242
MatType scale(const Vec3< typename MatType::value_type > &s)
Return a matrix that scales by s.
Definition: Mat.h:615
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1728
bool hasUniformScale() const final
Return true if the values have the same magitude (eg. -1, 1, -1 would be a rotation).
Definition: Maps.h:719
void accumPostTranslation(const Vec3d &v)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:517
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:607
bool hasUniformScale() const final
Return true if the scale values have the same magnitude (eg. -1, 1, -1 would be a rotation)...
Definition: Maps.h:1250
bool operator!=(const AffineMap &other) const
Definition: Maps.h:399
bool isDiagonal() const
Return true if the underylying matrix is diagonal.
Definition: Maps.h:471
bool operator!=(const TranslationMap &other) const
Definition: Maps.h:1090
static bool isRegistered()
Definition: Maps.h:703
Mat3d applyIJC(const Mat3d &in) const final
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1314
T * asPointer()
Definition: Vec3.h:94
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1043
A specialized linear transform that performs a unitary maping i.e. rotation and or reflection...
Definition: Maps.h:1623
UnitaryMap(Axis axis, double radians)
Definition: Maps.h:1641
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:1165
static void registerMap()
Definition: Maps.h:1710
const Coord & max() const
Definition: Coord.h:322
Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &) const final
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation) ...
Definition: Maps.h:1285
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:446
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:533
MapBase::Ptr postRotate(double radians, Axis axis=X_AXIS) const override
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:589
void read(std::istream &is) override
read serialization
Definition: Maps.h:1071
bool operator==(const MyType &other) const
Definition: Maps.h:2623
double determinant(const Vec3d &) const override
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:457
ScaleTranslateMap()
Definition: Maps.h:1171
A specialized linear transform that performs a translation.
Definition: Maps.h:980
Vec3d asVec3d() const
Definition: Coord.h:143
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:2460
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1803
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:1849
bool isUnitary(const MatType &m)
Determine if a matrix is unitary (i.e., rotation or reflection).
Definition: Mat.h:889
double getDepth() const
Return the unscaled frustm depth.
Definition: Maps.h:2361
bool isApproxEqual(const Type &a, const Type &b, const Type &tolerance)
Return true if a is equal to b to within the given tolerance.
Definition: Math.h:406
Vec3d applyJT(const Vec3d &in) const final
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:766
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:825
static Name mapType()
Return NonlinearFrustumMap.
Definition: Maps.h:2045
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:1144
static void registerMap()
Definition: Maps.h:363
double determinant(const Vec3d &) const override
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:1779
static fileSize_t write(std::ostream &os, const GridHandle< BufferT > &handle, Codec codec)
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1745
ScaleMap(const ScaleMap &other)
Definition: Maps.h:682
bool normalize(T eps=T(1.0e-7))
this = normalized this
Definition: Vec3.h:362
math::BBox< Vec3d > BBoxd
Definition: Types.h:84
static void registerMap()
Definition: Maps.h:705
Vec3d applyMap(const Vec3d &in) const final
Return the image of under the map.
Definition: Maps.h:1260
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const final
Return the Jacobian of the map applied to in.
Definition: Maps.h:1277
Name type() const
Definition: Maps.h:2617
bool isType() const
Return true if this map is of concrete type MapT (e.g., AffineMap).
Definition: Maps.h:150
SharedPtr< MapBase > Ptr
Definition: Maps.h:137
NonlinearFrustumMap()
Definition: Maps.h:1900
bool operator!=(const ScaleTranslateMap &other) const
Definition: Maps.h:1392
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:2481
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:2073
static Name mapType()
Definition: Maps.h:2618
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:1350
SharedPtr< const MyType > ConstPtr
Definition: Maps.h:2601
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:658
void setCol(int j, const Vec3< T > &v)
Set jth column to vector v.
Definition: Mat3.h:159
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:2024
MapBase::Ptr copy() const override
Returns a MapBase::Ptr to a deep copy of *this.
Definition: Maps.h:1701
NonlinearFrustumMap(const NonlinearFrustumMap &other)
Definition: Maps.h:1935
static Name mapType()
Definition: Maps.h:1012
Threadsafe singleton object for accessing the map type-name dictionary. Associates a map type-name wi...
Definition: Maps.h:262
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:996
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:633
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1093
Definition: version.h.in:255
std::string str() const override
string serialization, useful for debugging
Definition: Maps.h:535
T & z()
Definition: Vec3.h:87
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:893
bool hasUniformScale() const override
Return false ( test if this is unitary with translation )
Definition: Maps.h:377
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:1422
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:2474
double determinant() const final
Return the product of the scale values.
Definition: Maps.h:793
static void read(std::istream &is, GridHandle< BufferT > &handle, Codec codec)
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:2467
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:2169
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Definition: Maps.h:436
static bool isRegistered()
Definition: Maps.h:2034
std::map< Name, MapBase::MapFactory > MapDictionary
Definition: Maps.h:265
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:1894
AffineMap & operator=(const AffineMap &other)
Definition: Maps.h:401
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const final
Definition: Maps.h:1325
Vec3< T > col(int j) const
Get jth column, e.g. Vec3d v = m.col(0);.
Definition: Mat3.h:168
bool isDiagonal(const MatType &mat)
Determine if a matrix is diagonal.
Definition: Mat.h:902
void read(std::istream &is)
Definition: Maps.h:2676
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:1348
OPENVDB_API SharedPtr< MapBase > simplify(SharedPtr< AffineMap > affine)
reduces an AffineMap to a ScaleMap or a ScaleTranslateMap when it can
void setDepth(double d)
set the frustum depth: distance between near and far plane = frustm depth * frustm x-width ...
Definition: Maps.h:2359
double determinant(const Vec3d &) const final
Return the product of the scale values, ignores argument.
Definition: Maps.h:1330
static Name mapType()
Definition: Maps.h:713
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:2438
bool isIdentity() const
Return true if the underlying matrix is approximately an identity.
Definition: Maps.h:469
ScaleTranslateMap(const ScaleTranslateMap &other)
Definition: Maps.h:1210
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:834
CompoundMap(const FirstMapType &f, const SecondMapType &s)
Definition: Maps.h:2606
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:2408
static void registerMap()
Definition: Maps.h:2036
bool operator==(const UnitaryMap &other) const
Definition: Maps.h:1730
AffineMap::Ptr inverse() const
Return AffineMap::Ptr to the inverse of this map.
Definition: Maps.h:553
A general linear transform using homogeneous coordinates to perform rotation, scaling, shear and translation.
Definition: Maps.h:298
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,1,0) and (0,0,0) − (0,0,1).
Definition: Maps.h:1788
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature for the linear second map.
Definition: Maps.h:2242
bool isValid() const
Definition: Maps.h:2372
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1073
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:803
Vec3d voxelSize() const final
Return the absolute values of the scale values.
Definition: Maps.h:1336
double determinant() const override
Return the determinant of the Jacobian.
Definition: Maps.h:459
UnitaryMap(const Mat3d &m)
Definition: Maps.h:1648
SharedPtr< const MapBase > ConstPtr
Definition: Maps.h:138
void read(std::istream &is) override
read serialization
Definition: Maps.h:2378
AffineMap()
Definition: Maps.h:304
Vec3d voxelSize() 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:464
UnitaryMap(const Mat4d &m)
Definition: Maps.h:1660
UnitaryMap(const Vec3d &axis, double radians)
Definition: Maps.h:1634
static bool isRegistered()
Definition: Maps.h:361
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:2196
Vec3d applyJacobian(const Vec3d &in) const final
Return the Jacobian of the map applied to in.
Definition: Maps.h:1281
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:370
void writeString(std::ostream &os, const Name &name)
Definition: Name.h:31
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:1840
bool isScaleTranslate() const
Return true if the map is equivalent to a ScaleTranslateMap.
Definition: Maps.h:475
ScaleMap()
Definition: Maps.h:664
Vec3d applyInverseJacobian(const Vec3d &in) const final
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation) ...
Definition: Maps.h:758
Name type() const override
Return UnitaryMap.
Definition: Maps.h:1718
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:1743
double determinant() const final
Return the product of the scale values.
Definition: Maps.h:1332
bool isLinear() const final
Return true (a ScaleTranslateMap is always linear).
Definition: Maps.h:1246
Vec4< T0 > transform(const Vec4< T0 > &v) const
Transform a Vec4 by post-multiplication.
Definition: Mat4.h:998
OPENVDB_API uint32_t getFormatVersion(std::ios_base &)
Return the file format version number associated with the given input stream.
TranslationMap()
Definition: Maps.h:987
T & x()
Reference to the component, e.g. v.x() = 4.5f;.
Definition: Vec3.h:85
bool operator==(const ScaleMap &other) const
Definition: Maps.h:844
MapBase::Ptr postRotate(double radians, Axis axis) const override
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation to the ...
Definition: Maps.h:885
bool isLinear() const final
Return true (a ScaleMap is always linear).
Definition: Maps.h:716
OPENVDB_API SharedPtr< FullyDecomposedMap > createFullyDecomposedMap(const Mat4d &m)
General decomposition of a Matrix into a Unitary (e.g. rotation) following a Symmetric (e...
bool isLinear() const override
Return true (an AffineMap is always linear).
Definition: Maps.h:374
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:1227
const FirstMapType & firstMap() const
Definition: Maps.h:2670
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:465
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1798
static Name mapType()
Definition: Maps.h:1243
Mat3 transpose() const
returns transpose of this
Definition: Mat3.h:454
SharedPtr< MyType > Ptr
Definition: Maps.h:2600
Vec3d applyJT(const Vec3d &in, const Vec3d &) const final
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:764
bool isIdentity() const
Definition: Maps.h:2641
SharedPtr< AffineMap > Ptr
Definition: Maps.h:301
bool operator!=(const MyType &other) const
Definition: Maps.h:2631
void setTaper(double t)
set the taper value, the ratio of nearplane width / far plane width
Definition: Maps.h:2355
Definition: Exceptions.h:13
bool hasTranslation(const Mat4< T > &m)
Definition: Mat4.h:1309
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:1923
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 appropraite operation...
Definition: Maps.h:559
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:1769
Vec3d applyJacobian(const Vec3d &in, const Vec3d &isloc) const override
Return the Jacobian defined at isloc applied to in.
Definition: Maps.h:2113
ValueT value
Definition: GridBuilder.h:1290
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:1741
UnitaryMap(const UnitaryMap &first, const UnitaryMap &second)
Definition: Maps.h:1691
Vec3d applyJT(const Vec3d &in, const Vec3d &) const final
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1296
bool hasUniformScale() const override
Return false (by convention false)
Definition: Maps.h:2051
Vec3d applyInverseJacobian(const Vec3d &in) const final
Return the Inverse Jacobian of the map applied to in (i.e. inverse map with out translation) ...
Definition: Maps.h:1290
MapBase::Ptr preRotate(double radians, Axis axis) const override
Return a MapBase::Ptr to a new map that is the result of prepending the appropriate operation...
Definition: Maps.h:1105
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:842
T det() const
Determinant of matrix.
Definition: Mat3.h:479
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the second map applied to in.
Definition: Maps.h:2191
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: Coord.h:496
ScaleTranslateMap(const ScaleMap &scale, const TranslationMap &translate)
Definition: Maps.h:1197
Name type() const override
Return NonlinearFrustumMap.
Definition: Maps.h:2043
Name readString(std::istream &is)
Definition: Name.h:20
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:2138
Vec3d applyInverseMap(const Vec3d &in) const final
Return the pre-image of under the map.
Definition: Maps.h:1268
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:389
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1225
MapBase::Ptr postRotate(double radians, Axis axis) const override
Return a MapBase::Ptr to a new map that is the result of postfixing the appropriate operation...
Definition: Maps.h:1130
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const final
Definition: Maps.h:787
Mat3d applyIJC(const Mat3d &mat) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1052
Creates the composition of two maps, each of which could be a composition. In the case that each comp...
Definition: Maps.h:42
UnitaryMap()
default constructor makes an Idenity.
Definition: Maps.h:1630
static bool isRegistered()
Definition: Maps.h:1233
Axis
Definition: Math.h:901
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:697
Tolerance for floating-point comparison.
Definition: Math.h:148
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the linear second map applied to in.
Definition: Maps.h:2111
double determinant(const Vec3d &) const override
Return 1.
Definition: Maps.h:1058
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:1446
Vec3d voxelSize() const override
Return (1,1,1).
Definition: Maps.h:1063
Vec3d applyIJT(const Vec3d &in) const final
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:774
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:1739
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:473
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:419
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const final
Return the Jacobian of the map applied to in.
Definition: Maps.h:745
bool isDiagonal() const
Definition: Maps.h:2650
double determinant() const override
Return the determinant of the Jacobian.
Definition: Maps.h:1781
const Vec3d & getTranslation() const
Returns the translation.
Definition: Maps.h:1343
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1382
void write(std::ostream &os) const
Definition: Maps.h:2682
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1762
MapBase::Ptr postRotate(double radians, Axis axis) const override
Return a MapBase::Ptr to a new map that is the result of postfixing the appropraite operation...
Definition: Maps.h:1433
Mat4 inverse(T tolerance=0) const
Definition: Mat4.h:485
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1760
const Vec3d & getTranslation() const
Return the translation vector.
Definition: Maps.h:1068
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:998
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:688
double determinant() const override
Return the determinant of the Jacobian of linear second map.
Definition: Maps.h:2317
AffineMap::Ptr getAffineMap() const override
Return a AffineMap equivalent to this map.
Definition: Maps.h:854
bool hasUniformScale() const override
Return false (by convention true)
Definition: Maps.h:1018
AffineMap(const AffineMap &other)
Definition: Maps.h:333
void read(std::istream &is) override
read serialization
Definition: Maps.h:1353
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:2445
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: BBox.h:134
bool operator!=(const UnitaryMap &other) const
Definition: Maps.h:1737
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1025
double determinant(const Vec3d &loc) const override
Definition: Maps.h:2321
bool hasUniformScale() const override
Return false (by convention true)
Definition: Maps.h:1726
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:873
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:1439
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:1346
std::shared_ptr< T > SharedPtr
Definition: Types.h:114
bool operator!=(const ScaleMap &other) const
Definition: Maps.h:851
const Mat4d & getConstMat4() const
Definition: Maps.h:617
Definition: Exceptions.h:61
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:416
void setFirstMap(const FirstMapType &first)
Definition: Maps.h:2673
Abstract base class for maps.
Definition: Maps.h:134
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:1137
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:1112
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:1857
MapBase()
Definition: Maps.h:247
bool isInvertible(const MatType &m)
Determine if a matrix is invertible.
Definition: Mat.h:869
Vec3d applyMap(const Vec3d &in) const final
Return the image of in under the map.
Definition: Maps.h:729
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:2029
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:1749
const Vec3d & getScale() const
Return the scale values that define the map.
Definition: Maps.h:798
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:577
Vec3d voxelSize() const override
Return the size of a voxel at the center of the near plane.
Definition: Maps.h:2329
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1395
Mat4d getMat4() const
Return the matrix representation of this AffineMap.
Definition: Maps.h:616
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleMap.
Definition: Maps.h:695
bool isIdentity() const
Return true if the map is equivalent to an identity.
Definition: Maps.h:2054
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1011
const BBoxd & getBBox() const
Return the bounding box that defines the frustum in pre-image space.
Definition: Maps.h:2366
void accumPreTranslation(const Vec3d &v)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:492
static MapBase::Ptr create()
Return a MapBase::Ptr to a new TranslationMap.
Definition: Maps.h:994
bool hasSimpleAffine() const
Return true if the second map is a uniform scale, Rotation and translation.
Definition: Maps.h:2375
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1041
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:357
static bool isRegistered()
Definition: Maps.h:1708
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:414
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:2100
MyType & operator=(const MyType &other)
Definition: Maps.h:2633
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:595
bool isLinear() const override
Return true (a UnitaryMap is always linear).
Definition: Maps.h:1723
static MapBase::Ptr create()
Return a MapBase::Ptr to a new NonlinearFrustumMap.
Definition: Maps.h:2022
Mat3 inverse(T tolerance=0) const
Definition: Mat3.h:465
const SecondMapType & secondMap() const
Definition: Maps.h:2671
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1082
void accumPostScale(const Vec3d &v)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:512
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:601
Int32 ValueType
Definition: Coord.h:32
Mat3d applyIJC(const Mat3d &in) const final
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:776
OPENVDB_API SharedPtr< SymmetricMap > createSymmetricMap(const Mat3d &m)
Utility methods.
bool isLinear() const override
Return true (a TranslationMap is always linear).
Definition: Maps.h:1015
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:1411
double determinant(const Vec3d &) const final
Return the product of the scale values, ignores argument.
Definition: Maps.h:791
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:1824
void accumPreShear(Axis axis0, Axis axis1, double shear)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:497
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
void read(std::istream &is) override
read serialization
Definition: Maps.h:1792
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:2106
Vec3d voxelSize(const Vec3d &) const final
Return the lengths of the images of the segments (0,0,0) − 1,0,0), (0,0,0) − (0,1,0) and (0,0,0) − (0,0,1).
Definition: Maps.h:812
Vec3d applyIJT(const Vec3d &in, const Vec3d &) const final
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:770
T & y()
Definition: Vec3.h:86
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:425
bool isScale() const
Return true if the map is equivalent to a ScaleMap.
Definition: Maps.h:473
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 isLinear() const override
Return false (a NonlinearFrustumMap is never linear).
Definition: Maps.h:2048
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:2431
const AffineMap & secondMap() const
Return MapBase::Ptr& to the second map.
Definition: Maps.h:2369
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:1816
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:805
static void registerMap()
Definition: Maps.h:1235
Definition: Exceptions.h:56
double determinant() const override
Return 1.
Definition: Maps.h:1060
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:801
ScaleMap(const Vec3d &scale)
Definition: Maps.h:668
Mat3d applyIJC(const Mat3d &mat, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:1053
bool isIdentity(const MatType &m)
Determine if a matrix is an identity matrix.
Definition: Mat.h:860
double getGamma() const
Definition: Maps.h:2363
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:712
OPENVDB_API SharedPtr< PolarDecomposedMap > createPolarDecomposedMap(const Mat3d &m)
Decomposes a general linear into translation following polar decomposition.
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:2142
std::string Name
Definition: Name.h:17
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1363
T length() const
Length of the vector.
Definition: Vec3.h:200
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:1774
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:212
void accumPostShear(Axis axis0, Axis axis1, double shear)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:522
MapBase::Ptr preRotate(double radians, Axis axis) const override
Return a MapBase::Ptr to a new map that is the result of prepending the appropraite operation...
Definition: Maps.h:1405
Vec3d voxelSize() const override
Returns the lengths of the images of the segments (0,0,0) − (1,0,0), (0,0,0) − (0,1,0) and (0,0,0) − (0,0,1).
Definition: Maps.h:1787
AffineMap(const Mat3d &m)
Definition: Maps.h:316
Vec3d applyIJT(const Vec3d &in) const final
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1306
static Name mapType()
Return UnitaryMap.
Definition: Maps.h:1720
TranslationMap(const TranslationMap &other)
Definition: Maps.h:989
CompoundMap()
Definition: Maps.h:2604