OpenVDB: Coord.h Source File

OpenVDB 3.1.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

Coord.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2015 DreamWorks Animation LLC
4 //
5 // All rights reserved. This software is distributed under the
6 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
7 //
8 // Redistributions of source code must retain the above copyright
9 // and license notice and the following restrictions and disclaimer.
10 //
11 // * Neither the name of DreamWorks Animation nor the names of
12 // its contributors may be used to endorse or promote products derived
13 // from this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 // IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
27 // LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
28 //
30
31 #ifndef OPENVDB_MATH_COORD_HAS_BEEN_INCLUDED
32 #define OPENVDB_MATH_COORD_HAS_BEEN_INCLUDED
33
34 #include <openvdb/Platform.h>
35 #include "Math.h"
36 #include "Vec3.h"
37
38 namespace tbb { class split; } // forward declaration
39
40
41 namespace openvdb {
42 OPENVDB_USE_VERSION_NAMESPACE
43 namespace OPENVDB_VERSION_NAME {
44 namespace math {
45
47 class Coord
48 {
49 public:
50 typedef int32_t Int32;
51 typedef uint32_t Index32;
52 typedef Vec3<Int32> Vec3i;
53 typedef Vec3<Index32> Vec3I;
54
55 typedef Int32 ValueType;
56 typedef std::numeric_limits<ValueType> Limits;
57
58 Coord() { mVec[0] = mVec[1] = mVec[2] = 0; }
59 explicit Coord(Int32 xyz) { mVec[0] = mVec[1] = mVec[2] = xyz; }
60 Coord(Int32 x, Int32 y, Int32 z) { mVec[0] = x; mVec[1] = y; mVec[2] = z; }
61 explicit Coord(const Vec3i& v) { mVec[0] = v[0]; mVec[1] = v[1]; mVec[2] = v[2]; }
62 explicit Coord(const Vec3I& v)
63 {
64 mVec[0] = Int32(v[0]); mVec[1] = Int32(v[1]); mVec[2] = Int32(v[2]);
65 }
66 explicit Coord(const Int32* v) { mVec[0] = v[0]; mVec[1] = v[1]; mVec[2] = v[2]; }
67
69 static Coord min() { return Coord(Limits::min()); }
70
72 static Coord max() { return Coord(Limits::max()); }
73
76 template<typename T> static Coord round(const Vec3<T>& xyz)
77 {
78 return Coord(Int32(Round(xyz[0])), Int32(Round(xyz[1])), Int32(Round(xyz[2])));
79 }
82 template<typename T> static Coord floor(const Vec3<T>& xyz)
83 {
84 return Coord(Int32(Floor(xyz[0])), Int32(Floor(xyz[1])), Int32(Floor(xyz[2])));
85 }
86
89 template<typename T> static Coord ceil(const Vec3<T>& xyz)
90 {
91 return Coord(Int32(Ceil(xyz[0])), Int32(Ceil(xyz[1])), Int32(Ceil(xyz[2])));
92 }
93
94 Coord& reset(Int32 x, Int32 y, Int32 z)
95 {
96 mVec[0] = x; mVec[1] = y; mVec[2] = z;
97 return *this;
98 }
99 Coord& reset(Int32 xyz) { return this->reset(xyz, xyz, xyz); }
100
101 Coord& setX(Int32 x) { mVec[0] = x; return *this; }
102 Coord& setY(Int32 y) { mVec[1] = y; return *this; }
103 Coord& setZ(Int32 z) { mVec[2] = z; return *this; }
104
105 Coord& offset(Int32 dx, Int32 dy, Int32 dz)
106 {
107 mVec[0]+=dx; mVec[1]+=dy; mVec[2]+=dz;
108 return *this;
109 }
110 Coord& offset(Int32 n) { return this->offset(n, n, n); }
111 Coord offsetBy(Int32 dx, Int32 dy, Int32 dz) const
112 {
113 return Coord(mVec[0] + dx, mVec[1] + dy, mVec[2] + dz);
114 }
115 Coord offsetBy(Int32 n) const { return offsetBy(n, n, n); }
116
117 Coord& operator+=(const Coord& rhs)
118 {
119 mVec[0] += rhs[0]; mVec[1] += rhs[1]; mVec[2] += rhs[2];
120 return *this;
121 }
122 Coord& operator-=(const Coord& rhs)
123 {
124 mVec[0] -= rhs[0]; mVec[1] -= rhs[1]; mVec[2] -= rhs[2];
125 return *this;
126 }
127 Coord operator+(const Coord& rhs) const
128 {
129 return Coord(mVec[0] + rhs[0], mVec[1] + rhs[1], mVec[2] + rhs[2]);
130 }
131 Coord operator-(const Coord& rhs) const
132 {
133 return Coord(mVec[0] - rhs[0], mVec[1] - rhs[1], mVec[2] - rhs[2]);
134 }
135 Coord operator-() const { return Coord(-mVec[0], -mVec[1], -mVec[2]); }
136
137 Coord operator>> (size_t n) const { return Coord(mVec[0]>>n, mVec[1]>>n, mVec[2]>>n); }
138 Coord operator<< (size_t n) const { return Coord(mVec[0]<<n, mVec[1]<<n, mVec[2]<<n); }
139 Coord& operator<<=(size_t n) { mVec[0]<<=n; mVec[1]<<=n; mVec[2]<<=n; return *this; }
140 Coord& operator>>=(size_t n) { mVec[0]>>=n; mVec[1]>>=n; mVec[2]>>=n; return *this; }
141 Coord operator& (Int32 n) const { return Coord(mVec[0] & n, mVec[1] & n, mVec[2] & n); }
142 Coord operator| (Int32 n) const { return Coord(mVec[0] | n, mVec[1] | n, mVec[2] | n); }
143 Coord& operator&= (Int32 n) { mVec[0]&=n; mVec[1]&=n; mVec[2]&=n; return *this; }
144 Coord& operator|= (Int32 n) { mVec[0]|=n; mVec[1]|=n; mVec[2]|=n; return *this; }
145
146 Int32 x() const { return mVec[0]; }
147 Int32 y() const { return mVec[1]; }
148 Int32 z() const { return mVec[2]; }
149 Int32 operator[](size_t i) const { assert(i < 3); return mVec[i]; }
150 Int32& x() { return mVec[0]; }
151 Int32& y() { return mVec[1]; }
152 Int32& z() { return mVec[2]; }
153 Int32& operator[](size_t i) { assert(i < 3); return mVec[i]; }
154
155 const Int32* asPointer() const { return mVec; }
156 Int32* asPointer() { return mVec; }
157 Vec3d asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
158 Vec3s asVec3s() const { return Vec3s(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
159 Vec3i asVec3i() const { return Vec3i(mVec); }
160 Vec3I asVec3I() const { return Vec3I(Index32(mVec[0]), Index32(mVec[1]), Index32(mVec[2])); }
161 void asXYZ(Int32& x, Int32& y, Int32& z) const { x = mVec[0]; y = mVec[1]; z = mVec[2]; }
162
163 bool operator==(const Coord& rhs) const
164 {
165 return (mVec[0] == rhs.mVec[0] && mVec[1] == rhs.mVec[1] && mVec[2] == rhs.mVec[2]);
166 }
167 bool operator!=(const Coord& rhs) const { return !(*this == rhs); }
168
170 bool operator<(const Coord& rhs) const
171 {
172 return this->x() < rhs.x() ? true : this->x() > rhs.x() ? false
173 : this->y() < rhs.y() ? true : this->y() > rhs.y() ? false
174 : this->z() < rhs.z() ? true : false;
175 }
177 bool operator<=(const Coord& rhs) const
178 {
179 return this->x() < rhs.x() ? true : this->x() > rhs.x() ? false
180 : this->y() < rhs.y() ? true : this->y() > rhs.y() ? false
181 : this->z() <=rhs.z() ? true : false;
182 }
184 bool operator>(const Coord& rhs) const { return !(*this <= rhs); }
186 bool operator>=(const Coord& rhs) const { return !(*this < rhs); }
187
189 void minComponent(const Coord& other)
190 {
191 mVec[0] = std::min(mVec[0], other.mVec[0]);
192 mVec[1] = std::min(mVec[1], other.mVec[1]);
193 mVec[2] = std::min(mVec[2], other.mVec[2]);
194 }
195
197 void maxComponent(const Coord& other)
198 {
199 mVec[0] = std::max(mVec[0], other.mVec[0]);
200 mVec[1] = std::max(mVec[1], other.mVec[1]);
201 mVec[2] = std::max(mVec[2], other.mVec[2]);
202 }
203
205 static inline Coord minComponent(const Coord& lhs, const Coord& rhs)
206 {
207 return Coord(std::min(lhs.x(), rhs.x()),
208 std::min(lhs.y(), rhs.y()),
209 std::min(lhs.z(), rhs.z()));
210 }
211
213 static inline Coord maxComponent(const Coord& lhs, const Coord& rhs)
214 {
215 return Coord(std::max(lhs.x(), rhs.x()),
216 std::max(lhs.y(), rhs.y()),
217 std::max(lhs.z(), rhs.z()));
218 }
219
222 static inline bool lessThan(const Coord& a, const Coord& b)
223 {
224 return (a[0] < b[0] || a[1] < b[1] || a[2] < b[2]);
225 }
226
228 size_t minIndex() const { return MinIndex(mVec); }
229
231 size_t maxIndex() const { return MaxIndex(mVec); }
232
233 void read(std::istream& is) { is.read(reinterpret_cast<char*>(mVec), sizeof(mVec)); }
234 void write(std::ostream& os) const
235 {
236 os.write(reinterpret_cast<const char*>(mVec), sizeof(mVec));
237 }
238
239 private:
240
241 Int32 mVec[3];
242 }; // class Coord
243
244
246
247
252 class CoordBBox
253 {
254 public:
255 typedef uint64_t Index64;
256 typedef Coord::ValueType ValueType;
257
259 CoordBBox(): mMin(Coord::max()), mMax(Coord::min()) {}
261 CoordBBox(const Coord& min, const Coord& max): mMin(min), mMax(max) {}
264 CoordBBox(CoordBBox& other, const tbb::split&): mMin(other.mMin), mMax(other.mMax)
265 {
266 assert(this->is_divisible());
267 const size_t n = this->maxExtent();
268 mMax[n] = (mMin[n] + mMax[n]) >> 1;
269 other.mMin[n] = mMax[n] + 1;
270 }
271
272 static CoordBBox createCube(const Coord& min, ValueType dim)
273 {
274 return CoordBBox(min, min.offsetBy(dim - 1));
275 }
276
278 static CoordBBox inf() { return CoordBBox(Coord::min(), Coord::max()); }
279
280 const Coord& min() const { return mMin; }
281 const Coord& max() const { return mMax; }
282
283 Coord& min() { return mMin; }
284 Coord& max() { return mMax; }
285
286 void reset() { mMin = Coord::max(); mMax = Coord::min(); }
287 void reset(const Coord& min, const Coord& max) { mMin = min; mMax = max; }
288 void resetToCube(const Coord& min, ValueType dim) { mMin = min; mMax = min.offsetBy(dim - 1); }
289
291 Coord getStart() const { return mMin; }
293 Coord getEnd() const { return mMax.offsetBy(1); }
294
295 bool operator==(const CoordBBox& rhs) const { return mMin == rhs.mMin && mMax == rhs.mMax; }
296 bool operator!=(const CoordBBox& rhs) const { return !(*this == rhs); }
297
298 bool empty() const { return (mMin[0] > mMax[0] || mMin[1] > mMax[1] || mMin[2] > mMax[2]); }
300 operator bool() const { return !this->empty(); }
302 bool hasVolume() const { return !this->empty(); }
304
306 Vec3d getCenter() const { return 0.5 * Vec3d((mMin + mMax).asPointer()); }
307
311 Coord dim() const { return mMax.offsetBy(1) - mMin; }
313 Coord extents() const { return this->dim(); }
316 Index64 volume() const
317 {
318 const Coord d = this->dim();
319 return Index64(d[0]) * Index64(d[1]) * Index64(d[2]);
320 }
322 bool is_divisible() const { return mMin[0]<mMax[0] && mMin[1]<mMax[1] && mMin[2]<mMax[2]; }
323
325 size_t minExtent() const { return this->dim().minIndex(); }
326
328 size_t maxExtent() const { return this->dim().maxIndex(); }
329
331 bool isInside(const Coord& xyz) const
332 {
333 return !(Coord::lessThan(xyz,mMin) || Coord::lessThan(mMax,xyz));
334 }
335
337 bool isInside(const CoordBBox& b) const
338 {
339 return !(Coord::lessThan(b.mMin,mMin) || Coord::lessThan(mMax,b.mMax));
340 }
341
343 bool hasOverlap(const CoordBBox& b) const
344 {
345 return !(Coord::lessThan(mMax,b.mMin) || Coord::lessThan(b.mMax,mMin));
346 }
347
349 void expand(ValueType padding)
350 {
351 mMin.offset(-padding);
352 mMax.offset( padding);
353 }
355 void expand(const Coord& xyz)
356 {
357 mMin.minComponent(xyz);
358 mMax.maxComponent(xyz);
359 }
361 void expand(const CoordBBox& bbox)
362 {
363 mMin.minComponent(bbox.min());
364 mMax.maxComponent(bbox.max());
365 }
367 void intersect(const CoordBBox& bbox)
368 {
369 mMin.maxComponent(bbox.min());
370 mMax.minComponent(bbox.max());
371 }
374 void expand(const Coord& min, Coord::ValueType dim)
375 {
376 mMin.minComponent(min);
377 mMax.maxComponent(min.offsetBy(dim-1));
378 }
380 void translate(const Coord& t) { mMin += t; mMax += t; }
381
383 void read(std::istream& is) { mMin.read(is); mMax.read(is); }
385 void write(std::ostream& os) const { mMin.write(os); mMax.write(os); }
386
387 private:
388 Coord mMin, mMax;
389 }; // class CoordBBox
390
391
393
394
395 inline std::ostream& operator<<(std::ostream& os, const Coord& xyz)
396 {
397 os << xyz.asVec3i(); return os;
398 }
399
400
402 template<typename T>
404 inline Vec3<typename promote<T, typename Coord::ValueType>::type>
405 operator+(const Vec3<T>& v0, const Coord& v1)
406 {
407 Vec3<typename promote<T, typename Coord::ValueType>::type> result(v0);
408 result[0] += v1[0];
409 result[1] += v1[1];
410 result[2] += v1[2];
411 return result;
412 }
413
414 template<typename T>
415 inline Vec3<typename promote<T, typename Coord::ValueType>::type>
416 operator+(const Coord& v1, const Vec3<T>& v0)
417 {
418 Vec3<typename promote<T, typename Coord::ValueType>::type> result(v0);
419 result[0] += v1[0];
420 result[1] += v1[1];
421 result[2] += v1[2];
422 return result;
423 }
425
426
428 template <typename T>
430 inline Vec3<typename promote<T, Coord::ValueType>::type>
431 operator-(const Vec3<T>& v0, const Coord& v1)
432 {
433 Vec3<typename promote<T, Coord::ValueType>::type> result(v0);
434 result[0] -= v1[0];
435 result[1] -= v1[1];
436 result[2] -= v1[2];
437 return result;
438 }
439
440 template <typename T>
441 inline Vec3<typename promote<T, Coord::ValueType>::type>
442 operator-(const Coord& v1, const Vec3<T>& v0)
443 {
444 Vec3<typename promote<T, Coord::ValueType>::type> result(v0);
445 result[0] -= v1[0];
446 result[1] -= v1[1];
447 result[2] -= v1[2];
448 return -result;
449 }
451
452 inline std::ostream&
453 operator<<(std::ostream& os, const CoordBBox& b)
454 {
455 os << b.min() << " -> " << b.max();
456 return os;
457 }
458
459 } // namespace math
460 } // namespace OPENVDB_VERSION_NAME
461 } // namespace openvdb
462
463 #endif // OPENVDB_MATH_COORD_HAS_BEEN_INCLUDED
464
465 // Copyright (c) 2012-2015 DreamWorks Animation LLC
466 // All rights reserved. This software is distributed under the
467 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
openvdb::v3_1_0::math::Coord::operator>
bool operator>(const Coord &rhs) const
Lexicographic greater than.
Definition: Coord.h:184
openvdb::v3_1_0::math::Coord::asPointer
Int32 * asPointer()
Definition: Coord.h:156
openvdb::v3_1_0::math::Coord::ceil
static Coord ceil(const Vec3< T > &xyz)
Return the largest integer coordinates that are not greater than xyz+1 (node centered conversion)...
Definition: Coord.h:89
openvdb::v3_1_0::math::Coord::asPointer
const Int32 * asPointer() const
Definition: Coord.h:155
openvdb::v3_1_0::math::CoordBBox::operator!=
bool operator!=(const CoordBBox &rhs) const
Definition: Coord.h:296
openvdb::v3_1_0::math::Coord::minComponent
static Coord minComponent(const Coord &lhs, const Coord &rhs)
Return the component-wise minimum of the two Coords.
Definition: Coord.h:205
openvdb::v3_1_0::math::Coord::offset
Coord & offset(Int32 n)
Definition: Coord.h:110
openvdb::v3_1_0::math::Coord::operator>>=
Coord & operator>>=(size_t n)
Definition: Coord.h:140
openvdb::v3_1_0::math::Coord::minComponent
void minComponent(const Coord &other)
Perform a component-wise minimum with the other Coord.
Definition: Coord.h:189
openvdb::v3_1_0::math::Coord::Vec3I
Vec3< Index32 > Vec3I
Definition: Coord.h:53
openvdb::v3_1_0::math::CoordBBox::max
const Coord & max() const
Definition: Coord.h:281
openvdb::v3_1_0::math::CoordBBox::expand
void expand(ValueType padding)
Pad this bounding box with the specified padding.
Definition: Coord.h:349
Vec3.h
openvdb::v3_1_0::math::CoordBBox::extents
Coord extents() const
Definition: Coord.h:313
openvdb::v3_1_0::math::Coord::setX
Coord & setX(Int32 x)
Definition: Coord.h:101
openvdb::v3_1_0::math::Coord::asVec3I
Vec3I asVec3I() const
Definition: Coord.h:160
Math.h
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
openvdb::v3_1_0::math::Coord::Coord
Coord(const Vec3i &v)
Definition: Coord.h:61
openvdb::v3_1_0::math::CoordBBox::translate
void translate(const Coord &t)
Translate this bounding box by .
Definition: Coord.h:380
openvdb::v3_1_0::math::CoordBBox::min
const Coord & min() const
Definition: Coord.h:280
openvdb::v3_1_0::math::MaxIndex
size_t MaxIndex(const Vec3T &v)
Return the index [0,1,2] of the largest value in a 3D vector.
Definition: Math.h:893
openvdb::v3_1_0::math::Coord::read
void read(std::istream &is)
Definition: Coord.h:233
openvdb::v3_1_0::math::Coord::operator<<=
Coord & operator<<=(size_t n)
Definition: Coord.h:139
openvdb::v3_1_0::math::Coord::offsetBy
Coord offsetBy(Int32 dx, Int32 dy, Int32 dz) const
Definition: Coord.h:111
openvdb::v3_1_0::math::CoordBBox::getCenter
Vec3d getCenter() const
Return the floating-point position of the center of this bounding box.
Definition: Coord.h:306
openvdb::v3_1_0::math::CoordBBox::write
void write(std::ostream &os) const
Serialize this bounding box to the given stream.
Definition: Coord.h:385
openvdb::v3_1_0::math::Coord::y
Int32 & y()
Definition: Coord.h:151
openvdb::v3_1_0::math::Coord::Index32
uint32_t Index32
Definition: Coord.h:51
openvdb::v3_1_0::math::Coord::asVec3s
Vec3s asVec3s() const
Definition: Coord.h:158
openvdb::v3_1_0::Index32
uint32_t Index32
Definition: Types.h:56
openvdb::v3_1_0::math::CoordBBox::intersect
void intersect(const CoordBBox &bbox)
Intersect this bounding box with the given bounding box.
Definition: Coord.h:367
openvdb::v3_1_0::math::CoordBBox::CoordBBox
CoordBBox()
The default constructor produces an empty bounding box.
Definition: Coord.h:259
openvdb::v3_1_0::math::CoordBBox::hasVolume
bool hasVolume() const
Return true if this bounding box is nonempty.
Definition: Coord.h:302
openvdb::v3_1_0::math::CoordBBox::Index64
uint64_t Index64
Definition: Coord.h:255
openvdb::v3_1_0::math::Coord::Coord
Coord(const Int32 *v)
Definition: Coord.h:66
openvdb::v3_1_0::math::Coord
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:47
openvdb::v3_1_0::math::CoordBBox::volume
Index64 volume() const
Return the integer volume of coordinates spanned by this bounding box.
Definition: Coord.h:316
openvdb::v3_1_0::math::Ceil
int Ceil(float x)
Return the ceiling of x.
Definition: Math.h:804
openvdb::v3_1_0::tools::composite::min
const boost::disable_if_c< VecTraits< T >::IsVec, T >::type & min(const T &a, const T &b)
Definition: Composite.h:105
openvdb::v3_1_0::math::Coord::operator[]
Int32 operator[](size_t i) const
Definition: Coord.h:149
openvdb::v3_1_0::math::Vec3i
Vec3< int32_t > Vec3i
Definition: Vec3.h:640
openvdb::v3_1_0::math::operator+
Vec3< typename promote< T, typename Coord::ValueType >::type > operator+(const Coord &v1, const Vec3< T > &v0)
Allow a Coord to be added to or subtracted from a Vec3.
Definition: Coord.h:416
openvdb::v3_1_0::math::CoordBBox::getEnd
Coord getEnd() const
Definition: Coord.h:293
openvdb::v3_1_0::math::CoordBBox::CoordBBox
CoordBBox(const Coord &min, const Coord &max)
Construct a bounding box with the given min and max bounds.
Definition: Coord.h:261
openvdb::v3_1_0::math::CoordBBox::hasOverlap
bool hasOverlap(const CoordBBox &b) const
Return true if the given bounding box overlaps with this bounding box.
Definition: Coord.h:343
openvdb::v3_1_0::math::CoordBBox::createCube
static CoordBBox createCube(const Coord &min, ValueType dim)
Definition: Coord.h:272
openvdb::v3_1_0::math::Coord::Int32
int32_t Int32
Definition: Coord.h:50
openvdb::v3_1_0::math::Coord::z
Int32 z() const
Definition: Coord.h:148
openvdb::v3_1_0::math::CoordBBox::reset
void reset(const Coord &min, const Coord &max)
Definition: Coord.h:287
openvdb::v3_1_0::math::Coord::operator-=
Coord & operator-=(const Coord &rhs)
Definition: Coord.h:122
openvdb::v3_1_0::math::Coord::reset
Coord & reset(Int32 xyz)
Definition: Coord.h:99
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
Definition: version.h:43
openvdb::v3_1_0::math::Coord::offsetBy
Coord offsetBy(Int32 n) const
Definition: Coord.h:115
openvdb::v3_1_0::math::Coord::maxComponent
static Coord maxComponent(const Coord &lhs, const Coord &rhs)
Return the component-wise maximum of the two Coords.
Definition: Coord.h:213
openvdb::v3_1_0::math::Coord::asVec3d
Vec3d asVec3d() const
Definition: Coord.h:157
openvdb::v3_1_0::math::Coord::minIndex
size_t minIndex() const
Return the index (0, 1 or 2) with the smallest value.
Definition: Coord.h:228
openvdb::v3_1_0::math::CoordBBox::expand
void expand(const Coord &min, Coord::ValueType dim)
Union this bounding box with the cubical bounding box of the given size and with the given minimum co...
Definition: Coord.h:374
openvdb::v3_1_0::math::Coord::Coord
Coord(Int32 x, Int32 y, Int32 z)
Definition: Coord.h:60
openvdb::v3_1_0::math::Coord::Limits
std::numeric_limits< ValueType > Limits
Definition: Coord.h:56
openvdb::v3_1_0::math::CoordBBox::operator==
bool operator==(const CoordBBox &rhs) const
Definition: Coord.h:295
openvdb::v3_1_0::math::CoordBBox::max
Coord & max()
Definition: Coord.h:284
openvdb::v3_1_0::math::Coord::operator<=
bool operator<=(const Coord &rhs) const
Lexicographic less than or equal to.
Definition: Coord.h:177
openvdb::v3_1_0::math::Vec3
Definition: Mat.h:146
openvdb::v3_1_0::math::CoordBBox::read
void read(std::istream &is)
Unserialize this bounding box from the given stream.
Definition: Coord.h:383
openvdb::v3_1_0::math::Coord::write
void write(std::ostream &os) const
Definition: Coord.h:234
openvdb::v3_1_0::math::CoordBBox::reset
void reset()
Definition: Coord.h:286
openvdb::v3_1_0::math::Coord::operator!=
bool operator!=(const Coord &rhs) const
Definition: Coord.h:167
openvdb
Definition: Exceptions.h:39
openvdb::v3_1_0::math::Round
float Round(float x)
Return x rounded to the nearest integer.
Definition: Math.h:767
openvdb::v3_1_0::math::Coord::round
static Coord round(const Vec3< T > &xyz)
Return xyz rounded to the closest integer coordinates (cell centered conversion). ...
Definition: Coord.h:76
openvdb::v3_1_0::math::CoordBBox::isInside
bool isInside(const Coord &xyz) const
Return true if point (x, y, z) is inside this bounding box.
Definition: Coord.h:331
openvdb::v3_1_0::math::operator<<
std::ostream & operator<<(std::ostream &os, const CoordBBox &b)
Definition: Coord.h:453
openvdb::v3_1_0::math::Coord::reset
Coord & reset(Int32 x, Int32 y, Int32 z)
Definition: Coord.h:94
openvdb::v3_1_0::math::Coord::x
Int32 x() const
Definition: Coord.h:146
openvdb::v3_1_0::math::Coord::max
static Coord max()
Return the largest possible coordinate.
Definition: Coord.h:72
openvdb::v3_1_0::math::CoordBBox::getStart
Coord getStart() const
Definition: Coord.h:291
openvdb::v3_1_0::math::Vec3d
Vec3< double > Vec3d
Definition: Vec3.h:643
openvdb::v3_1_0::math::CoordBBox::dim
Coord dim() const
Return the dimensions of the coordinates spanned by this bounding box.
Definition: Coord.h:311
openvdb::v3_1_0::math::Coord::asVec3i
Vec3i asVec3i() const
Definition: Coord.h:159
openvdb::v3_1_0::math::Coord::asXYZ
void asXYZ(Int32 &x, Int32 &y, Int32 &z) const
Definition: Coord.h:161
openvdb::v3_1_0::math::CoordBBox::CoordBBox
CoordBBox(CoordBBox &other, const tbb::split &)
Splitting constructor for use in TBB ranges.
Definition: Coord.h:264
openvdb::v3_1_0::math::Coord::operator<
bool operator<(const Coord &rhs) const
Lexicographic less than.
Definition: Coord.h:170
openvdb::v3_1_0::math::CoordBBox::minExtent
size_t minExtent() const
Return the index (0, 1 or 2) of the shortest axis.
Definition: Coord.h:325
openvdb::v3_1_0::math::Coord::operator[]
Int32 & operator[](size_t i)
Definition: Coord.h:153
openvdb::v3_1_0::math::Coord::min
static Coord min()
Return the smallest possible coordinate.
Definition: Coord.h:69
openvdb::v3_1_0::math::Coord::offset
Coord & offset(Int32 dx, Int32 dy, Int32 dz)
Definition: Coord.h:105
openvdb::v3_1_0::math::Coord::operator>=
bool operator>=(const Coord &rhs) const
Lexicographic greater than or equal to.
Definition: Coord.h:186
openvdb::v3_1_0::math::Coord::operator-
Coord operator-() const
Definition: Coord.h:135
openvdb::v3_1_0::math::Coord::setY
Coord & setY(Int32 y)
Definition: Coord.h:102
openvdb::v3_1_0::math::Coord::floor
static Coord floor(const Vec3< T > &xyz)
Return the largest integer coordinates that are not greater than xyz (node centered conversion)...
Definition: Coord.h:82
openvdb::v3_1_0::math::Coord::Coord
Coord(const Vec3I &v)
Definition: Coord.h:62
openvdb::v3_1_0::tools::composite::max
const boost::disable_if_c< VecTraits< T >::IsVec, T >::type & max(const T &a, const T &b)
Definition: Composite.h:109
openvdb::v3_1_0::math::Coord::ValueType
Int32 ValueType
Definition: Coord.h:55
openvdb::v3_1_0::Int32
int32_t Int32
Definition: Types.h:60
tbb
Definition: Coord.h:38
openvdb::v3_1_0::math::CoordBBox::inf
static CoordBBox inf()
Return an "infinite" bounding box, as defined by the Coord value range.
Definition: Coord.h:278
openvdb::v3_1_0::Index64
uint64_t Index64
Definition: Types.h:57
openvdb::v3_1_0::Vec3I
math::Vec3< Index32 > Vec3I
Definition: Types.h:77
openvdb::v3_1_0::math::Coord::z
Int32 & z()
Definition: Coord.h:152
openvdb::v3_1_0::math::Coord::x
Int32 & x()
Definition: Coord.h:150
openvdb::v3_1_0::math::CoordBBox::expand
void expand(const Coord &xyz)
Expand this bounding box to enclose point (x, y, z).
Definition: Coord.h:355
openvdb::v3_1_0::math::Floor
int Floor(float x)
Return the floor of x.
Definition: Math.h:796
openvdb::v3_1_0::math::CoordBBox::isInside
bool isInside(const CoordBBox &b) const
Return true if the given bounding box is inside this bounding box.
Definition: Coord.h:337
openvdb::v3_1_0::math::MinIndex
size_t MinIndex(const Vec3T &v)
Return the index [0,1,2] of the smallest value in a 3D vector.
Definition: Math.h:872
openvdb::v3_1_0::math::Coord::lessThan
static bool lessThan(const Coord &a, const Coord &b)
Definition: Coord.h:222
openvdb::v3_1_0::math::CoordBBox::maxExtent
size_t maxExtent() const
Return the index (0, 1 or 2) of the longest axis.
Definition: Coord.h:328
openvdb::v3_1_0::math::Coord::operator+=
Coord & operator+=(const Coord &rhs)
Definition: Coord.h:117
openvdb::v3_1_0::math::Coord::operator-
Coord operator-(const Coord &rhs) const
Definition: Coord.h:131
openvdb::v3_1_0::math::CoordBBox::ValueType
Coord::ValueType ValueType
Definition: Coord.h:256
openvdb::v3_1_0::math::Coord::Coord
Coord()
Definition: Coord.h:58
openvdb::v3_1_0::math::Coord::maxComponent
void maxComponent(const Coord &other)
Perform a component-wise maximum with the other Coord.
Definition: Coord.h:197
openvdb::v3_1_0::math::Coord::operator+
Coord operator+(const Coord &rhs) const
Definition: Coord.h:127
openvdb::v3_1_0::math::CoordBBox::expand
void expand(const CoordBBox &bbox)
Union this bounding box with the given bounding box.
Definition: Coord.h:361
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:71
openvdb::v3_1_0::math::operator-
Vec3< typename promote< T, Coord::ValueType >::type > operator-(const Coord &v1, const Vec3< T > &v0)
Allow a Coord to be subtracted from a Vec3.
Definition: Coord.h:442
openvdb::v3_1_0::math::CoordBBox::resetToCube
void resetToCube(const Coord &min, ValueType dim)
Definition: Coord.h:288
openvdb::v3_1_0::math::Coord::Coord
Coord(Int32 xyz)
Definition: Coord.h:59
openvdb::v3_1_0::math::CoordBBox::is_divisible
bool is_divisible() const
Return true if this bounding box can be subdivided [mainly for use by TBB].
Definition: Coord.h:322
openvdb::v3_1_0::math::Vec3s
Vec3< float > Vec3s
Definition: Vec3.h:642
openvdb::v3_1_0::math::CoordBBox::empty
bool empty() const
Definition: Coord.h:298
openvdb::v3_1_0::math::Coord::operator==
bool operator==(const Coord &rhs) const
Definition: Coord.h:163
openvdb::v3_1_0::math::CoordBBox::min
Coord & min()
Definition: Coord.h:283
openvdb::v3_1_0::math::CoordBBox
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:252
openvdb::v3_1_0::math::Coord::y
Int32 y() const
Definition: Coord.h:147
openvdb::v3_1_0::math::Coord::Vec3i
Vec3< Int32 > Vec3i
Definition: Coord.h:52
Platform.h
openvdb::v3_1_0::math::Coord::maxIndex
size_t maxIndex() const
Return the index (0, 1 or 2) with the largest value.
Definition: Coord.h:231
openvdb::v3_1_0::math::Coord::setZ
Coord & setZ(Int32 z)
Definition: Coord.h:103