6#ifndef OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED
7#define OPENVDB_MATH_MAPS_HAS_BEEN_INCLUDED
35class ScaleTranslateMap;
37class UniformScaleTranslateMap;
40class NonlinearFrustumMap;
42template<
typename T1,
typename T2>
class CompoundMap;
79template<
typename T>
struct is_scale {
static const bool value =
false; };
150 template<
typename MapT>
bool isType()
const {
return this->type() == MapT::mapType(); }
187 virtual void read(std::istream&) = 0;
188 virtual void write(std::ostream&)
const = 0;
190 virtual std::string
str()
const = 0;
249 template<
typename MapT>
252 return other.
isType<MapT>() && (self == *
static_cast<const MapT*
>(&other));
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();
631 mIsDiagonal = math::isDiagonal(mMatrix);
632 mIsIdentity = math::isIdentity(mMatrix);
633 Vec3d pos = applyMap(Vec3d(0,0,0));
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){}
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); }
961ScaleMap::preScale(
const Vec3d& v)
const
963 const Vec3d new_scale(v * mScaleValues);
973ScaleMap::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),
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))),
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;
1461ScaleMap::postTranslate(
const Vec3d& t)
const
1468ScaleMap::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); }
1526 return ScaleTranslateMap::operator==(other);
1535 const Vec3d new_trans = this->getTranslation() +
scale * t;
1550UniformScaleMap::postTranslate(
const Vec3d& t)
const
1558UniformScaleMap::preTranslate(
const Vec3d& t)
const
1566TranslationMap::preScale(
const Vec3d& v)
const
1577TranslationMap::postScale(
const Vec3d& v)
const
1582 const Vec3d trans(mTranslation.x()*v.
x(),
1583 mTranslation.y()*v.
y(),
1584 mTranslation.z()*v.
z());
1591ScaleTranslateMap::preScale(
const Vec3d& v)
const
1593 const Vec3d new_scale( v * mScaleValues );
1603ScaleTranslateMap::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()))
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;
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();
1820 return StaticPtrCast<MapBase, UnitaryMap>(unitaryMap);
1827 affineMap->accumPreTranslation(t);
1835 affineMap->accumPreScale(v);
1843 affineMap->accumPreShear(axis0, axis1,
shear);
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));
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;
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; }
2529 Vec3d applyFrustumMap(
const Vec3d& in)
const
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();
2577 AffineMap mSecondMap;
2580 double mLx, mLy, mLz;
2581 double mXo, mYo, mGamma, mDepthOnLz, mDepthOnLzLxLx;
2584 bool mHasSimpleAffine;
2594template<
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;
2703 AffineMap mAffineMap;
ValueT value
Definition: GridBuilder.h:1290
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
Definition: Exceptions.h:56
Definition: Exceptions.h:59
Definition: Exceptions.h:61
A general linear transform using homogeneous coordinates to perform rotation, scaling,...
Definition: Maps.h:299
MapBase::Ptr postScale(const Vec3d &s) const override
Definition: Maps.h:601
void accumPostShear(Axis axis0, Axis axis1, double shear)
Definition: Maps.h:522
static void registerMap()
Definition: Maps.h:363
AffineMap()
Definition: Maps.h:304
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:533
Vec3d voxelSize(const Vec3d &) const override
Definition: Maps.h:465
AffineMap(const Mat3d &m)
Definition: Maps.h:316
bool isDiagonal() const
Return true if the underylying matrix is diagonal.
Definition: Maps.h:471
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Definition: Maps.h:436
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:607
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:577
void accumPostRotation(Axis axis, double radians)
Modify the existing affine map by post-applying the given operation.
Definition: Maps.h:507
void accumPreShear(Axis axis0, Axis axis1, double shear)
Definition: Maps.h:497
MapBase::Ptr postTranslate(const Vec3d &t) const override
Definition: Maps.h:595
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:448
AffineMap(const AffineMap &first, const AffineMap &second)
constructor that merges the matrixes for two affine maps
Definition: Maps.h:346
Mat4d getMat4() const
Return the matrix representation of this AffineMap.
Definition: Maps.h:616
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:370
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to a deep copy of the current AffineMap.
Definition: Maps.h:550
double determinant(const Vec3d &) const override
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:457
bool operator!=(const AffineMap &other) const
Definition: Maps.h:399
bool hasUniformScale() const override
Return false ( test if this is unitary with translation )
Definition: Maps.h:377
bool operator==(const AffineMap &other) const
Definition: Maps.h:391
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
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:438
double determinant() const override
Return the determinant of the Jacobian.
Definition: Maps.h:459
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:419
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:453
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:357
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:421
std::string str() const override
string serialization, useful for debugging
Definition: Maps.h:535
AffineMap::Ptr inverse() const
Return AffineMap::Ptr to the inverse of this map.
Definition: Maps.h:553
bool isLinear() const override
Return true (an AffineMap is always linear).
Definition: Maps.h:374
const Mat3d & getConstJacobianInv() const
Definition: Maps.h:618
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
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
MapBase::Ptr preTranslate(const Vec3d &t) const override
Definition: Maps.h:565
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
MapBase::Ptr preScale(const Vec3d &s) const override
Definition: Maps.h:571
static bool isRegistered()
Definition: Maps.h:361
bool isScaleTranslate() const
Return true if the map is equivalent to a ScaleTranslateMap.
Definition: Maps.h:475
AffineMap(const AffineMap &other)
Definition: Maps.h:333
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
const Mat4d & getConstMat4() const
Definition: Maps.h:617
AffineMap & operator=(const AffineMap &other)
Definition: Maps.h:401
Mat3d applyIJC(const Mat3d &m) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:450
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
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:414
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:359
bool isIdentity() const
Return true if the underlying matrix is approximately an identity.
Definition: Maps.h:469
SharedPtr< const AffineMap > ConstPtr
Definition: Maps.h:302
void read(std::istream &is) override
read serialization
Definition: Maps.h:531
void accumPreRotation(Axis axis, double radians)
Modify the existing affine map by pre-applying the given operation.
Definition: Maps.h:482
bool isScale() const
Return true if the map is equivalent to a ScaleMap.
Definition: Maps.h:473
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:416
void accumPreScale(const Vec3d &v)
Definition: Maps.h:487
void accumPreTranslation(const Vec3d &v)
Definition: Maps.h:492
static MapBase::Ptr create()
Return a MapBase::Ptr to a new AffineMap.
Definition: Maps.h:355
SharedPtr< FullyDecomposedMap > createDecomposedMap()
on-demand decomposition of the affine map
Definition: Maps.h:544
SharedPtr< AffineMap > Ptr
Definition: Maps.h:301
void accumPostScale(const Vec3d &v)
Definition: Maps.h:512
~AffineMap() override=default
static Name mapType()
Definition: Maps.h:371
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:389
void accumPostTranslation(const Vec3d &v)
Definition: Maps.h:517
AffineMap(const Mat4d &m)
Definition: Maps.h:324
Creates the composition of two maps, each of which could be a composition. In the case that each comp...
Definition: Maps.h:2596
SharedPtr< MyType > Ptr
Definition: Maps.h:2600
const SecondMapType & secondMap() const
Definition: Maps.h:2671
const FirstMapType & firstMap() const
Definition: Maps.h:2670
void setSecondMap(const SecondMapType &second)
Definition: Maps.h:2674
bool isDiagonal() const
Definition: Maps.h:2650
SharedPtr< const MyType > ConstPtr
Definition: Maps.h:2601
void write(std::ostream &os) const
Definition: Maps.h:2682
void setFirstMap(const FirstMapType &first)
Definition: Maps.h:2673
AffineMap::Ptr getAffineMap() const
Definition: Maps.h:2658
CompoundMap()
Definition: Maps.h:2604
bool operator==(const MyType &other) const
Definition: Maps.h:2623
bool operator!=(const MyType &other) const
Definition: Maps.h:2631
Name type() const
Definition: Maps.h:2617
CompoundMap(const FirstMapType &f, const SecondMapType &s)
Definition: Maps.h:2606
bool isIdentity() const
Definition: Maps.h:2641
MyType & operator=(const MyType &other)
Definition: Maps.h:2633
static Name mapType()
Definition: Maps.h:2618
CompoundMap(const MyType &other)
Definition: Maps.h:2611
void read(std::istream &is)
Definition: Maps.h:2676
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:249
const Coord & min() const
Definition: Coord.h:321
const Coord & max() const
Definition: Coord.h:322
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: Coord.h:496
Int32 ValueType
Definition: Coord.h:32
Vec3d asVec3d() const
Definition: Coord.h:143
Abstract base class for maps.
Definition: Maps.h:135
virtual Vec3d voxelSize() const =0
Method to return the local size of a voxel. When a location is specified as an argument,...
virtual Vec3d applyInverseMap(const Vec3d &in) const =0
static bool isEqualBase(const MapT &self, const MapBase &other)
Definition: Maps.h:250
virtual Vec3d applyMap(const Vec3d &in) const =0
virtual SharedPtr< AffineMap > getAffineMap() const =0
SharedPtr< MapBase > Ptr
Definition: Maps.h:137
bool isType() const
Return true if this map is of concrete type MapT (e.g., AffineMap).
Definition: Maps.h:150
virtual double determinant() const =0
virtual MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const =0
virtual Mat3d applyIJC(const Mat3d &m) const =0
virtual Vec3d applyJT(const Vec3d &in) const =0
Apply the Jacobian transpose of this map to a vector. For a linear map this is equivalent to applying...
virtual std::string str() const =0
virtual Mat3d applyIJC(const Mat3d &m, const Vec3d &v, const Vec3d &domainPos) const =0
virtual Vec3d applyJT(const Vec3d &in, const Vec3d &domainPos) const =0
virtual MapBase::Ptr copy() const =0
virtual void read(std::istream &)=0
virtual ~MapBase()=default
virtual Vec3d voxelSize(const Vec3d &) const =0
virtual bool isLinear() const =0
Return true if this map is linear.
virtual bool hasUniformScale() const =0
Return true if the spacing between the image of latice is uniform in all directions.
virtual MapBase::Ptr preScale(const Vec3d &) const =0
virtual Vec3d applyInverseJacobian(const Vec3d &in) const =0
Apply the InverseJacobian of this map to a vector. For a linear map this is equivalent to applying th...
virtual Vec3d applyIJT(const Vec3d &in) const =0
Apply the Inverse Jacobian Transpose of this map to a vector. For a linear map this is equivalent to ...
SharedPtr< const MapBase > ConstPtr
Definition: Maps.h:138
virtual double determinant(const Vec3d &) const =0
MapBase()
Definition: Maps.h:247
virtual Vec3d applyIJT(const Vec3d &in, const Vec3d &domainPos) const =0
MapBase(const MapBase &)=default
virtual MapBase::Ptr postTranslate(const Vec3d &) const =0
virtual Name type() const =0
Return the name of this map's concrete type (e.g., "AffineMap").
virtual Vec3d applyInverseJacobian(const Vec3d &in, const Vec3d &domainPos) const =0
virtual void write(std::ostream &) const =0
virtual Vec3d applyJacobian(const Vec3d &in) const =0
Apply the Jacobian of this map to a vector. For a linear map this is equivalent to applying the map e...
virtual MapBase::Ptr preTranslate(const Vec3d &) const =0
virtual MapBase::Ptr postRotate(double radians, Axis axis=X_AXIS) const =0
virtual MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const =0
virtual MapBase::Ptr postScale(const Vec3d &) const =0
virtual Vec3d applyJacobian(const Vec3d &in, const Vec3d &domainPos) const =0
virtual MapBase::Ptr inverseMap() const =0
Return a new map representing the inverse of this map.
Ptr(*)() MapFactory
Definition: Maps.h:139
virtual bool isEqual(const MapBase &other) const =0
Return true if this map is equal to the given map.
virtual MapBase::Ptr preRotate(double radians, Axis axis=X_AXIS) const =0
Methods to update the map.
Threadsafe singleton object for accessing the map type-name dictionary. Associates a map type-name wi...
Definition: Maps.h:263
static MapBase::Ptr createMap(const Name &)
Create a new map of the given (registered) type name.
static void clear()
Clear the map type registry.
static void unregisterMap(const Name &)
Remove a map type from the registry.
static bool isRegistered(const Name &)
Return true if the given map type name is registered.
std::map< Name, MapBase::MapFactory > MapDictionary
Definition: Maps.h:265
static MapRegistry * instance()
static void registerMap(const Name &, MapBase::MapFactory)
Register a map type along with a factory function.
void setToRotation(const Quat< T > &q)
Set this matrix to the rotation matrix specified by the quaternion.
Definition: Mat3.h:253
Mat3 inverse(T tolerance=0) const
Definition: Mat3.h:465
void setCol(int j, const Vec3< T > &v)
Set jth column to vector v.
Definition: Mat3.h:159
Mat3 transpose() const
returns transpose of this
Definition: Mat3.h:454
T det() const
Determinant of matrix.
Definition: Mat3.h:479
Vec3< T > col(int j) const
Get jth column, e.g. Vec3d v = m.col(0);.
Definition: Mat3.h:168
void setRow(int i, const Vec3< T > &v)
Set ith row to vector v.
Definition: Mat3.h:141
Mat4 inverse(T tolerance=0) const
Definition: Mat4.h:485
Mat3< T > getMat3() const
Definition: Mat4.h:297
void setToRotation(Axis axis, T angle)
Sets the matrix to a rotation about the given axis.
Definition: Mat4.h:783
Vec4< T0 > transform(const Vec4< T0 > &v) const
Transform a Vec4 by post-multiplication.
Definition: Mat4.h:998
void setTranslation(const Vec3< T > &t)
Definition: Mat4.h:314
void setMat3(const Mat3< T > &m)
Set upper left to a Mat3.
Definition: Mat4.h:290
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:1895
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
NonlinearFrustumMap()
Definition: Maps.h:1900
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
void setTaper(double t)
set the taper value, the ratio of nearplane width / far plane width
Definition: Maps.h:2355
static void registerMap()
Definition: Maps.h:2036
const BBoxd & getBBox() const
Return the bounding box that defines the frustum in pre-image space.
Definition: Maps.h:2366
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:2408
bool operator!=(const NonlinearFrustumMap &other) const
Definition: Maps.h:2097
const AffineMap & secondMap() const
Return MapBase::Ptr& to the second map.
Definition: Maps.h:2369
double getGamma() const
Definition: Maps.h:2363
double getDepth() const
Return the unscaled frustm depth.
Definition: Maps.h:2361
Vec3d applyIJT(const Vec3d &d1_is, const Vec3d &ijk) const override
Definition: Maps.h:2206
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
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
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 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
bool operator==(const NonlinearFrustumMap &other) const
Definition: Maps.h:2075
bool isValid() const
Definition: Maps.h:2372
Name type() const override
Return NonlinearFrustumMap.
Definition: Maps.h:2043
AffineMap::Ptr getAffineMap() const override
Definition: Maps.h:2352
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
bool hasUniformScale() const override
Return false (by convention false)
Definition: Maps.h:2051
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
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the second map applied to in.
Definition: Maps.h:2191
double determinant() const override
Return the determinant of the Jacobian of linear second map.
Definition: Maps.h:2317
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:2024
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the linear second map applied to in.
Definition: Maps.h:2111
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:2419
SharedPtr< const NonlinearFrustumMap > ConstPtr
Definition: Maps.h:1898
bool isLinear() const override
Return false (a NonlinearFrustumMap is never linear).
Definition: Maps.h:2048
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 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
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
Vec3d voxelSize() const override
Return the size of a voxel at the center of the near plane.
Definition: Maps.h:2329
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
static bool isRegistered()
Definition: Maps.h:2034
double determinant(const Vec3d &loc) const override
Definition: Maps.h:2321
NonlinearFrustumMap(const NonlinearFrustumMap &other)
Definition: Maps.h:1935
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
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
Mat3d applyIJC(const Mat3d &d2_is, const Vec3d &d1_is, const Vec3d &ijk) const override
Definition: Maps.h:2247
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
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:2100
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
bool isIdentity() const
Return true if the map is equivalent to an identity.
Definition: Maps.h:2054
void read(std::istream &is) override
read serialization
Definition: Maps.h:2378
double getTaper() const
Return the taper value.
Definition: Maps.h:2357
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:2106
Vec3d voxelSize(const Vec3d &loc) const override
Returns the lengths of the images of the three segments from loc to loc + (1,0,0),...
Definition: Maps.h:2343
SharedPtr< NonlinearFrustumMap > Ptr
Definition: Maps.h:1897
static MapBase::Ptr create()
Return a MapBase::Ptr to a new NonlinearFrustumMap.
Definition: Maps.h:2022
void setDepth(double d)
set the frustum depth: distance between near and far plane = frustm depth * frustm x-width
Definition: Maps.h:2359
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature for the linear second map.
Definition: Maps.h:2242
static Name mapType()
Return NonlinearFrustumMap.
Definition: Maps.h:2045
Vec3d applyJacobian(const Vec3d &in, const Vec3d &isloc) const override
Return the Jacobian defined at isloc applied to in.
Definition: Maps.h:2113
bool hasSimpleAffine() const
Return true if the second map is a uniform scale, Rotation and translation.
Definition: Maps.h:2375
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:2073
~NonlinearFrustumMap() override=default
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:659
Vec3d voxelSize() const final
Return the lengths of the images of the segments (0,0,0) − 1,0,0), (0,0,0) − (0,1,...
Definition: Maps.h:811
const Vec3d & getScale() const
Return the scale values that define the map.
Definition: Maps.h:798
Vec3d applyInverseMap(const Vec3d &in) const final
Return the pre-image of in under the map.
Definition: Maps.h:737
static void registerMap()
Definition: Maps.h:705
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:825
SharedPtr< const ScaleMap > ConstPtr
Definition: Maps.h:662
Vec3d applyMap(const Vec3d &in) const final
Return the image of in under the map.
Definition: Maps.h:729
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:893
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:873
ScaleMap(const Vec3d &scale)
Definition: Maps.h:668
double determinant(const Vec3d &) const final
Return the product of the scale values, ignores argument.
Definition: Maps.h:791
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 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
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:805
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const final
Return the Jacobian of the map applied to in.
Definition: Maps.h:745
bool isLinear() const final
Return true (a ScaleMap is always linear).
Definition: Maps.h:716
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:712
AffineMap::Ptr getAffineMap() const override
Return a AffineMap equivalent to this map.
Definition: Maps.h:854
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
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:697
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:834
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
Vec3d applyJacobian(const Vec3d &in) const final
Return the Jacobian of the map applied to in.
Definition: Maps.h:749
Mat3d applyIJC(const Mat3d &in) const final
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:776
~ScaleMap() override=default
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
Vec3d applyJT(const Vec3d &in) const final
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:766
Vec3d voxelSize(const Vec3d &) const final
Definition: Maps.h:812
bool operator==(const ScaleMap &other) const
Definition: Maps.h:844
static bool isRegistered()
Definition: Maps.h:703
ScaleMap()
Definition: Maps.h:664
double determinant() const final
Return the product of the scale values.
Definition: Maps.h:793
Vec3d applyJT(const Vec3d &in, const Vec3d &) const final
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:764
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:803
ScaleMap(const ScaleMap &other)
Definition: Maps.h:682
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
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const final
Definition: Maps.h:787
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:699
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:801
void read(std::istream &is) override
read serialization
Definition: Maps.h:816
bool operator!=(const ScaleMap &other) const
Definition: Maps.h:851
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleMap.
Definition: Maps.h:695
static Name mapType()
Definition: Maps.h:713
SharedPtr< ScaleMap > Ptr
Definition: Maps.h:661
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:842
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
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:1166
Vec3d voxelSize() const final
Return the absolute values of the scale values.
Definition: Maps.h:1336
const Vec3d & getScale() const
Returns the scale values.
Definition: Maps.h:1341
bool operator==(const ScaleTranslateMap &other) const
Definition: Maps.h:1384
ScaleTranslateMap(const ScaleTranslateMap &other)
Definition: Maps.h:1210
Vec3d applyInverseMap(const Vec3d &in) const final
Return the pre-image of under the map.
Definition: Maps.h:1268
static void registerMap()
Definition: Maps.h:1235
bool operator!=(const ScaleTranslateMap &other) const
Definition: Maps.h:1392
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1363
~ScaleTranslateMap() override=default
Vec3d applyMap(const Vec3d &in) const final
Return the image of under the map.
Definition: Maps.h:1260
MapBase::Ptr postShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:1446
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:1422
double determinant(const Vec3d &) const final
Return the product of the scale values, ignores argument.
Definition: Maps.h:1330
Vec3d applyIJT(const Vec3d &in) const final
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1306
const Vec3d & getTranslation() const
Returns the translation.
Definition: Maps.h:1343
MapBase::Ptr postTranslate(const Vec3d &t) const override
Definition: Maps.h:1439
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
const Vec3d & getInvScale() const
Return 1/(scale)
Definition: Maps.h:1350
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const final
Return the Jacobian of the map applied to in.
Definition: Maps.h:1277
bool isLinear() const final
Return true (a ScaleTranslateMap is always linear).
Definition: Maps.h:1246
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1242
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1395
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
SharedPtr< ScaleTranslateMap > Ptr
Definition: Maps.h:1168
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:1225
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1373
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 applyJacobian(const Vec3d &in) const final
Return the Jacobian of the map applied to in.
Definition: Maps.h:1281
Mat3d applyIJC(const Mat3d &in) const final
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1314
ScaleTranslateMap(const Vec3d &scale, const Vec3d &translate)
Definition: Maps.h:1182
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 applyJT(const Vec3d &in) const final
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1298
Vec3d voxelSize(const Vec3d &) const final
Return the absolute values of the scale values, ignores argument.
Definition: Maps.h:1338
MapBase::Ptr preTranslate(const Vec3d &t) const override
Definition: Maps.h:1411
SharedPtr< const ScaleTranslateMap > ConstPtr
Definition: Maps.h:1169
static bool isRegistered()
Definition: Maps.h:1233
double determinant() const final
Return the product of the scale values.
Definition: Maps.h:1332
Vec3d applyJT(const Vec3d &in, const Vec3d &) const final
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1296
ScaleTranslateMap(const ScaleMap &scale, const TranslationMap &translate)
Definition: Maps.h:1197
const Vec3d & getInvTwiceScale() const
Return 1/(2 scale). Used to optimize some finite difference calculations.
Definition: Maps.h:1348
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
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const final
Definition: Maps.h:1325
ScaleTranslateMap()
Definition: Maps.h:1171
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:1227
const Vec3d & getInvScaleSqr() const
Return the square of the scale. Used to optimize some finite difference calculations.
Definition: Maps.h:1346
void read(std::istream &is) override
read serialization
Definition: Maps.h:1353
static MapBase::Ptr create()
Return a MapBase::Ptr to a new ScaleTranslateMap.
Definition: Maps.h:1223
static Name mapType()
Definition: Maps.h:1243
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1382
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
A specialized linear transform that performs a translation.
Definition: Maps.h:981
TranslationMap(const TranslationMap &other)
Definition: Maps.h:989
static void registerMap()
Definition: Maps.h:1004
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1073
Vec3d voxelSize(const Vec3d &) const override
Return (1,1,1).
Definition: Maps.h:1065
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 postShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:1144
MapBase::Ptr preShear(double shear, Axis axis0, Axis axis1) const override
Definition: Maps.h:1119
const Vec3d & getTranslation() const
Return the translation vector.
Definition: Maps.h:1068
MapBase::Ptr postTranslate(const Vec3d &t) const override
Definition: Maps.h:1137
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
~TranslationMap() override=default
SharedPtr< const TranslationMap > ConstPtr
Definition: Maps.h:984
Name type() const override
Return the name of this map's concrete type (e.g., "AffineMap").
Definition: Maps.h:1011
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1093
double determinant(const Vec3d &) const override
Return 1.
Definition: Maps.h:1058
bool hasUniformScale() const override
Return false (by convention true)
Definition: Maps.h:1018
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
TranslationMap()
Definition: Maps.h:987
Mat3d applyIJC(const Mat3d &mat) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1052
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1043
double determinant() const override
Return 1.
Definition: Maps.h:1060
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1025
Mat3d applyIJC(const Mat3d &mat, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:1053
MapBase::Ptr copy() const override
Return a MapBase::Ptr to a deep copy of this map.
Definition: Maps.h:996
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1027
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1075
bool isLinear() const override
Return true (a TranslationMap is always linear).
Definition: Maps.h:1015
TranslationMap(const Vec3d &t)
Definition: Maps.h:988
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
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 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 operator==(const TranslationMap &other) const
Definition: Maps.h:1084
MapBase::Ptr preTranslate(const Vec3d &t) const override
Definition: Maps.h:1112
Vec3d voxelSize() const override
Return (1,1,1).
Definition: Maps.h:1063
static bool isRegistered()
Definition: Maps.h:1002
SharedPtr< TranslationMap > Ptr
Definition: Maps.h:983
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
Vec3d applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:1021
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:998
void read(std::istream &is) override
read serialization
Definition: Maps.h:1071
Vec3d applyInverseMap(const Vec3d &in) const override
Return the pre-image of in under the map.
Definition: Maps.h:1023
static MapBase::Ptr create()
Return a MapBase::Ptr to a new TranslationMap.
Definition: Maps.h:994
static Name mapType()
Definition: Maps.h:1012
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1082
bool operator!=(const TranslationMap &other) const
Definition: Maps.h:1090
A specialized linear transform that performs a unitary maping i.e. rotation and or reflection.
Definition: Maps.h:1624
static void registerMap()
Definition: Maps.h:1710
bool operator==(const UnitaryMap &other) const
Definition: Maps.h:1730
void write(std::ostream &os) const override
write serialization
Definition: Maps.h:1798
Vec3d voxelSize(const Vec3d &) const override
Returns the lengths of the images of the segments (0,0,0) − (1,0,0), (0,0,0) − (0,...
Definition: Maps.h:1788
Vec3d applyJT(const Vec3d &in, const Vec3d &) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1760
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
UnitaryMap(const Mat4d &m)
Definition: Maps.h:1660
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
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
Vec3d applyIJT(const Vec3d &in) const override
Return the transpose of the inverse Jacobian of the map applied to in.
Definition: Maps.h:1771
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
Name type() const override
Return UnitaryMap.
Definition: Maps.h:1718
AffineMap::Ptr getAffineMap() const override
Return AffineMap::Ptr to an AffineMap equivalent to *this.
Definition: Maps.h:1810
double determinant(const Vec3d &) const override
Return the determinant of the Jacobian, ignores argument.
Definition: Maps.h:1779
bool hasUniformScale() const override
Return false (by convention true)
Definition: Maps.h:1726
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
Vec3d applyJT(const Vec3d &in) const override
Return the Jacobian Transpose of the map applied to in.
Definition: Maps.h:1762
double determinant() const override
Return the determinant of the Jacobian.
Definition: Maps.h:1781
Vec3d applyJacobian(const Vec3d &in, const Vec3d &) const override
Definition: Maps.h:1743
Mat3d applyIJC(const Mat3d &in, const Vec3d &, const Vec3d &) const override
Definition: Maps.h:1774
MapBase::Ptr copy() const override
Returns a MapBase::Ptr to a deep copy of *this.
Definition: Maps.h:1701
~UnitaryMap() override=default
Vec3d applyJacobian(const Vec3d &in) const override
Return the Jacobian of the map applied to in.
Definition: Maps.h:1745
std::string str() const override
string serialization, useful for debuging
Definition: Maps.h:1803
bool isLinear() const override
Return true (a UnitaryMap is always linear).
Definition: Maps.h:1723
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
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 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
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
UnitaryMap(const Vec3d &axis, double radians)
Definition: Maps.h:1634
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
Vec3d voxelSize() const override
Returns the lengths of the images of the segments (0,0,0) − (1,0,0), (0,0,0) − (0,...
Definition: Maps.h:1787
static bool isRegistered()
Definition: Maps.h:1708
UnitaryMap(Axis axis, double radians)
Definition: Maps.h:1641
SharedPtr< const UnitaryMap > ConstPtr
Definition: Maps.h:1627
UnitaryMap(const UnitaryMap &other)
Definition: Maps.h:1685
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 applyMap(const Vec3d &in) const override
Return the image of in under the map.
Definition: Maps.h:1739
MapBase::Ptr inverseMap() const override
Return a new map representing the inverse of this map.
Definition: Maps.h:1703
UnitaryMap()
default constructor makes an Idenity.
Definition: Maps.h:1630
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:1741
static MapBase::Ptr create()
Return a MapBase::Ptr to a new UnitaryMap.
Definition: Maps.h:1699
bool operator!=(const UnitaryMap &other) const
Definition: Maps.h:1737
Mat3d applyIJC(const Mat3d &in) const override
Return the Jacobian Curvature: zero for a linear map.
Definition: Maps.h:1773
SharedPtr< UnitaryMap > Ptr
Definition: Maps.h:1626
static Name mapType()
Return UnitaryMap.
Definition: Maps.h:1720
UnitaryMap(const Mat3d &m)
Definition: Maps.h:1648
UnitaryMap(const UnitaryMap &first, const UnitaryMap &second)
Definition: Maps.h:1691
bool isEqual(const MapBase &other) const override
Return true if this map is equal to the given map.
Definition: Maps.h:1728
T & x()
Reference to the component, e.g. v.x() = 4.5f;.
Definition: Vec3.h:85
T length() const
Length of the vector.
Definition: Vec3.h:200
T dot(const Vec3< T > &v) const
Dot product.
Definition: Vec3.h:191
T * asPointer()
Definition: Vec3.h:94
T & y()
Definition: Vec3.h:86
T & z()
Definition: Vec3.h:87
bool normalize(T eps=T(1.0e-7))
this = normalized this
Definition: Vec3.h:362
bool hasTranslation(const Mat4< T > &m)
Definition: Mat4.h:1309
OPENVDB_API SharedPtr< SymmetricMap > createSymmetricMap(const Mat3d &m)
Utility methods.
OPENVDB_API SharedPtr< PolarDecomposedMap > createPolarDecomposedMap(const Mat3d &m)
Decomposes a general linear into translation following polar decomposition.
bool isDiagonal(const MatType &mat)
Determine if a matrix is diagonal.
Definition: Mat.h:902
OPENVDB_API SharedPtr< MapBase > simplify(SharedPtr< AffineMap > affine)
reduces an AffineMap to a ScaleMap or a ScaleTranslateMap when it can
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
bool isInvertible(const MatType &m)
Determine if a matrix is invertible.
Definition: Mat.h:869
OPENVDB_API Mat4d approxInverse(const Mat4d &mat)
Returns the left pseudoInverse of the input matrix when the 3x3 part is symmetric otherwise it zeros ...
MatType scale(const Vec3< typename MatType::value_type > &s)
Return a matrix that scales by s.
Definition: Mat.h:615
bool isUnitary(const MatType &m)
Determine if a matrix is unitary (i.e., rotation or reflection).
Definition: Mat.h:889
Vec3< double > Vec3d
Definition: Vec3.h:664
OPENVDB_API SharedPtr< FullyDecomposedMap > createFullyDecomposedMap(const Mat4d &m)
General decomposition of a Matrix into a Unitary (e.g. rotation) following a Symmetric (e....
bool isAffine(const Mat4< T > &m)
Definition: Mat4.h:1304
float Round(float x)
Return x rounded to the nearest integer.
Definition: Math.h:819
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
Axis
Definition: Math.h:901
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
std::string Name
Definition: Name.h:17
Name readString(std::istream &is)
Definition: Name.h:20
void writeString(std::ostream &os, const Name &name)
Definition: Name.h:31
math::BBox< Vec3d > BBoxd
Definition: Types.h:84
@ OPENVDB_FILE_VERSION_FLOAT_FRUSTUM_BBOX
Definition: version.h.in:255
std::shared_ptr< T > SharedPtr
Definition: Types.h:114
Definition: Exceptions.h:13
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:74
Tolerance for floating-point comparison.
Definition: Math.h:148
Map traits.
Definition: Maps.h:55
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:212