31 #ifndef OPENVDB_MATH_TRANSFORM_HAS_BEEN_INCLUDED 32 #define OPENVDB_MATH_TRANSFORM_HAS_BEEN_INCLUDED 35 #include <openvdb/Types.h> 80 static Transform::Ptr createLinearTransform(
double voxelSize = 1.0);
84 double depth,
double voxelSize = 1.0);
88 bool isLinear()
const {
return mMap->isLinear(); }
97 void preRotate(
double radians,
const Axis axis =
X_AXIS);
103 void preTranslate(
const Vec3d&);
104 void preScale(
const Vec3d&);
105 void preScale(
double);
107 void preMult(
const Mat4d&);
108 void preMult(
const Mat3d&);
110 void postRotate(
double radians,
const Axis axis =
X_AXIS);
111 void postTranslate(
const Vec3d&);
112 void postScale(
const Vec3d&);
113 void postScale(
double);
114 void postShear(
double shear,
Axis axis0,
Axis axis1);
115 void postMult(
const Mat4d&);
116 void postMult(
const Mat3d&);
134 Vec3d indexToWorld(
const Vec3d& xyz)
const {
return mMap->applyMap(xyz); }
163 template<
typename MapType>
typename MapType::Ptr map();
166 template<
typename MapType>
typename MapType::ConstPtr map()
const;
167 template<
typename MapType>
typename MapType::ConstPtr constMap()
const;
171 void read(std::istream&);
173 void write(std::ostream&)
const;
178 void print(std::ostream& os = std::cout,
const std::string& indent =
"")
const;
194 template<
typename MapType>
195 inline typename MapType::Ptr
198 if (mMap->type() == MapType::mapType()) {
199 return StaticPtrCast<MapType>(mMap);
201 return typename MapType::Ptr();
205 template<
typename MapType>
206 inline typename MapType::ConstPtr
207 Transform::map()
const 209 return ConstPtrCast<const MapType>(
210 const_cast<Transform*
>(
this)->map<MapType>());
214 template<
typename MapType>
215 inline typename MapType::ConstPtr
216 Transform::constMap()
const 218 return map<MapType>();
226 template<
typename ResolvedMapType,
typename OpType>
230 ResolvedMapType& resolvedMap = *transform.
map<ResolvedMapType>();
232 op.operator()<ResolvedMapType>(resolvedMap);
234 op.template operator()<ResolvedMapType>(resolvedMap);
239 template<
typename ResolvedMapType,
typename OpType>
243 const ResolvedMapType& resolvedMap = *transform.
map<ResolvedMapType>();
245 op.operator()<ResolvedMapType>(resolvedMap);
247 op.template operator()<ResolvedMapType>(resolvedMap);
266 template<
typename TransformType,
typename OpType>
272 const Name mapType = transform.mapType();
273 if (mapType == UniformScaleMap::mapType()) {
274 doProcessTypedMap<UniformScaleMap, OpType>(transform, op);
276 }
else if (mapType == UniformScaleTranslateMap::mapType()) {
277 doProcessTypedMap<UniformScaleTranslateMap, OpType>(transform, op);
279 }
else if (mapType == ScaleMap::mapType()) {
280 doProcessTypedMap<ScaleMap, OpType>(transform, op);
282 }
else if (mapType == ScaleTranslateMap::mapType()) {
283 doProcessTypedMap<ScaleTranslateMap, OpType>(transform, op);
285 }
else if (mapType == UnitaryMap::mapType()) {
286 doProcessTypedMap<UnitaryMap, OpType>(transform, op);
288 }
else if (mapType == AffineMap::mapType()) {
289 doProcessTypedMap<AffineMap, OpType>(transform, op);
291 }
else if (mapType == TranslationMap::mapType()) {
292 doProcessTypedMap<TranslationMap, OpType>(transform, op);
294 }
else if (mapType == NonlinearFrustumMap::mapType()) {
295 doProcessTypedMap<NonlinearFrustumMap, OpType>(transform, op);
306 #endif // OPENVDB_MATH_TRANSFORM_HAS_BEEN_INCLUDED SharedPtr< const MapBase > ConstPtr
Definition: Maps.h:165
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:264
SharedPtr< MapBase > Ptr
Definition: Maps.h:164
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:685
OPENVDB_API std::ostream & operator<<(std::ostream &, const Transform &)
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:51
std::string Name
Definition: Name.h:44
OPENVDB_API void calculateBounds(const Transform &t, const Vec3d &minWS, const Vec3d &maxWS, Vec3d &minIS, Vec3d &maxIS)
Calculate an axis-aligned bounding box in index space from an axis-aligned bounding box in world spac...
std::shared_ptr< T > SharedPtr
Definition: Types.h:139
static Coord floor(const Vec3< T > &xyz)
Return the largest integer coordinates that are not greater than xyz (node centered conversion)...
Definition: Coord.h:83
void doProcessTypedMap(const Transform &transform, OpType &op)
Helper function used internally by processTypedMap()
Definition: Transform.h:241
Vec3< double > Vec3d
Definition: Vec3.h:679
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:136
Definition: Exceptions.h:40
Axis
Definition: Math.h:856
Abstract base class for maps.
Definition: Maps.h:161
static Coord round(const Vec3< T > &xyz)
Return xyz rounded to the closest integer coordinates (cell centered conversion). ...
Definition: Coord.h:77
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:488
bool processTypedMap(TransformType &transform, OpType &op)
Utility function that, given a generic map pointer, calls a functor on the fully-resoved map...
Definition: Transform.h:268
bool isIdentity(const MatType &m)
Determine if a matrix is an identity matrix.
Definition: Mat.h:892
MatType shear(Axis axis0, Axis axis1, typename MatType::value_type shear)
Set the matrix to a shear along axis0 by a fraction of axis1.
Definition: Mat.h:720
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:188
Vec3d asVec3d() const
Definition: Coord.h:170