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&);
297 #if OPENVDB_ABI_VERSION_NUMBER >= 8 298 #define OPENVDB_MAP_CLASS_SPECIFIER final 299 #define OPENVDB_MAP_FUNC_SPECIFIER final 301 #define OPENVDB_MAP_CLASS_SPECIFIER 302 #define OPENVDB_MAP_FUNC_SPECIFIER override 316 mMatrix(
Mat4d::identity()),
317 mMatrixInv(
Mat4d::identity()),
318 mJacobianInv(
Mat3d::identity()),
320 mVoxelSize(
Vec3d(1,1,1)),
329 Mat4d mat4(Mat4d::identity());
332 updateAcceleration();
339 "Tried to initialize an affine transform from a non-affine 4x4 matrix");
341 updateAcceleration();
346 mMatrix(other.mMatrix),
347 mMatrixInv(other.mMatrixInv),
348 mJacobianInv(other.mJacobianInv),
349 mDeterminant(other.mDeterminant),
350 mVoxelSize(other.mVoxelSize),
351 mIsDiagonal(other.mIsDiagonal),
352 mIsIdentity(other.mIsIdentity)
358 mMatrix(first.mMatrix * second.mMatrix)
360 updateAcceleration();
372 static bool isRegistered() {
return MapRegistry::isRegistered(AffineMap::mapType()); }
376 MapRegistry::registerMap(
377 AffineMap::mapType(),
390 Mat3d mat = mMatrix.getMat3();
391 const double det = mat.
det();
395 mat *= (1.0 / pow(std::abs(det), 1.0/3.0));
400 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
405 if (!mMatrix.eq(other.mMatrix)) {
return false; }
406 if (!mMatrixInv.eq(other.mMatrixInv)) {
return false; }
414 mMatrix = other.mMatrix;
415 mMatrixInv = other.mMatrixInv;
417 mJacobianInv = other.mJacobianInv;
418 mDeterminant = other.mDeterminant;
419 mVoxelSize = other.mVoxelSize;
420 mIsDiagonal = other.mIsDiagonal;
421 mIsIdentity = other.mIsIdentity;
437 return applyInverseJacobian(in);
442 return mMatrixInv.transform3x3(in);
451 return Vec3d( m[ 0] * in[0] + m[ 1] * in[1] + m[ 2] * in[2],
452 m[ 4] * in[0] + m[ 5] * in[1] + m[ 6] * in[2],
453 m[ 8] * in[0] + m[ 9] * in[1] + m[10] * in[2] );
462 return mJacobianInv.
transpose()* m * mJacobianInv;
495 mMatrix.preRotate(axis, radians);
496 updateAcceleration();
501 updateAcceleration();
505 mMatrix.preTranslate(v);
506 updateAcceleration();
510 mMatrix.preShear(axis0, axis1, shear);
511 updateAcceleration();
520 mMatrix.postRotate(axis, radians);
521 updateAcceleration();
525 mMatrix.postScale(v);
526 updateAcceleration();
530 mMatrix.postTranslate(v);
531 updateAcceleration();
535 mMatrix.postShear(axis0, axis1, shear);
536 updateAcceleration();
542 void read(std::istream& is)
override { mMatrix.read(is); updateAcceleration(); }
544 void write(std::ostream& os)
const override { mMatrix.write(os); }
546 std::string
str()
const override 548 std::ostringstream buffer;
549 buffer <<
" - mat4:\n" << mMatrix.str() << std::endl;
550 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
573 affineMap->accumPreRotation(axis, radians);
579 affineMap->accumPreTranslation(t);
580 return StaticPtrCast<MapBase, AffineMap>(affineMap);
585 affineMap->accumPreScale(s);
586 return StaticPtrCast<MapBase, AffineMap>(affineMap);
591 affineMap->accumPreShear(axis0, axis1, shear);
603 affineMap->accumPostRotation(axis, radians);
609 affineMap->accumPostTranslation(t);
610 return StaticPtrCast<MapBase, AffineMap>(affineMap);
615 affineMap->accumPostScale(s);
616 return StaticPtrCast<MapBase, AffineMap>(affineMap);
621 affineMap->accumPostShear(axis0, axis1, shear);
632 void updateAcceleration() {
633 Mat3d mat3 = mMatrix.getMat3();
634 mDeterminant = mat3.
det();
638 "Tried to initialize an affine transform from a nearly singular matrix");
640 mMatrixInv = mMatrix.inverse();
645 mVoxelSize(0) = (applyMap(
Vec3d(1,0,0)) - pos).length();
646 mVoxelSize(1) = (applyMap(
Vec3d(0,1,0)) - pos).length();
647 mVoxelSize(2) = (applyMap(
Vec3d(0,0,1)) - pos).length();
658 bool mIsDiagonal, mIsIdentity;
676 mScaleValuesInverse(
Vec3d(1,1,1)),
677 mInvScaleSqr(1,1,1), mInvTwiceScale(0.5,0.5,0.5){}
682 mVoxelSize(
Vec3d(
std::abs(scale(0)),
std::abs(scale(1)),
std::abs(scale(2))))
684 double determinant = scale[0]* scale[1] * scale[2];
688 mScaleValuesInverse = 1.0 / mScaleValues;
689 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
690 mInvTwiceScale = mScaleValuesInverse / 2;
695 mScaleValues(other.mScaleValues),
696 mVoxelSize(other.mVoxelSize),
697 mScaleValuesInverse(other.mScaleValuesInverse),
698 mInvScaleSqr(other.mInvScaleSqr),
699 mInvTwiceScale(other.mInvTwiceScale)
714 static bool isRegistered() {
return MapRegistry::isRegistered(ScaleMap::mapType()); }
718 MapRegistry::registerMap(
733 std::abs(mScaleValues.x()), std::abs(mScaleValues.y()),
double(5e-7));
735 std::abs(mScaleValues.x()), std::abs(mScaleValues.z()),
double(5e-7));
743 in.x() * mScaleValues.x(),
744 in.y() * mScaleValues.y(),
745 in.z() * mScaleValues.z());
751 in.x() * mScaleValuesInverse.x(),
752 in.y() * mScaleValuesInverse.y(),
753 in.z() * mScaleValuesInverse.z());
757 return applyJacobian(in);
765 return applyInverseJacobian(in);
770 return applyInverseMap(in);
790 for (
int i = 0; i < 3; i++) {
791 tmp.
setRow(i, in.row(i) * mScaleValuesInverse(i));
793 for (
int i = 0; i < 3; i++) {
794 tmp.
setCol(i, tmp.
col(i) * mScaleValuesInverse(i));
805 return mScaleValues.x() * mScaleValues.y() * mScaleValues.z();
827 void read(std::istream& is)
override 829 mScaleValues.read(is);
831 mScaleValuesInverse.read(is);
832 mInvScaleSqr.read(is);
833 mInvTwiceScale.read(is);
836 void write(std::ostream& os)
const override 838 mScaleValues.write(os);
839 mVoxelSize.write(os);
840 mScaleValuesInverse.write(os);
841 mInvScaleSqr.write(os);
842 mInvTwiceScale.write(os);
845 std::string
str()
const override 847 std::ostringstream buffer;
848 buffer <<
" - scale: " << mScaleValues << std::endl;
849 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
853 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
858 if (!mScaleValues.eq(other.mScaleValues)) {
return false; }
878 affineMap->accumPreRotation(axis, radians);
887 affineMap->accumPreShear(axis0, axis1, shear);
899 affineMap->accumPostRotation(axis, radians);
907 affineMap->accumPostShear(axis0, axis1, shear);
913 Vec3d mScaleValues, mVoxelSize, mScaleValuesInverse, mInvScaleSqr, mInvTwiceScale;
938 const Vec3d& invScale = getInvScale();
942 static bool isRegistered() {
return MapRegistry::isRegistered(UniformScaleMap::mapType()); }
945 MapRegistry::registerMap(
946 UniformScaleMap::mapType(),
947 UniformScaleMap::create);
953 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
973 ScaleMap::preScale(
const Vec3d& v)
const 975 const Vec3d new_scale(v * mScaleValues);
985 ScaleMap::postScale(
const Vec3d& v)
const 1015 static bool isRegistered() {
return MapRegistry::isRegistered(TranslationMap::mapType()); }
1019 MapRegistry::registerMap(
1020 TranslationMap::mapType(),
1021 TranslationMap::create);
1045 return applyInverseJacobian(in);
1067 return applyIJC(mat);
1084 void read(std::istream& is)
override { mTranslation.read(is); }
1086 void write(std::ostream& os)
const override { mTranslation.write(os); }
1088 std::string
str()
const override 1090 std::ostringstream buffer;
1091 buffer <<
" - translation: " << mTranslation << std::endl;
1092 return buffer.str();
1095 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1100 return mTranslation.eq(other.mTranslation);
1108 Mat4d matrix(Mat4d::identity());
1121 affineMap->accumPreRotation(axis, radians);
1135 affineMap->accumPreShear(axis0, axis1, shear);
1146 affineMap->accumPostRotation(axis, radians);
1160 affineMap->accumPostShear(axis0, axis1, shear);
1186 mTranslation(
Vec3d(0,0,0)),
1187 mScaleValues(
Vec3d(1,1,1)),
1188 mVoxelSize(
Vec3d(1,1,1)),
1189 mScaleValuesInverse(
Vec3d(1,1,1)),
1190 mInvScaleSqr(1,1,1),
1191 mInvTwiceScale(0.5,0.5,0.5)
1197 mTranslation(translate),
1198 mScaleValues(scale),
1199 mVoxelSize(
std::abs(scale(0)),
std::abs(scale(1)),
std::abs(scale(2)))
1201 const double determinant = scale[0]* scale[1] * scale[2];
1205 mScaleValuesInverse = 1.0 / mScaleValues;
1206 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1207 mInvTwiceScale = mScaleValuesInverse / 2;
1212 mTranslation(translate.getTranslation()),
1214 mVoxelSize(
std::abs(mScaleValues(0)),
1215 std::abs(mScaleValues(1)),
1216 std::abs(mScaleValues(2))),
1217 mScaleValuesInverse(1.0 / scale.
getScale())
1219 mInvScaleSqr = mScaleValuesInverse * mScaleValuesInverse;
1220 mInvTwiceScale = mScaleValuesInverse / 2;
1225 mTranslation(other.mTranslation),
1226 mScaleValues(other.mScaleValues),
1227 mVoxelSize(other.mVoxelSize),
1228 mScaleValuesInverse(other.mScaleValuesInverse),
1229 mInvScaleSqr(other.mInvScaleSqr),
1230 mInvTwiceScale(other.mInvTwiceScale)
1243 mScaleValuesInverse, -mScaleValuesInverse * mTranslation));
1246 static bool isRegistered() {
return MapRegistry::isRegistered(ScaleTranslateMap::mapType()); }
1250 MapRegistry::registerMap(
1251 ScaleTranslateMap::mapType(),
1252 ScaleTranslateMap::create);
1266 std::abs(mScaleValues.x()), std::abs(mScaleValues.y()),
double(5e-7));
1268 std::abs(mScaleValues.x()), std::abs(mScaleValues.z()),
double(5e-7));
1276 in.x() * mScaleValues.x() + mTranslation.x(),
1277 in.y() * mScaleValues.y() + mTranslation.y(),
1278 in.z() * mScaleValues.z() + mTranslation.z());
1284 (in.x() - mTranslation.x() ) * mScaleValuesInverse.x(),
1285 (in.y() - mTranslation.y() ) * mScaleValuesInverse.y(),
1286 (in.z() - mTranslation.z() ) * mScaleValuesInverse.z());
1291 return applyJacobian(in);
1299 return applyInverseJacobian(in);
1304 return in * mScaleValuesInverse;
1316 return applyIJT(in);
1322 in.x() * mScaleValuesInverse.x(),
1323 in.y() * mScaleValuesInverse.y(),
1324 in.z() * mScaleValuesInverse.z());
1330 for (
int i=0; i<3; i++){
1331 tmp.
setRow(i, in.row(i)*mScaleValuesInverse(i));
1333 for (
int i=0; i<3; i++){
1334 tmp.
setCol(i, tmp.
col(i)*mScaleValuesInverse(i));
1339 return applyIJC(in);
1346 return mScaleValues.x() * mScaleValues.y() * mScaleValues.z();
1366 void read(std::istream& is)
override 1368 mTranslation.read(is);
1369 mScaleValues.read(is);
1370 mVoxelSize.read(is);
1371 mScaleValuesInverse.read(is);
1372 mInvScaleSqr.read(is);
1373 mInvTwiceScale.read(is);
1376 void write(std::ostream& os)
const override 1378 mTranslation.write(os);
1379 mScaleValues.write(os);
1380 mVoxelSize.write(os);
1381 mScaleValuesInverse.write(os);
1382 mInvScaleSqr.write(os);
1383 mInvTwiceScale.write(os);
1386 std::string
str()
const override 1388 std::ostringstream buffer;
1389 buffer <<
" - translation: " << mTranslation << std::endl;
1390 buffer <<
" - scale: " << mScaleValues << std::endl;
1391 buffer <<
" - voxel dimensions: " << mVoxelSize << std::endl;
1392 return buffer.str();
1395 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1400 if (!mScaleValues.eq(other.mScaleValues)) {
return false; }
1401 if (!mTranslation.eq(other.mTranslation)) {
return false; }
1411 affineMap->accumPostTranslation(mTranslation);
1421 affineMap->accumPreRotation(axis, radians);
1426 const Vec3d& s = mScaleValues;
1427 const Vec3d scaled_trans( t.
x() * s.
x(),
1438 affineMap->accumPreShear(axis0, axis1, shear);
1449 affineMap->accumPostRotation(axis, radians);
1462 affineMap->accumPostShear(axis0, axis1, shear);
1468 Vec3d mTranslation, mScaleValues, mVoxelSize, mScaleValuesInverse,
1469 mInvScaleSqr, mInvTwiceScale;
1474 ScaleMap::postTranslate(
const Vec3d& t)
const 1481 ScaleMap::preTranslate(
const Vec3d& t)
const 1484 const Vec3d& s = mScaleValues;
1485 const Vec3d scaled_trans( t.
x() * s.
x(),
1517 const Vec3d& scaleInv = getInvScale();
1518 const Vec3d& trans = getTranslation();
1524 return MapRegistry::isRegistered(UniformScaleTranslateMap::mapType());
1529 MapRegistry::registerMap(
1530 UniformScaleTranslateMap::mapType(), UniformScaleTranslateMap::create);
1536 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1549 const Vec3d new_trans = this->getTranslation() + scale * t;
1564 UniformScaleMap::postTranslate(
const Vec3d& t)
const 1572 UniformScaleMap::preTranslate(
const Vec3d& t)
const 1580 TranslationMap::preScale(
const Vec3d& v)
const 1591 TranslationMap::postScale(
const Vec3d& v)
const 1596 const Vec3d trans(mTranslation.x()*v.
x(),
1597 mTranslation.y()*v.
y(),
1598 mTranslation.z()*v.
z());
1605 ScaleTranslateMap::preScale(
const Vec3d& v)
const 1607 const Vec3d new_scale( v * mScaleValues );
1617 ScaleTranslateMap::postScale(
const Vec3d& v)
const 1619 const Vec3d new_scale( v * mScaleValues );
1620 const Vec3d new_trans( mTranslation.x()*v.
x(),
1621 mTranslation.y()*v.
y(),
1622 mTranslation.z()*v.
z() );
1670 Mat4d matrix(Mat4d::identity());
1679 "4x4 Matrix initializing unitary map was not unitary: not invertible");
1684 "4x4 Matrix initializing unitary map was not unitary: not affine");
1689 "4x4 Matrix initializing unitary map was not unitary: had translation");
1694 "4x4 Matrix initializing unitary map was not unitary");
1702 mAffineMap(other.mAffineMap)
1707 mAffineMap(*(first.getAffineMap()), *(second.getAffineMap()))
1711 ~UnitaryMap()
override =
default;
1720 return MapBase::Ptr(
new UnitaryMap(mAffineMap.getMat4().inverse()));
1723 static bool isRegistered() {
return MapRegistry::isRegistered(UnitaryMap::mapType()); }
1727 MapRegistry::registerMap(
1728 UnitaryMap::mapType(),
1729 UnitaryMap::create);
1743 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
1748 if (mAffineMap!=other.mAffineMap)
return false;
1752 bool operator!=(
const UnitaryMap& other)
const {
return !(*
this == other); }
1765 return applyInverseJacobian(in);
1770 return mAffineMap.applyInverseJacobian(in);
1778 return applyInverseMap(in);
1790 return applyIJC(in);
1796 double determinant()
const override {
return mAffineMap.determinant(); }
1807 void read(std::istream& is)
override 1809 mAffineMap.read(is);
1813 void write(std::ostream& os)
const override 1815 mAffineMap.write(os);
1818 std::string
str()
const override 1820 std::ostringstream buffer;
1821 buffer << mAffineMap.str();
1822 return buffer.str();
1833 UnitaryMap first(axis, radians);
1835 return StaticPtrCast<MapBase, UnitaryMap>(unitaryMap);
1842 affineMap->accumPreTranslation(t);
1850 affineMap->accumPreScale(v);
1858 affineMap->accumPreShear(axis0, axis1, shear);
1866 UnitaryMap second(axis, radians);
1868 return StaticPtrCast<MapBase, UnitaryMap>(unitaryMap);
1875 affineMap->accumPostTranslation(t);
1883 affineMap->accumPostScale(v);
1891 affineMap->accumPostShear(axis0, axis1, shear);
1929 MapBase(),mBBox(bb), mTaper(taper), mDepth(depth)
1941 mBBox(bb), mTaper(taper), mDepth(depth)
1943 if (!secondMap->isLinear() ) {
1945 "The second map in the Frustum transfrom must be linear");
1947 mSecondMap = *( secondMap->getAffineMap() );
1954 mTaper(other.mTaper),
1955 mDepth(other.mDepth),
1956 mSecondMap(other.mSecondMap),
1957 mHasSimpleAffine(other.mHasSimpleAffine)
1978 const Vec3d& direction,
1981 double z_near,
double depth,
1989 "The frustum depth must be non-zero and positive");
1991 if (!(up.
length() > 0)) {
1993 "The frustum height must be non-zero and positive");
1995 if (!(aspect > 0)) {
1997 "The frustum aspect ratio must be non-zero and positive");
2001 "The frustum up orientation must be perpendicular to into-frustum direction");
2004 double near_plane_height = 2 * up.
length();
2005 double near_plane_width = aspect * near_plane_height;
2010 mDepth = depth / near_plane_width;
2011 double gamma = near_plane_width / z_near;
2012 mTaper = 1./(mDepth*gamma + 1.);
2014 Vec3d direction_unit = direction;
2017 Mat4d r1(Mat4d::identity());
2019 Mat4d r2(Mat4d::identity());
2023 Vec3d(near_plane_width, near_plane_width, near_plane_width));
2027 Mat4d mat = scale * r2 * r1;
2048 "inverseMap() is not implemented for NonlinearFrustumMap");
2050 static bool isRegistered() {
return MapRegistry::isRegistered(NonlinearFrustumMap::mapType()); }
2054 MapRegistry::registerMap(
2055 NonlinearFrustumMap::mapType(),
2056 NonlinearFrustumMap::create);
2077 const Vec3d e1(1,0,0);
2078 if (!applyMap(e1).eq(e1))
return false;
2080 const Vec3d e2(0,1,0);
2081 if (!applyMap(e2).eq(e2))
return false;
2083 const Vec3d e3(0,0,1);
2084 if (!applyMap(e3).eq(e3))
return false;
2089 bool isEqual(
const MapBase& other)
const override {
return isEqualBase(*
this, other); }
2093 if (mBBox!=other.mBBox)
return false;
2100 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2103 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2106 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2109 if (!mSecondMap.applyMap(e).eq(other.mSecondMap.
applyMap(e)))
return false;
2118 return mSecondMap.applyMap(applyFrustumMap(in));
2124 return applyFrustumInverseMap(mSecondMap.applyInverseMap(in));
2133 Vec3d centered(isloc);
2134 centered = centered - mBBox.min();
2135 centered.
x() -= mXo;
2136 centered.
y() -= mYo;
2139 const double zprime = centered.
z()*mDepthOnLz;
2141 const double scale = (mGamma * zprime + 1.) / mLx;
2142 const double scale2 = mGamma * mDepthOnLz / mLx;
2144 const Vec3d tmp(scale * in.
x() + scale2 * centered.
x()* in.
z(),
2145 scale * in.
y() + scale2 * centered.
y()* in.
z(),
2146 mDepthOnLz * in.
z());
2148 return mSecondMap.applyJacobian(tmp);
2155 return mSecondMap.applyInverseJacobian(in);
2162 Vec3d centered(isloc);
2163 centered = centered - mBBox.min();
2164 centered.
x() -= mXo;
2165 centered.
y() -= mYo;
2168 const double zprime = centered.
z()*mDepthOnLz;
2170 const double scale = (mGamma * zprime + 1.) / mLx;
2171 const double scale2 = mGamma * mDepthOnLz / mLx;
2174 Vec3d out = mSecondMap.applyInverseJacobian(in);
2176 out.
x() = (out.
x() - scale2 * centered.
x() * out.
z() / mDepthOnLz) / scale;
2177 out.
y() = (out.
y() - scale2 * centered.
y() * out.
z() / mDepthOnLz) / scale;
2178 out.
z() = out.
z() / mDepthOnLz;
2186 const Vec3d tmp = mSecondMap.applyJT(in);
2189 Vec3d centered(isloc);
2190 centered = centered - mBBox.min();
2191 centered.
x() -= mXo;
2192 centered.
y() -= mYo;
2195 const double zprime = centered.
z()*mDepthOnLz;
2197 const double scale = (mGamma * zprime + 1.) / mLx;
2198 const double scale2 = mGamma * mDepthOnLz / mLx;
2200 return Vec3d(scale * tmp.
x(),
2202 scale2 * centered.
x()* tmp.
x() +
2203 scale2 * centered.
y()* tmp.
y() +
2204 mDepthOnLz * tmp.
z());
2208 return mSecondMap.applyJT(in);
2224 const Vec3d loc = applyFrustumMap(ijk);
2225 const double s = mGamma * loc.
z() + 1.;
2230 " at the singular focal point (e.g. camera)");
2233 const double sinv = 1.0/s;
2234 const double pt0 = mLx * sinv;
2235 const double pt1 = mGamma * pt0;
2236 const double pt2 = pt1 * sinv;
2238 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2241 Mat3d gradE(Mat3d::zero());
2242 for (
int j = 0; j < 3; ++j ) {
2243 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2244 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2245 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2249 for (
int i = 0; i < 3; ++i) {
2250 result(i) = d1_is(0) * gradE(0,i) + d1_is(1) * gradE(1,i) + d1_is(2) * gradE(2,i);
2265 const Vec3d loc = applyFrustumMap(ijk);
2267 const double s = mGamma * loc.
z() + 1.;
2272 " at the singular focal point (e.g. camera)");
2276 const double sinv = 1.0/s;
2277 const double pt0 = mLx * sinv;
2278 const double pt1 = mGamma * pt0;
2279 const double pt2 = pt1 * sinv;
2280 const double pt3 = pt2 * sinv;
2282 const Mat3d& jacinv = mSecondMap.getConstJacobianInv();
2286 Mat3d matE0(Mat3d::zero());
2287 Mat3d matE1(Mat3d::zero());
2288 for(
int j = 0; j < 3; j++) {
2289 for (
int k = 0; k < 3; k++) {
2291 const double pt4 = 2. * jacinv(2,j) * jacinv(2,k) * pt3;
2293 matE0(j,k) = -(jacinv(0,j) * jacinv(2,k) + jacinv(2,j) * jacinv(0,k)) * pt2 +
2296 matE1(j,k) = -(jacinv(1,j) * jacinv(2,k) + jacinv(2,j) * jacinv(1,k)) * pt2 +
2302 Mat3d gradE(Mat3d::zero());
2303 for (
int j = 0; j < 3; ++j ) {
2304 gradE(0,j) = pt0 * jacinv(0,j) - pt2 * loc.
x()*jacinv(2,j);
2305 gradE(1,j) = pt0 * jacinv(1,j) - pt2 * loc.
y()*jacinv(2,j);
2306 gradE(2,j) = (1./mDepthOnLz) * jacinv(2,j);
2309 Mat3d result(Mat3d::zero());
2312 for (
int m = 0; m < 3; ++m ) {
2313 for (
int n = 0; n < 3; ++n) {
2314 for (
int i = 0; i < 3; ++i ) {
2315 for (
int j = 0; j < 3; ++j) {
2316 result(m, n) += gradE(j, m) * gradE(i, n) * d2_is(i, j);
2322 for (
int m = 0; m < 3; ++m ) {
2323 for (
int n = 0; n < 3; ++n) {
2325 matE0(m, n) * d1_is(0) + matE1(m, n) * d1_is(1);
2333 double determinant()
const override {
return mSecondMap.determinant();}
2339 double s = mGamma * loc.
z() + 1.0;
2340 double frustum_determinant = s * s * mDepthOnLzLxLx;
2341 return mSecondMap.determinant() * frustum_determinant;
2347 const Vec3d loc( 0.5*(mBBox.min().x() + mBBox.max().x()),
2348 0.5*(mBBox.min().y() + mBBox.max().y()),
2351 return voxelSize(loc);
2361 Vec3d out, pos = applyMap(loc);
2362 out(0) = (applyMap(loc +
Vec3d(1,0,0)) - pos).length();
2363 out(1) = (applyMap(loc +
Vec3d(0,1,0)) - pos).length();
2364 out(2) = (applyMap(loc +
Vec3d(0,0,1)) - pos).length();
2394 void read(std::istream& is)
override 2405 is.read(reinterpret_cast<char*>(&mTaper),
sizeof(
double));
2406 is.read(reinterpret_cast<char*>(&mDepth),
sizeof(
double));
2412 if(!MapRegistry::isRegistered(type)) {
2417 MapBase::Ptr proxy = math::MapRegistry::createMap(type);
2419 mSecondMap = *(proxy->getAffineMap());
2424 void write(std::ostream& os)
const override 2427 os.write(reinterpret_cast<const char*>(&mTaper),
sizeof(
double));
2428 os.write(reinterpret_cast<const char*>(&mDepth),
sizeof(
double));
2431 mSecondMap.write(os);
2435 std::string
str()
const override 2437 std::ostringstream buffer;
2438 buffer <<
" - taper: " << mTaper << std::endl;
2439 buffer <<
" - depth: " << mDepth << std::endl;
2440 buffer <<
" SecondMap: "<< mSecondMap.type() << std::endl;
2441 buffer << mSecondMap.str() << std::endl;
2442 return buffer.str();
2471 mBBox, mTaper, mDepth, mSecondMap.preShear(shear, axis0, axis1)));
2500 mBBox, mTaper, mDepth, mSecondMap.postShear(shear, axis0, axis1)));
2507 mLx = mBBox.extents().x();
2508 mLy = mBBox.extents().y();
2509 mLz = mBBox.extents().z();
2513 " must have at least two index points in each direction.");
2520 mGamma = (1./mTaper - 1) / mDepth;
2522 mDepthOnLz = mDepth/mLz;
2523 mDepthOnLzLxLx = mDepthOnLz/(mLx * mLx);
2526 mHasSimpleAffine =
true;
2527 Vec3d tmp = mSecondMap.voxelSize();
2530 if (!
isApproxEqual(tmp(0), tmp(1))) { mHasSimpleAffine =
false;
return; }
2531 if (!
isApproxEqual(tmp(0), tmp(2))) { mHasSimpleAffine =
false;
return; }
2533 Vec3d trans = mSecondMap.applyMap(
Vec3d(0,0,0));
2535 Vec3d tmp1 = mSecondMap.applyMap(
Vec3d(1,0,0)) - trans;
2536 Vec3d tmp2 = mSecondMap.applyMap(
Vec3d(0,1,0)) - trans;
2537 Vec3d tmp3 = mSecondMap.applyMap(
Vec3d(0,0,1)) - trans;
2540 if (!
isApproxEqual(tmp1.
dot(tmp2), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2541 if (!
isApproxEqual(tmp2.
dot(tmp3), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2542 if (!
isApproxEqual(tmp3.
dot(tmp1), 0., 1.e-7)) { mHasSimpleAffine =
false;
return; }
2551 out = out - mBBox.min();
2556 out.
z() *= mDepthOnLz;
2558 double scale = (mGamma * out.
z() + 1.)/ mLx;
2567 Vec3d applyFrustumInverseMap(
const Vec3d& in)
const 2571 double invScale = mLx / (mGamma * out.
z() + 1.);
2572 out.
x() *= invScale;
2573 out.
y() *= invScale;
2578 out.
z() /= mDepthOnLz;
2581 out = out + mBBox.min();
2596 double mLx, mLy, mLz;
2597 double mXo, mYo, mGamma, mDepthOnLz, mDepthOnLzLxLx;
2600 bool mHasSimpleAffine;
2610 template<
typename FirstMapType,
typename SecondMapType>
2622 CompoundMap(
const FirstMapType& f,
const SecondMapType& s): mFirstMap(f), mSecondMap(s)
2624 updateAffineMatrix();
2628 mFirstMap(other.mFirstMap),
2629 mSecondMap(other.mSecondMap),
2630 mAffineMap(other.mAffineMap)
2636 return (FirstMapType::mapType() +
Name(
":") + SecondMapType::mapType());
2641 if (mFirstMap != other.mFirstMap)
return false;
2642 if (mSecondMap != other.mSecondMap)
return false;
2643 if (mAffineMap != other.mAffineMap)
return false;
2651 mFirstMap = other.mFirstMap;
2652 mSecondMap = other.mSecondMap;
2653 mAffineMap = other.mAffineMap;
2660 return mAffineMap.isIdentity();
2662 return mFirstMap.isIdentity()&&mSecondMap.isIdentity();
2668 return mAffineMap.isDiagonal();
2670 return mFirstMap.isDiagonal()&&mSecondMap.isDiagonal();
2681 "Constant affine matrix representation not possible for this nonlinear map");
2686 const FirstMapType&
firstMap()
const {
return mFirstMap; }
2687 const SecondMapType&
secondMap()
const {
return mSecondMap; }
2689 void setFirstMap(
const FirstMapType& first) { mFirstMap = first; updateAffineMatrix(); }
2690 void setSecondMap(
const SecondMapType& second) { mSecondMap = second; updateAffineMatrix(); }
2694 mAffineMap.read(is);
2696 mSecondMap.read(is);
2700 mAffineMap.write(os);
2701 mFirstMap.write(os);
2702 mSecondMap.write(os);
2706 void updateAffineMatrix()
2712 mAffineMap =
AffineMap(*first, *second);
2716 FirstMapType mFirstMap;
2717 SecondMapType mSecondMap;
2726 #endif // OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED const Mat4d & getConstMat4() const
Definition: Maps.h:628
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:475
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:606
bool operator==(const AffineMap &other) const
Definition: Maps.h:402
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:1303
Definition: Exceptions.h:56
Definition: Exceptions.h:61
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const final
Return the Jacobian of the map applied to in.
Definition: Maps.h:756
double determinant(const Vec3d &loc) const override
Definition: Maps.h:2337
bool operator==(const MyType &other) const
Definition: Maps.h:2639
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:582
bool isAffine(const Mat4< T > &m)
Definition: Mat4.h:1318
ScaleMap(const ScaleMap &other)
Definition: Maps.h:693
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the second map applied to in.
Definition: Maps.h:2207
Mat3< T > getMat3() const
Definition: Mat4.h:311
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:812
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:1011
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:1143
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:1240
Vec3d voxelSize(const Vec3d &) const override
Return (1,1,1).
Definition: Maps.h:1078
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:1060
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:2490
void read(std::istream &is)
Definition: Maps.h:2692
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:1459
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const final
Return the Jacobian of the map applied to in.
Definition: Maps.h:1290
const Coord & max() const
Definition: Coord.h:321
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:1150
bool isIdentity() const
Return true if the map is equivalent to an identity.
Definition: Maps.h:2070
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:1363
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:1049
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:74
void setTaper(double t)
set the taper value, the ratio of nearplane width / far plane width
Definition: Maps.h:2371
AffineMap(const AffineMap &other)
Definition: Maps.h:344
bool isValid() const
Definition: Maps.h:2388
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:588
double determinant() const final
Return the product of the scale values.
Definition: Maps.h:804
static bool isRegistered()
Definition: Maps.h:714
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:823
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
SharedPtr< UnitaryMap > Ptr
Definition: Maps.h:1641
Vec3d voxelSize() const final
Return the absolute values of the scale values.
Definition: Maps.h:1349
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:1784
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:1315
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:723
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:1178
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:370
CompoundMap(const FirstMapType &f, const SecondMapType &s)
Definition: Maps.h:2622
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:1424
UnitaryMap(const UnitaryMap &other)
Definition: Maps.h:1700
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1743
bool isDiagonal() const
Return true if the underylying matrix is diagonal.
Definition: Maps.h:482
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:2154
bool operator!=(const NonlinearFrustumMap &other) const
Definition: Maps.h:2113
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleTranslateMap.
Definition: Maps.h:1236
void accumPreTranslation(const Vec3d &v)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:503
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:769
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:2435
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:476
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:600
static Name mapType()
Return NonlinearFrustumMap.
Definition: Maps.h:2061
ScaleTranslateMap(const ScaleMap &scale, const TranslationMap &translate)
Definition: Maps.h:1210
const BBoxd & getBBox() const
Return the bounding box that defines the frustum in pre-image space.
Definition: Maps.h:2382
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:1452
AffineMap::Ptr inverse() const
Return AffineMap::Ptr to the inverse of this map.
Definition: Maps.h:564
double determinant(const Vec3d &) const override
Return 1.
Definition: Maps.h:1071
Vec3d applyJT(const Vec3d &in, const Vec3d &) const final
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1309
OPENVDB_API SharedPtr< MapBase > simplify(SharedPtr< AffineMap > affine)
reduces an AffineMap to a ScaleMap or a ScaleTranslateMap when it can
T & z()
Definition: Vec3.h:91
Mat4d getMat4() const
Return the matrix representation of this AffineMap.
Definition: Maps.h:627
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1056
Mat4 inverse(T tolerance=0) const
Definition: Mat4.h:499
Mat3d applyIJC(const Mat3d &m) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:461
bool operator!=(const UnitaryMap &other) const
Definition: Maps.h:1752
T & y()
Definition: Vec3.h:90
bool isDiagonal() const
Definition: Maps.h:2666
bool isIdentity(const MatType &m)
Determine if a matrix is an identity matrix.
Definition: Mat.h:882
bool isIdentity() const
Return true if the underlying matrix is approximately an identity.
Definition: Maps.h:480
static MapBase::Ptr create()
Return a MapBase::Ptr to a new TranslationMap.
Definition: Maps.h:1007
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:247
double determinant(const Vec3d &) const override
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:1794
static void registerMap()
Definition: Maps.h:1248
void accumPreShear(Axis axis0, Axis axis1, double shear)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:508
double determinant() const override
Return the determinant of the Jacobian of linear second map.
Definition: Maps.h:2333
std::string str() const override
string serialization, useful for debugging
Definition: Maps.h:546
bool hasTranslation(const Mat4< T > &m)
Definition: Mat4.h:1323
ScaleTranslateMap(const Vec3d &scale, const Vec3d &translate)
Definition: Maps.h:1195
AffineMap(const AffineMap &first, const AffineMap &second)
constructor that merges the matrixes for two affine maps
Definition: Maps.h:357
math::BBox< Vec3d > BBoxd
Definition: Types.h:84
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:2454
Mat3d applyIJC(const Mat3d &mat) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1065
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1788
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:1125
SharedPtr< MapBase > Ptr
Definition: Maps.h:137
ScaleMap()
Definition: Maps.h:675
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the linear second map applied to in.
Definition: Maps.h:2127
Definition: version.h.in:245
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:436
bool hasUniformScale() const override
Return false (by convention true)
Definition: Maps.h:1741
Vec3d applyJacobian(const Vec3d &in) const final
Return the Jacobian of the map applied to in.
Definition: Maps.h:1294
ScaleMap(const Vec3d &scale)
Definition: Maps.h:679
const Vec3d & getScale() const
Returns the scale values.
Definition: Maps.h:1354
bool isUnitary(const MatType &m)
Determine if a matrix is unitary (i.e., rotation or reflection).
Definition: Mat.h:911
Tolerance for floating-point comparison.
Definition: Math.h:147
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:2045
std::shared_ptr< T > SharedPtr
Definition: Types.h:114
bool operator==(const ScaleMap &other) const
Definition: Maps.h:855
void setTranslation(const Vec3< T > &t)
Definition: Mat4.h:328
static void registerMap()
Definition: Maps.h:1017
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:1855
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: BBox.h:134
void setDepth(double d)
set the frustum depth: distance between near and far plane = frustm depth * frustm x-width ...
Definition: Maps.h:2375
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:708
Vec3< T > col(int j) const
Get jth column, e.g. Vec3d v = m.col(0);.
Definition: Mat3.h:182
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:432
bool operator!=(const MyType &other) const
Definition: Maps.h:2647
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:1718
Vec3d applyMap(const Vec3d &in) const final
Return the image of under the map.
Definition: Maps.h:1273
OPENVDB_API SharedPtr< SymmetricMap > createSymmetricMap(const Mat3d &m)
Utility methods.
static fileSize_t write(std::ostream &os, const GridHandle< BufferT > &handle, Codec codec)
Vec3d applyMap(const Vec3d &in) const final
Return the image of in under the map.
Definition: Maps.h:740
bool operator!=(const TranslationMap &other) const
Definition: Maps.h:1103
UnitaryMap(const UnitaryMap &first, const UnitaryMap &second)
Definition: Maps.h:1706
bool operator==(const NonlinearFrustumMap &other) const
Definition: Maps.h:2091
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature for the linear second map.
Definition: Maps.h:2258
MapBase::Ptr copy() const override
Returns a MapBase::Ptr to a deep copy of *this.
Definition: Maps.h:1716
CompoundMap< CompoundMap< UnitaryMap, ScaleMap >, UnitaryMap > SpectralDecomposedMap
Definition: Maps.h:45
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:457
OPENVDB_API uint32_t getFormatVersion(std::ios_base &)
Return the file format version number associated with the given input stream.
static void registerMap()
Definition: Maps.h:716
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:381
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1086
bool isDiagonal(const MatType &mat)
Determine if a matrix is diagonal.
Definition: Mat.h:924
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:669
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:430
double getDepth() const
Return the unscaled frustm depth.
Definition: Maps.h:2377
Definition: Exceptions.h:59
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:1044
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: Coord.h:495
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1255
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:449
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Definition: Maps.h:447
float Round(float x)
Return x rounded to the nearest integer.
Definition: Math.h:822
void read(std::istream &is) override
read serialization
Definition: Maps.h:2394
SharedPtr< FullyDecomposedMap > createDecomposedMap()
on-demand decomposition of the affine map
Definition: Maps.h:555
NonlinearFrustumMap()
Definition: Maps.h:1916
Axis
Definition: Math.h:904
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:2089
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:1036
static void read(std::istream &is, GridHandle< BufferT > &handle, Codec codec)
static Name mapType()
Definition: Maps.h:1025
const Mat3d & getConstJacobianInv() const
Definition: Maps.h:629
T length() const
Length of the vector.
Definition: Vec3.h:204
bool hasSimpleAffine() const
Return true if the second map is a uniform scale, Rotation and translation.
Definition: Maps.h:2391
Abstract base class for maps.
Definition: Maps.h:134
Int32 ValueType
Definition: Coord.h:32
double determinant() const override
Return 1.
Definition: Maps.h:1073
void accumPostRotation(Axis axis, double radians)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:518
void read(std::istream &is) override
read serialization
Definition: Maps.h:1084
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:2040
Mat3d applyIJC(const Mat3d &mat, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:1066
Name type() const override
Return UnitaryMap.
Definition: Maps.h:1733
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:2212
AffineMap(const Mat4d &m)
Definition: Maps.h:335
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:1939
static void registerMap()
Definition: Maps.h:1725
void setFirstMap(const FirstMapType &first)
Definition: Maps.h:2689
void accumPreRotation(Axis axis, double radians)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:493
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1095
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:1910
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:875
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:2468
Map traits.
Definition: Maps.h:55
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1825
AffineMap & operator=(const AffineMap &other)
Definition: Maps.h:412
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1009
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1813
OPENVDB_API SharedPtr< PolarDecomposedMap > createPolarDecomposedMap(const Mat3d &m)
Decomposes a general linear into translation following polar decomposition.
Vec3d applyJacobian(const Vec3d &in, const Vec3d &isloc) const override
Return the Jacobian defined at isloc applied to in.
Definition: Maps.h:2129
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:2185
double determinant(const Vec3d &) const final
Return the product of the scale values, ignores argument.
Definition: Maps.h:802
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:781
UnitaryMap(Axis axis, double radians)
Definition: Maps.h:1656
std::string Name
Definition: Name.h:17
bool operator!=(const ScaleTranslateMap &other) const
Definition: Maps.h:1405
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:1977
static MapBase::Ptr create()
Return a MapBase::Ptr to a new AffineMap.
Definition: Maps.h:366
const Vec3d & getTranslation() const
Returns the translation.
Definition: Maps.h:1356
void setToRotation(Axis axis, T angle)
Sets the matrix to a rotation about the given axis.
Definition: Mat4.h:797
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:1872
bool operator!=(const ScaleMap &other) const
Definition: Maps.h:862
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:2122
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:1063
Mat3 transpose() const
returns transpose of this
Definition: Mat3.h:468
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:618
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:612
static void registerMap()
Definition: Maps.h:2052
UnitaryMap(const Vec3d &axis, double radians)
Definition: Maps.h:1649
bool isIdentity() const
Definition: Maps.h:2657
void setMat3(const Mat3< T > &m)
Set upper left to a Mat3.
Definition: Mat4.h:304
bool operator==(const ScaleTranslateMap &other) const
Definition: Maps.h:1397
UnitaryMap(const Mat3d &m)
Definition: Maps.h:1663
void read(std::istream &is) override
read serialization
Definition: Maps.h:827
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:1157
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:836
#define OPENVDB_MAP_CLASS_SPECIFIER
Definition: Maps.h:298
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const final
Definition: Maps.h:1338
bool isLinear() const override
Return true (an AffineMap is always linear).
Definition: Maps.h:385
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:1118
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1024
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:2447
T dot(const Vec3< T > &v) const
Dot product.
Definition: Vec3.h:195
bool operator==(const UnitaryMap &other) const
Definition: Maps.h:1745
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:2461
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleMap.
Definition: Maps.h:706
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:1802
SharedPtr< const MapBase > ConstPtr
Definition: Maps.h:138
A specialized linear transform that performs a unitary maping i.e. rotation and or reflection...
Definition: Maps.h:1638
Definition: Exceptions.h:13
TranslationMap()
Definition: Maps.h:1000
bool hasUniformScale() const override
Return false ( test if this is unitary with translation )
Definition: Maps.h:388
bool isLinear() const final
Return true (a ScaleMap is always linear).
Definition: Maps.h:727
void read(std::istream &is) override
read serialization
Definition: Maps.h:542
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:896
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:845
static bool isRegistered()
Definition: Maps.h:1723
static Name mapType()
Definition: Maps.h:2634
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const final
Definition: Maps.h:798
bool isScaleTranslate() const
Return true if the map is equivalent to a ScaleTranslateMap.
Definition: Maps.h:486
ValueT value
Definition: GridBuilder.h:1287
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:2116
Vec3d applyInverseMap(const Vec3d &in) const final
Return the pre-image of under the map.
Definition: Maps.h:1281
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1386
Vec3d applyJacobian(const Vec3d &in) const final
Return the Jacobian of the map applied to in.
Definition: Maps.h:760
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1088
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:1789
AffineMap()
Definition: Maps.h:315
Vec3d applyIJT(const Vec3d &in) const final
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1319
T * asPointer()
Definition: Vec3.h:98
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1238
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:459
MyType & operator=(const MyType &other)
Definition: Maps.h:2649
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:904
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:570
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:1758
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:1928
bool isType() const
Return true if this map is of concrete type MapT (e.g., AffineMap).
Definition: Maps.h:150
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1054
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:368
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:1132
bool operator==(const TranslationMap &other) const
Definition: Maps.h:1097
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:2497
bool isLinear() const override
Return true (a UnitaryMap is always linear).
Definition: Maps.h:1738
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:853
UnitaryMap()
default constructor makes an Idenity.
Definition: Maps.h:1645
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:814
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:1418
void accumPreScale(const Vec3d &v)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:498
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1760
MatType scale(const Vec3< typename MatType::value_type > &s)
Return a matrix that scales by s.
Definition: Mat.h:637
Vec3d voxelSize() const override
Return (1,1,1).
Definition: Maps.h:1076
Vec3d applyJT(const Vec3d &in) const final
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:777
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:1446
bool isLinear() const final
Return true (a ScaleTranslateMap is always linear).
Definition: Maps.h:1259
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:1764
AffineMap(const Mat3d &m)
Definition: Maps.h:327
Name type() const override
Return NonlinearFrustumMap.
Definition: Maps.h:2059
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1818
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:400
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:441
double determinant(const Vec3d &) const override
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:468
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:2476
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:1769
static void registerMap()
Definition: Maps.h:374
bool operator!=(const AffineMap &other) const
Definition: Maps.h:410
AffineMap::Ptr getAffineMap() const override
Definition: Maps.h:2368
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:822
Vec3d applyJT(const Vec3d &in) const final
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1311
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:1803
Vec3d applyInverseMap(const Vec3d &in) const final
Return the pre-image of in under the map.
Definition: Maps.h:748
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:1888
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:2424
Mat3d applyIJC(const Mat3d &in) const final
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1327
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:407
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1106
static bool isEqualBase(const MapT &self, const MapBase &other)
Definition: Maps.h:250
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:1839
static MapBase::Ptr create()
Return a MapBase::Ptr to a new NonlinearFrustumMap.
Definition: Maps.h:2038
A general linear transform using homogeneous coordinates to perform rotation, scaling, shear and translation.
Definition: Maps.h:309
void write(std::ostream &os) const
Definition: Maps.h:2698
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:1298
Creates the composition of two maps, each of which could be a composition. In the case that each comp...
Definition: Maps.h:42
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1395
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:544
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1777
Vec4< T0 > transform(const Vec4< T0 > &v) const
Transform a Vec4 by post-multiplication.
Definition: Mat4.h:1012
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:710
static Name mapType()
Return UnitaryMap.
Definition: Maps.h:1735
Vec3d applyIJT(const Vec3d &d1_is, const Vec3d &ijk) const override
Definition: Maps.h:2222
T det() const
Determinant of matrix.
Definition: Mat3.h:493
void setToRotation(const Quat< T > &q)
Set this matrix to the rotation matrix specified by the quaternion.
Definition: Mat3.h:267
void setCol(int j, const Vec3< T > &v)
Set jth column to vector v.
Definition: Mat3.h:173
ScaleTranslateMap()
Definition: Maps.h:1184
void setSecondMap(const SecondMapType &second)
Definition: Maps.h:2690
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:655
static bool isRegistered()
Definition: Maps.h:2050
T & x()
Reference to the component, e.g. v.x() = 4.5f;.
Definition: Vec3.h:89
bool hasUniformScale() const override
Return false (by convention true)
Definition: Maps.h:1031
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:425
Vec3d applyJT(const Vec3d &in, const Vec3d &) const final
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:775
Mat3 inverse(T tolerance=0) const
Definition: Mat3.h:479
ScaleTranslateMap(const ScaleTranslateMap &other)
Definition: Maps.h:1223
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:2158
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:1435
UnitaryMap(const Mat4d &m)
Definition: Maps.h:1675
const AffineMap & secondMap() const
Return MapBase::Ptr& to the second map.
Definition: Maps.h:2385
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:2483
SharedPtr< AffineMap > Ptr
Definition: Maps.h:312
Vec3d voxelSize(const Vec3d &) const final
Return the absolute values of the scale values, ignores argument.
Definition: Maps.h:1351
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1408
static bool isRegistered()
Definition: Maps.h:1246
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:464
bool normalize(T eps=T(1.0e-7))
this = normalized this
Definition: Vec3.h:366
const Vec3d & getTranslation() const
Return the translation vector.
Definition: Maps.h:1081
AffineMap::Ptr getAffineMap() const override
Return a AffineMap equivalent to this map.
Definition: Maps.h:865
bool isLinear() const override
Return true (a TranslationMap is always linear).
Definition: Maps.h:1028
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:1831
OPENVDB_API Mat4d approxInverse(const Mat4d &mat)
Returns the left pseudoInverse of the input matrix when the 3x3 part is symmetric otherwise it zeros ...
static Name mapType()
Definition: Maps.h:724
bool isScale() const
Return true if the map is equivalent to a ScaleMap.
Definition: Maps.h:484
MapBase()
Definition: Maps.h:247
double determinant() const override
Return the determinant of the Jacobian.
Definition: Maps.h:1796
A specialized linear transform that performs a translation.
Definition: Maps.h:993
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:1361
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1040
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:816
#define OPENVDB_MAP_FUNC_SPECIFIER
Definition: Maps.h:299
SharedPtr< MyType > Ptr
Definition: Maps.h:2616
double getGamma() const
Definition: Maps.h:2379
void setRow(int i, const Vec3< T > &v)
Set ith row to vector v.
Definition: Mat3.h:155
const FirstMapType & firstMap() const
Definition: Maps.h:2686
void accumPostTranslation(const Vec3d &v)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:528
static MapBase::Ptr create()
Return a MapBase::Ptr to a new UnitaryMap.
Definition: Maps.h:1714
static Name mapType()
Definition: Maps.h:382
static bool isRegistered()
Definition: Maps.h:1015
TranslationMap(const TranslationMap &other)
Definition: Maps.h:1002
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:1359
std::map< Name, MapBase::MapFactory > MapDictionary
Definition: Maps.h:265
Name readString(std::istream &is)
Definition: Name.h:20
static bool isRegistered()
Definition: Maps.h:372
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:1754
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:1756
void read(std::istream &is) override
read serialization
Definition: Maps.h:1807
Mat3d applyIJC(const Mat3d &d2_is, const Vec3d &d1_is, const Vec3d &ijk) const override
Definition: Maps.h:2263
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:1880
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1038
CompoundMap()
Definition: Maps.h:2620
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:427
double determinant() const final
Return the product of the scale values.
Definition: Maps.h:1345
bool isLinear() const override
Return false (a NonlinearFrustumMap is never linear).
Definition: Maps.h:2064
AffineMap::Ptr getAffineMap() const
Definition: Maps.h:2674
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:1034
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:2359
void writeString(std::ostream &os, const Name &name)
Definition: Name.h:31
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:764
TranslationMap(const Vec3d &t)
Definition: Maps.h:1001
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1786
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1775
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:116
const Vec3d & getScale() const
Return the scale values that define the map.
Definition: Maps.h:809
Vec3d asVec3d() const
Definition: Coord.h:143
const Coord & min() const
Definition: Coord.h:320
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:1847
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:477
Vec3d applyIJT(const Vec3d &in) const final
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:785
const SecondMapType & secondMap() const
Definition: Maps.h:2687
Threadsafe singleton object for accessing the map type-name dictionary. Associates a map type-name wi...
Definition: Maps.h:262
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to a deep copy of the current AffineMap.
Definition: Maps.h:561
NonlinearFrustumMap(const NonlinearFrustumMap &other)
Definition: Maps.h:1951
double determinant() const override
Return the determinant of the Jacobian.
Definition: Maps.h:470
bool hasUniformScale() const final
Return true if the values have the same magitude (eg. -1, 1, -1 would be a rotation).
Definition: Maps.h:730
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:1864
void accumPostScale(const Vec3d &v)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:523
CompoundMap(const MyType &other)
Definition: Maps.h:2627
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:1263
double determinant(const Vec3d &) const final
Return the product of the scale values, ignores argument.
Definition: Maps.h:1343
SharedPtr< const MyType > ConstPtr
Definition: Maps.h:2617
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:576
Mat3d applyIJC(const Mat3d &in) const final
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:787
bool hasUniformScale() const override
Return false (by convention false)
Definition: Maps.h:2067
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:884
bool isInvertible(const MatType &m)
Determine if a matrix is invertible.
Definition: Mat.h:891
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:202
static Name mapType()
Definition: Maps.h:1256
OPENVDB_API SharedPtr< FullyDecomposedMap > createFullyDecomposedMap(const Mat4d &m)
General decomposition of a Matrix into a Unitary (e.g. rotation) following a Symmetric (e...
void read(std::istream &is) override
read serialization
Definition: Maps.h:1366
void accumPostShear(Axis axis0, Axis axis1, double shear)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:533
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1376
Name type() const
Definition: Maps.h:2633
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:710
double getTaper() const
Return the taper value.
Definition: Maps.h:2373
Vec3d voxelSize() const override
Return the size of a voxel at the center of the near plane.
Definition: Maps.h:2345