Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright Contributors to the OpenVDB Project | ||
2 | // SPDX-License-Identifier: MPL-2.0 | ||
3 | |||
4 | #ifndef OPENVDB_MATH_TRANSFORM_HAS_BEEN_INCLUDED | ||
5 | #define OPENVDB_MATH_TRANSFORM_HAS_BEEN_INCLUDED | ||
6 | |||
7 | #include "Maps.h" | ||
8 | #include <openvdb/Types.h> | ||
9 | #include <iosfwd> | ||
10 | |||
11 | namespace openvdb { | ||
12 | OPENVDB_USE_VERSION_NAMESPACE | ||
13 | namespace OPENVDB_VERSION_NAME { | ||
14 | namespace math { | ||
15 | |||
16 | // Forward declaration | ||
17 | class Transform; | ||
18 | |||
19 | |||
20 | // Utility methods | ||
21 | |||
22 | /// @brief Calculate an axis-aligned bounding box in index space from an | ||
23 | /// axis-aligned bounding box in world space. | ||
24 | /// @see Transform::worldToIndex(const BBoxd&) const | ||
25 | OPENVDB_API void | ||
26 | calculateBounds(const Transform& t, const Vec3d& minWS, const Vec3d& maxWS, | ||
27 | Vec3d& minIS, Vec3d& maxIS); | ||
28 | |||
29 | /// @todo Calculate an axis-aligned bounding box in index space from a | ||
30 | /// bounding sphere in world space. | ||
31 | //void calculateBounds(const Transform& t, const Vec3d& center, const Real radius, | ||
32 | // Vec3d& minIS, Vec3d& maxIS); | ||
33 | |||
34 | |||
35 | //////////////////////////////////////// | ||
36 | |||
37 | |||
38 | /// @class Transform | ||
39 | class OPENVDB_API Transform | ||
40 | { | ||
41 | public: | ||
42 | using Ptr = SharedPtr<Transform>; | ||
43 | using ConstPtr = SharedPtr<const Transform>; | ||
44 | |||
45 | 4 | Transform(): mMap(MapBase::Ptr(new ScaleMap())) {} | |
46 | Transform(const MapBase::Ptr&); | ||
47 | Transform(const Transform&); | ||
48 |
3/9✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 11 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
|
53506 | ~Transform() {} |
49 | |||
50 |
2/4✓ Branch 2 taken 27554 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 27554 times.
✗ Branch 6 not taken.
|
55108 | Ptr copy() const { return Ptr(new Transform(mMap->copy())); } |
51 | |||
52 | //@{ | ||
53 | /// @brief Create and return a shared pointer to a new transform. | ||
54 | static Transform::Ptr createLinearTransform(double voxelSize = 1.0); | ||
55 | static Transform::Ptr createLinearTransform(const Mat4R&); | ||
56 | static Transform::Ptr createFrustumTransform(const BBoxd&, double taper, | ||
57 | double depth, double voxelSize = 1.0); | ||
58 | //@} | ||
59 | |||
60 | /// Return @c true if the transformation map is exclusively linear/affine. | ||
61 |
1/32✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✓ Branch 57 taken 4 times.
✗ Branch 58 not taken.
|
23330 | bool isLinear() const { return mMap->isLinear(); } |
62 | |||
63 | /// Return @c true if the transform is equivalent to an idenity. | ||
64 | bool isIdentity() const ; | ||
65 | /// Return the transformation map's type-name | ||
66 |
5/241✓ Branch 1 taken 33 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 6251 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✗ Branch 151 not taken.
✗ Branch 152 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 157 not taken.
✗ Branch 158 not taken.
✗ Branch 160 not taken.
✗ Branch 161 not taken.
✗ Branch 163 not taken.
✗ Branch 164 not taken.
✗ Branch 166 not taken.
✗ Branch 167 not taken.
✗ Branch 169 not taken.
✗ Branch 170 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✗ Branch 178 not taken.
✗ Branch 179 not taken.
✗ Branch 181 not taken.
✗ Branch 182 not taken.
✗ Branch 184 not taken.
✗ Branch 185 not taken.
✗ Branch 187 not taken.
✗ Branch 188 not taken.
✗ Branch 190 not taken.
✗ Branch 191 not taken.
✗ Branch 193 not taken.
✗ Branch 194 not taken.
✗ Branch 196 not taken.
✗ Branch 197 not taken.
✗ Branch 199 not taken.
✗ Branch 200 not taken.
✗ Branch 202 not taken.
✗ Branch 203 not taken.
✗ Branch 205 not taken.
✗ Branch 206 not taken.
✗ Branch 208 not taken.
✗ Branch 209 not taken.
✗ Branch 211 not taken.
✗ Branch 212 not taken.
✗ Branch 214 not taken.
✗ Branch 215 not taken.
✗ Branch 217 not taken.
✗ Branch 218 not taken.
✗ Branch 220 not taken.
✗ Branch 221 not taken.
✗ Branch 223 not taken.
✗ Branch 224 not taken.
✗ Branch 226 not taken.
✗ Branch 227 not taken.
✗ Branch 229 not taken.
✗ Branch 230 not taken.
✗ Branch 232 not taken.
✗ Branch 233 not taken.
✗ Branch 235 not taken.
✗ Branch 236 not taken.
✗ Branch 238 not taken.
✗ Branch 239 not taken.
✗ Branch 241 not taken.
✗ Branch 242 not taken.
✗ Branch 244 not taken.
✗ Branch 245 not taken.
✗ Branch 247 not taken.
✗ Branch 248 not taken.
✗ Branch 250 not taken.
✗ Branch 251 not taken.
✗ Branch 253 not taken.
✗ Branch 254 not taken.
✗ Branch 256 not taken.
✗ Branch 257 not taken.
✗ Branch 259 not taken.
✗ Branch 260 not taken.
✗ Branch 262 not taken.
✗ Branch 263 not taken.
✗ Branch 265 not taken.
✗ Branch 266 not taken.
✗ Branch 268 not taken.
✗ Branch 269 not taken.
✗ Branch 271 not taken.
✗ Branch 272 not taken.
✗ Branch 274 not taken.
✗ Branch 275 not taken.
✗ Branch 277 not taken.
✗ Branch 278 not taken.
✗ Branch 280 not taken.
✗ Branch 281 not taken.
✗ Branch 283 not taken.
✗ Branch 284 not taken.
✗ Branch 286 not taken.
✗ Branch 287 not taken.
✗ Branch 289 not taken.
✗ Branch 290 not taken.
✗ Branch 292 not taken.
✗ Branch 293 not taken.
✗ Branch 295 not taken.
✗ Branch 296 not taken.
✗ Branch 298 not taken.
✗ Branch 299 not taken.
✗ Branch 301 not taken.
✗ Branch 302 not taken.
✗ Branch 304 not taken.
✗ Branch 305 not taken.
✗ Branch 307 not taken.
✗ Branch 308 not taken.
✗ Branch 310 not taken.
✗ Branch 311 not taken.
✗ Branch 313 not taken.
✗ Branch 314 not taken.
✗ Branch 316 not taken.
✗ Branch 317 not taken.
✗ Branch 319 not taken.
✗ Branch 320 not taken.
✗ Branch 322 not taken.
✗ Branch 323 not taken.
✗ Branch 325 not taken.
✗ Branch 326 not taken.
✗ Branch 328 not taken.
✗ Branch 329 not taken.
✗ Branch 331 not taken.
✗ Branch 332 not taken.
✗ Branch 334 not taken.
✗ Branch 335 not taken.
✗ Branch 337 not taken.
✗ Branch 338 not taken.
✗ Branch 340 not taken.
✗ Branch 341 not taken.
✗ Branch 343 not taken.
✗ Branch 344 not taken.
✗ Branch 346 not taken.
✗ Branch 347 not taken.
✗ Branch 349 not taken.
✗ Branch 350 not taken.
✗ Branch 352 not taken.
✗ Branch 353 not taken.
✗ Branch 355 not taken.
✗ Branch 356 not taken.
✗ Branch 358 not taken.
✗ Branch 359 not taken.
|
6326 | Name mapType() const { return mMap->type(); } |
67 | |||
68 | |||
69 | //@{ | ||
70 | /// @brief Update the linear (affine) map by prepending or | ||
71 | /// postfixing the appropriate operation. In the case of | ||
72 | /// a frustum, the pre-operations apply to the linear part | ||
73 | /// of the transform and not the entire transform, while the | ||
74 | /// post-operations are allways applied last. | ||
75 | void preRotate(double radians, const Axis axis = X_AXIS); | ||
76 | void preTranslate(const Vec3d&); | ||
77 | void preScale(const Vec3d&); | ||
78 | void preScale(double); | ||
79 | void preShear(double shear, Axis axis0, Axis axis1); | ||
80 | void preMult(const Mat4d&); | ||
81 | void preMult(const Mat3d&); | ||
82 | |||
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&); | ||
90 | //@} | ||
91 | |||
92 | /// Return the size of a voxel using the linear component of the map. | ||
93 |
47/129✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 92 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 68 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 622 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 129 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 9 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 5 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 5 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 8361 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 10 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 2 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 14919 times.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✓ Branch 46 taken 16 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 57 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 57 times.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 70 not taken.
✓ Branch 71 taken 1 times.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✓ Branch 74 taken 1 times.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✓ Branch 77 taken 2 times.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✓ Branch 80 taken 1 times.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✓ Branch 83 taken 1 times.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✓ Branch 86 taken 2 times.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✓ Branch 89 taken 1 times.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✓ Branch 92 taken 1 times.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✓ Branch 95 taken 1 times.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✓ Branch 98 taken 1 times.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✓ Branch 101 taken 1 times.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✓ Branch 104 taken 1 times.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✓ Branch 107 taken 1 times.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✓ Branch 110 taken 1 times.
✗ Branch 111 not taken.
✗ Branch 112 not taken.
✓ Branch 113 taken 1 times.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✓ Branch 119 taken 1 times.
✗ Branch 120 not taken.
✗ Branch 121 not taken.
✓ Branch 122 taken 297538 times.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✓ Branch 125 taken 1 times.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
✓ Branch 128 taken 1 times.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✓ Branch 131 taken 1 times.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✓ Branch 134 taken 1 times.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✓ Branch 137 taken 82518 times.
✗ Branch 138 not taken.
✓ Branch 140 taken 1 times.
✗ Branch 141 not taken.
✓ Branch 143 taken 1 times.
✗ Branch 144 not taken.
✓ Branch 146 taken 1 times.
✗ Branch 147 not taken.
✓ Branch 149 taken 311212 times.
✗ Branch 150 not taken.
✓ Branch 152 taken 1 times.
✗ Branch 153 not taken.
|
723190 | Vec3d voxelSize() const { return mMap->voxelSize(); } |
94 | /// @brief Return the size of a voxel at position (x, y, z). | ||
95 | /// @note Maps that have a nonlinear component (e.g., perspective and frustum maps) | ||
96 | /// have position-dependent voxel sizes. | ||
97 |
7/14✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
|
1623582 | Vec3d voxelSize(const Vec3d& xyz) const { return mMap->voxelSize(xyz); } |
98 | |||
99 | /// Return the voxel volume of the linear component of the map. | ||
100 | 11 | double voxelVolume() const { return mMap->determinant(); } | |
101 | /// Return the voxel volume at position (x, y, z). | ||
102 | double voxelVolume(const Vec3d& xyz) const { return mMap->determinant(xyz); } | ||
103 | /// Return true if the voxels in world space are uniformly sized cubes | ||
104 |
4/9✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
|
808 | bool hasUniformScale() const { return mMap->hasUniformScale(); } |
105 | |||
106 | //@{ | ||
107 | /// @brief Apply this transformation to the given coordinates. | ||
108 |
53/214✓ Branch 1 taken 311108 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 429480 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 384401 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8005 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 31 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 6 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 9 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 6 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 15 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1654104 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 3 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 8 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 7 times.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✓ Branch 43 taken 5 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 5 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 8 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 6 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 15 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 1654104 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 5000 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 4 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 1 times.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✓ Branch 70 taken 4 times.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✓ Branch 73 taken 8 times.
✗ Branch 74 not taken.
✓ Branch 75 taken 6 times.
✓ Branch 76 taken 10004 times.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✓ Branch 79 taken 10000 times.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✓ Branch 82 taken 53 times.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✓ Branch 100 taken 3837100 times.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✓ Branch 103 taken 3 times.
✗ Branch 104 not taken.
✓ Branch 105 taken 3 times.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 111 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✓ Branch 120 taken 12068736 times.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✓ Branch 135 taken 2164701 times.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✓ Branch 138 taken 17676957 times.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✗ Branch 151 not taken.
✗ Branch 152 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 157 not taken.
✗ Branch 158 not taken.
✗ Branch 160 not taken.
✗ Branch 161 not taken.
✗ Branch 163 not taken.
✗ Branch 164 not taken.
✗ Branch 166 not taken.
✗ Branch 167 not taken.
✗ Branch 169 not taken.
✗ Branch 170 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✓ Branch 175 taken 4 times.
✗ Branch 176 not taken.
✓ Branch 178 taken 4 times.
✗ Branch 179 not taken.
✗ Branch 181 not taken.
✗ Branch 182 not taken.
✗ Branch 184 not taken.
✗ Branch 185 not taken.
✗ Branch 187 not taken.
✗ Branch 188 not taken.
✗ Branch 190 not taken.
✗ Branch 191 not taken.
✗ Branch 193 not taken.
✗ Branch 194 not taken.
✗ Branch 196 not taken.
✗ Branch 197 not taken.
✗ Branch 199 not taken.
✗ Branch 200 not taken.
✓ Branch 202 taken 3837100 times.
✗ Branch 203 not taken.
✓ Branch 205 taken 3 times.
✗ Branch 206 not taken.
✗ Branch 208 not taken.
✗ Branch 209 not taken.
✗ Branch 211 not taken.
✗ Branch 212 not taken.
✗ Branch 214 not taken.
✗ Branch 215 not taken.
✗ Branch 217 not taken.
✗ Branch 218 not taken.
✗ Branch 220 not taken.
✗ Branch 221 not taken.
✗ Branch 223 not taken.
✗ Branch 224 not taken.
✗ Branch 226 not taken.
✗ Branch 227 not taken.
✓ Branch 229 taken 3827080 times.
✗ Branch 230 not taken.
✓ Branch 232 taken 4 times.
✗ Branch 233 not taken.
✓ Branch 235 taken 4 times.
✗ Branch 236 not taken.
✓ Branch 238 taken 4 times.
✗ Branch 239 not taken.
✗ Branch 241 not taken.
✗ Branch 242 not taken.
✗ Branch 244 not taken.
✗ Branch 245 not taken.
✗ Branch 247 not taken.
✗ Branch 248 not taken.
✗ Branch 250 not taken.
✗ Branch 251 not taken.
✓ Branch 253 taken 1520875 times.
✗ Branch 254 not taken.
✓ Branch 256 taken 1913536 times.
✗ Branch 257 not taken.
✓ Branch 259 taken 1913536 times.
✗ Branch 260 not taken.
✓ Branch 262 taken 1913536 times.
✗ Branch 263 not taken.
✓ Branch 265 taken 20 times.
✗ Branch 266 not taken.
✓ Branch 268 taken 4 times.
✗ Branch 269 not taken.
✓ Branch 271 taken 4 times.
✗ Branch 272 not taken.
✓ Branch 274 taken 1 times.
✗ Branch 275 not taken.
✓ Branch 277 taken 3 times.
✗ Branch 278 not taken.
✓ Branch 280 taken 4 times.
✗ Branch 281 not taken.
✓ Branch 283 taken 3 times.
✗ Branch 284 not taken.
|
2551772982 | Vec3d indexToWorld(const Vec3d& xyz) const { return mMap->applyMap(xyz); } |
109 |
48/147✓ Branch 1 taken 25421686 times.
✓ Branch 2 taken 2097664 times.
✓ Branch 3 taken 11857408 times.
✓ Branch 4 taken 913676 times.
✓ Branch 5 taken 12650752 times.
✓ Branch 6 taken 8296 times.
✓ Branch 7 taken 1071 times.
✓ Branch 8 taken 1298668 times.
✓ Branch 9 taken 2074 times.
✓ Branch 10 taken 263064 times.
✓ Branch 11 taken 1032376 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 2076 times.
✓ Branch 15 taken 262144 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 264668 times.
✓ Branch 18 taken 1 times.
✓ Branch 19 taken 652967 times.
✓ Branch 20 taken 1785 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 915111 times.
✓ Branch 23 taken 2922 times.
✓ Branch 24 taken 262144 times.
✓ Branch 25 taken 1635452 times.
✓ Branch 26 taken 2921 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 1635452 times.
✓ Branch 29 taken 265065 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 262144 times.
✓ Branch 32 taken 2921 times.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✓ Branch 35 taken 1454 times.
✓ Branch 36 taken 262144 times.
✗ Branch 37 not taken.
✓ Branch 38 taken 559682 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✓ Branch 41 taken 485 times.
✗ Branch 42 not taken.
✓ Branch 43 taken 262144 times.
✓ Branch 44 taken 485 times.
✓ Branch 45 taken 262144 times.
✗ Branch 46 not taken.
✓ Branch 47 taken 739 times.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✓ Branch 50 taken 739 times.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✓ Branch 53 taken 5005 times.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✓ Branch 56 taken 5005 times.
✓ Branch 57 taken 110592 times.
✗ Branch 58 not taken.
✓ Branch 59 taken 172940 times.
✓ Branch 60 taken 20170 times.
✗ Branch 61 not taken.
✓ Branch 62 taken 193110 times.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✓ Branch 65 taken 111077 times.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✓ Branch 68 taken 111077 times.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✓ Branch 71 taken 114472 times.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✓ Branch 74 taken 302110 times.
✗ Branch 75 not taken.
✓ Branch 76 taken 8831 times.
✓ Branch 77 taken 597293 times.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✓ Branch 80 taken 1940 times.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✗ Branch 151 not taken.
✗ Branch 152 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 157 not taken.
✗ Branch 158 not taken.
✗ Branch 160 not taken.
✗ Branch 161 not taken.
✗ Branch 163 not taken.
✗ Branch 164 not taken.
✗ Branch 166 not taken.
✗ Branch 167 not taken.
✗ Branch 169 not taken.
✗ Branch 170 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✗ Branch 178 not taken.
✗ Branch 179 not taken.
|
4323195340 | Vec3d indexToWorld(const Coord& ijk) const { return mMap->applyMap(ijk.asVec3d()); } |
110 |
28/285✓ Branch 1 taken 95120 times.
✓ Branch 2 taken 582232 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 40013 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1388032 times.
✓ Branch 11 taken 652967 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 5 times.
✓ Branch 14 taken 1635452 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 2 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 9 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 7 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 16 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 1654105 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✓ Branch 37 taken 2 times.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✓ Branch 52 taken 4 times.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✓ Branch 73 taken 4 times.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✓ Branch 76 taken 4 times.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✓ Branch 91 taken 12 times.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✓ Branch 100 taken 3837100 times.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✗ Branch 151 not taken.
✗ Branch 152 not taken.
✗ Branch 154 not taken.
✗ Branch 155 not taken.
✗ Branch 157 not taken.
✗ Branch 158 not taken.
✗ Branch 160 not taken.
✗ Branch 161 not taken.
✗ Branch 163 not taken.
✗ Branch 164 not taken.
✗ Branch 166 not taken.
✗ Branch 167 not taken.
✗ Branch 169 not taken.
✗ Branch 170 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✗ Branch 178 not taken.
✗ Branch 179 not taken.
✗ Branch 181 not taken.
✗ Branch 182 not taken.
✗ Branch 184 not taken.
✗ Branch 185 not taken.
✗ Branch 187 not taken.
✗ Branch 188 not taken.
✗ Branch 190 not taken.
✗ Branch 191 not taken.
✗ Branch 193 not taken.
✗ Branch 194 not taken.
✗ Branch 196 not taken.
✗ Branch 197 not taken.
✗ Branch 199 not taken.
✗ Branch 200 not taken.
✗ Branch 202 not taken.
✗ Branch 203 not taken.
✗ Branch 205 not taken.
✗ Branch 206 not taken.
✗ Branch 208 not taken.
✗ Branch 209 not taken.
✗ Branch 211 not taken.
✗ Branch 212 not taken.
✗ Branch 214 not taken.
✗ Branch 215 not taken.
✗ Branch 217 not taken.
✗ Branch 218 not taken.
✗ Branch 220 not taken.
✗ Branch 221 not taken.
✗ Branch 223 not taken.
✗ Branch 224 not taken.
✓ Branch 226 taken 6 times.
✗ Branch 227 not taken.
✗ Branch 229 not taken.
✗ Branch 230 not taken.
✗ Branch 232 not taken.
✗ Branch 233 not taken.
✗ Branch 235 not taken.
✗ Branch 236 not taken.
✗ Branch 238 not taken.
✗ Branch 239 not taken.
✗ Branch 241 not taken.
✗ Branch 242 not taken.
✗ Branch 244 not taken.
✗ Branch 245 not taken.
✗ Branch 247 not taken.
✗ Branch 248 not taken.
✗ Branch 250 not taken.
✗ Branch 251 not taken.
✗ Branch 253 not taken.
✗ Branch 254 not taken.
✗ Branch 256 not taken.
✗ Branch 257 not taken.
✗ Branch 259 not taken.
✗ Branch 260 not taken.
✗ Branch 262 not taken.
✗ Branch 263 not taken.
✗ Branch 265 not taken.
✗ Branch 266 not taken.
✗ Branch 268 not taken.
✗ Branch 269 not taken.
✗ Branch 271 not taken.
✗ Branch 272 not taken.
✗ Branch 274 not taken.
✗ Branch 275 not taken.
✗ Branch 277 not taken.
✗ Branch 278 not taken.
✗ Branch 280 not taken.
✗ Branch 281 not taken.
✗ Branch 283 not taken.
✗ Branch 284 not taken.
✗ Branch 286 not taken.
✗ Branch 287 not taken.
✗ Branch 289 not taken.
✗ Branch 290 not taken.
✗ Branch 292 not taken.
✗ Branch 293 not taken.
✓ Branch 295 taken 12068736 times.
✗ Branch 296 not taken.
✗ Branch 298 not taken.
✗ Branch 299 not taken.
✗ Branch 301 not taken.
✗ Branch 302 not taken.
✗ Branch 304 not taken.
✗ Branch 305 not taken.
✗ Branch 307 not taken.
✗ Branch 308 not taken.
✗ Branch 310 not taken.
✗ Branch 311 not taken.
✗ Branch 313 not taken.
✗ Branch 314 not taken.
✗ Branch 316 not taken.
✗ Branch 317 not taken.
✗ Branch 319 not taken.
✗ Branch 320 not taken.
✗ Branch 322 not taken.
✗ Branch 323 not taken.
✗ Branch 325 not taken.
✗ Branch 326 not taken.
✗ Branch 328 not taken.
✗ Branch 329 not taken.
✗ Branch 331 not taken.
✗ Branch 332 not taken.
✗ Branch 334 not taken.
✗ Branch 335 not taken.
✗ Branch 337 not taken.
✗ Branch 338 not taken.
✗ Branch 340 not taken.
✗ Branch 341 not taken.
✗ Branch 343 not taken.
✗ Branch 344 not taken.
✗ Branch 346 not taken.
✗ Branch 347 not taken.
✗ Branch 349 not taken.
✗ Branch 350 not taken.
✗ Branch 352 not taken.
✗ Branch 353 not taken.
✗ Branch 355 not taken.
✗ Branch 356 not taken.
✓ Branch 358 taken 17 times.
✗ Branch 359 not taken.
✓ Branch 361 taken 8658730 times.
✗ Branch 362 not taken.
✓ Branch 364 taken 6494016 times.
✗ Branch 365 not taken.
✓ Branch 367 taken 6494016 times.
✗ Branch 368 not taken.
✓ Branch 370 taken 6494016 times.
✗ Branch 371 not taken.
✓ Branch 373 taken 6494016 times.
✗ Branch 374 not taken.
✓ Branch 376 taken 17676957 times.
✗ Branch 377 not taken.
✗ Branch 379 not taken.
✗ Branch 380 not taken.
|
4595229652 | Vec3d worldToIndex(const Vec3d& xyz) const { return mMap->applyInverseMap(xyz); } |
111 | 4361321667 | Coord worldToIndexCellCentered(const Vec3d& xyz) const {return Coord::round(worldToIndex(xyz));} | |
112 | 15 | Coord worldToIndexNodeCentered(const Vec3d& xyz) const {return Coord::floor(worldToIndex(xyz));} | |
113 | //@} | ||
114 | |||
115 | //@{ | ||
116 | /// @brief Apply this transformation to the given index-space bounding box. | ||
117 | /// @return an axis-aligned world-space bounding box | ||
118 | BBoxd indexToWorld(const CoordBBox&) const; | ||
119 | BBoxd indexToWorld(const BBoxd&) const; | ||
120 | //@} | ||
121 | //@{ | ||
122 | /// @brief Apply the inverse of this transformation to the given world-space bounding box. | ||
123 | /// @return an axis-aligned index-space bounding box | ||
124 | BBoxd worldToIndex(const BBoxd&) const; | ||
125 | CoordBBox worldToIndexCellCentered(const BBoxd&) const; | ||
126 | CoordBBox worldToIndexNodeCentered(const BBoxd&) const; | ||
127 | //@} | ||
128 | |||
129 | //@{ | ||
130 | /// Return a base pointer to the transformation map. | ||
131 | MapBase::ConstPtr baseMap() const { return mMap; } | ||
132 | MapBase::Ptr baseMap() { return mMap; } | ||
133 | //@} | ||
134 | |||
135 | //@{ | ||
136 | /// @brief Return the result of downcasting the base map pointer to a | ||
137 | /// @c MapType pointer, or return a null pointer if the types are incompatible. | ||
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; | ||
141 | //@} | ||
142 | |||
143 | /// Unserialize this transform from the given stream. | ||
144 | void read(std::istream&); | ||
145 | /// Serialize this transform to the given stream. | ||
146 | void write(std::ostream&) const; | ||
147 | |||
148 | /// @brief Print a description of this transform. | ||
149 | /// @param os a stream to which to write textual information | ||
150 | /// @param indent a string with which to prefix each line of text | ||
151 | void print(std::ostream& os = std::cout, const std::string& indent = "") const; | ||
152 | |||
153 | bool operator==(const Transform& other) const; | ||
154 |
8/14✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
|
261 | inline bool operator!=(const Transform& other) const { return !(*this == other); } |
155 | |||
156 | private: | ||
157 | MapBase::Ptr mMap; | ||
158 | }; // class Transform | ||
159 | |||
160 | |||
161 | OPENVDB_API std::ostream& operator<<(std::ostream&, const Transform&); | ||
162 | |||
163 | |||
164 | //////////////////////////////////////// | ||
165 | |||
166 | |||
167 | template<typename MapType> | ||
168 | inline typename MapType::Ptr | ||
169 | 166 | Transform::map() | |
170 | { | ||
171 |
3/4✓ Branch 1 taken 89 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 84 times.
✓ Branch 6 taken 5 times.
|
166 | if (mMap->type() == MapType::mapType()) { |
172 | 161 | return StaticPtrCast<MapType>(mMap); | |
173 | } | ||
174 | return typename MapType::Ptr(); | ||
175 | } | ||
176 | |||
177 | |||
178 | template<typename MapType> | ||
179 | inline typename MapType::ConstPtr | ||
180 | 162 | Transform::map() const | |
181 | { | ||
182 | return ConstPtrCast<const MapType>( | ||
183 | 162 | const_cast<Transform*>(this)->map<MapType>()); | |
184 | } | ||
185 | |||
186 | |||
187 | template<typename MapType> | ||
188 | inline typename MapType::ConstPtr | ||
189 | Transform::constMap() const | ||
190 | { | ||
191 |
4/8✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
|
43 | return map<MapType>(); |
192 | } | ||
193 | |||
194 | |||
195 | //////////////////////////////////////// | ||
196 | |||
197 | |||
198 | /// Helper function used internally by processTypedMap() | ||
199 | template<typename ResolvedMapType, typename OpType> | ||
200 | inline void | ||
201 | doProcessTypedMap(Transform& transform, OpType& op) | ||
202 | { | ||
203 | ResolvedMapType& resolvedMap = *transform.map<ResolvedMapType>(); | ||
204 | op.template operator()<ResolvedMapType>(resolvedMap); | ||
205 | } | ||
206 | |||
207 | /// Helper function used internally by processTypedMap() | ||
208 | template<typename ResolvedMapType, typename OpType> | ||
209 | inline void | ||
210 | 82 | doProcessTypedMap(const Transform& transform, OpType& op) | |
211 | { | ||
212 | 82 | const ResolvedMapType& resolvedMap = *transform.map<ResolvedMapType>(); | |
213 | 82 | op.template operator()<ResolvedMapType>(resolvedMap); | |
214 | } | ||
215 | |||
216 | |||
217 | /// @brief Utility function that, given a generic map pointer, | ||
218 | /// calls a functor on the fully-resoved map | ||
219 | /// | ||
220 | /// Usage: | ||
221 | /// @code | ||
222 | /// struct Foo { | ||
223 | /// template<typename MapT> | ||
224 | /// void operator()(const MapT& map) const { blah } | ||
225 | /// }; | ||
226 | /// | ||
227 | /// processTypedMap(myMap, Foo()); | ||
228 | /// @endcode | ||
229 | /// | ||
230 | /// @return @c false if the grid type is unknown or unhandled. | ||
231 | template<typename TransformType, typename OpType> | ||
232 | bool | ||
233 | 41 | processTypedMap(TransformType& transform, OpType& op) | |
234 | { | ||
235 | using namespace openvdb; | ||
236 | |||
237 | const Name mapType = transform.mapType(); | ||
238 |
0/2✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
41 | if (mapType == UniformScaleMap::mapType()) { |
239 |
0/2✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
41 | doProcessTypedMap<UniformScaleMap, OpType>(transform, op); |
240 | |||
241 | ✗ | } else if (mapType == UniformScaleTranslateMap::mapType()) { | |
242 | ✗ | doProcessTypedMap<UniformScaleTranslateMap, OpType>(transform, op); | |
243 | |||
244 | ✗ | } else if (mapType == ScaleMap::mapType()) { | |
245 | ✗ | doProcessTypedMap<ScaleMap, OpType>(transform, op); | |
246 | |||
247 | ✗ | } else if (mapType == ScaleTranslateMap::mapType()) { | |
248 | ✗ | doProcessTypedMap<ScaleTranslateMap, OpType>(transform, op); | |
249 | |||
250 | ✗ | } else if (mapType == UnitaryMap::mapType()) { | |
251 | ✗ | doProcessTypedMap<UnitaryMap, OpType>(transform, op); | |
252 | |||
253 | ✗ | } else if (mapType == AffineMap::mapType()) { | |
254 | ✗ | doProcessTypedMap<AffineMap, OpType>(transform, op); | |
255 | |||
256 | ✗ | } else if (mapType == TranslationMap::mapType()) { | |
257 | ✗ | doProcessTypedMap<TranslationMap, OpType>(transform, op); | |
258 | |||
259 | ✗ | } else if (mapType == NonlinearFrustumMap::mapType()) { | |
260 | ✗ | doProcessTypedMap<NonlinearFrustumMap, OpType>(transform, op); | |
261 | } else { | ||
262 | return false; | ||
263 | } | ||
264 | return true; | ||
265 | } | ||
266 | |||
267 | } // namespace math | ||
268 | } // namespace OPENVDB_VERSION_NAME | ||
269 | } // namespace openvdb | ||
270 | |||
271 | #endif // OPENVDB_MATH_TRANSFORM_HAS_BEEN_INCLUDED | ||
272 |