4 #ifndef OPENVDB_MATH_TRANSFORM_HAS_BEEN_INCLUDED 5 #define OPENVDB_MATH_TRANSFORM_HAS_BEEN_INCLUDED 54 static Transform::Ptr createLinearTransform(
double voxelSize = 1.0);
57 double depth,
double voxelSize = 1.0);
61 bool isLinear()
const {
return mMap->isLinear(); }
75 void preRotate(
double radians,
const Axis axis =
X_AXIS);
76 void preTranslate(
const Vec3d&);
77 void preScale(
const Vec3d&);
78 void preScale(
double);
80 void preMult(
const Mat4d&);
81 void preMult(
const Mat3d&);
83 void postRotate(
double radians,
const Axis axis =
X_AXIS);
84 void postTranslate(
const Vec3d&);
85 void postScale(
const Vec3d&);
86 void postScale(
double);
87 void postShear(
double shear,
Axis axis0,
Axis axis1);
88 void postMult(
const Mat4d&);
89 void postMult(
const Mat3d&);
138 template<
typename MapType>
typename MapType::Ptr map();
139 template<
typename MapType>
typename MapType::ConstPtr map()
const;
140 template<
typename MapType>
typename MapType::ConstPtr constMap()
const;
144 void read(std::istream&);
146 void write(std::ostream&)
const;
151 void print(std::ostream& os = std::cout,
const std::string& indent =
"")
const;
167 template<
typename MapType>
168 inline typename MapType::Ptr
171 if (mMap->type() == MapType::mapType()) {
172 return StaticPtrCast<MapType>(mMap);
174 return typename MapType::Ptr();
178 template<
typename MapType>
179 inline typename MapType::ConstPtr
180 Transform::map()
const 182 return ConstPtrCast<const MapType>(
183 const_cast<Transform*
>(
this)->map<MapType>());
187 template<
typename MapType>
188 inline typename MapType::ConstPtr
189 Transform::constMap()
const 191 return map<MapType>();
199 template<
typename ResolvedMapType,
typename OpType>
203 ResolvedMapType& resolvedMap = *transform.
map<ResolvedMapType>();
204 op.template operator()<ResolvedMapType>(resolvedMap);
208 template<
typename ResolvedMapType,
typename OpType>
212 const ResolvedMapType& resolvedMap = *transform.
map<ResolvedMapType>();
213 op.template operator()<ResolvedMapType>(resolvedMap);
231 template<
typename TransformType,
typename OpType>
237 const Name mapType = transform.mapType();
238 if (mapType == UniformScaleMap::mapType()) {
239 doProcessTypedMap<UniformScaleMap, OpType>(transform, op);
241 }
else if (mapType == UniformScaleTranslateMap::mapType()) {
242 doProcessTypedMap<UniformScaleTranslateMap, OpType>(transform, op);
244 }
else if (mapType == ScaleMap::mapType()) {
245 doProcessTypedMap<ScaleMap, OpType>(transform, op);
247 }
else if (mapType == ScaleTranslateMap::mapType()) {
248 doProcessTypedMap<ScaleTranslateMap, OpType>(transform, op);
250 }
else if (mapType == UnitaryMap::mapType()) {
251 doProcessTypedMap<UnitaryMap, OpType>(transform, op);
253 }
else if (mapType == AffineMap::mapType()) {
254 doProcessTypedMap<AffineMap, OpType>(transform, op);
256 }
else if (mapType == TranslationMap::mapType()) {
257 doProcessTypedMap<TranslationMap, OpType>(transform, op);
259 }
else if (mapType == NonlinearFrustumMap::mapType()) {
260 doProcessTypedMap<NonlinearFrustumMap, OpType>(transform, op);
271 #endif // OPENVDB_MATH_TRANSFORM_HAS_BEEN_INCLUDED
void doProcessTypedMap(const Transform &transform, OpType &op)
Helper function used internally by processTypedMap()
Definition: Transform.h:210
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:250
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:24
Vec3d asVec3d() const
Definition: Coord.h:143
static fileSize_t write(std::ostream &os, const GridHandle< BufferT > &handle, Codec codec, uint32_t n)
std::shared_ptr< T > SharedPtr
Definition: Types.h:114
OPENVDB_AX_API void print(const ast::Node &node, const bool numberStatements=true, std::ostream &os=std::cout, const char *indent=" ")
Writes a descriptive printout of a Node hierarchy into a target stream.
SharedPtr< MapBase > Ptr
Definition: Maps.h:137
Vec3< double > Vec3d
Definition: Vec3.h:664
bool isIdentity(const MatType &m)
Determine if a matrix is an identity matrix.
Definition: Mat.h:860
SharedPtr< const MapBase > ConstPtr
Definition: Maps.h:138
OPENVDB_API std::ostream & operator<<(std::ostream &, const Transform &)
Axis
Definition: Math.h:901
Definition: Exceptions.h:13
std::string Name
Definition: Name.h:19
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:233
Abstract base class for maps.
Definition: Maps.h:134
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...
static void read(std::istream &is, BufferT &buffer, Codec codec)
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition: Maps.h:655
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:473
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:212
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