OpenVDB: PointSample.h Source File

OpenVDB 6.0.0

PointSample.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2018 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
36
37 #ifndef OPENVDB_POINTS_POINT_SAMPLE_HAS_BEEN_INCLUDED
38 #define OPENVDB_POINTS_POINT_SAMPLE_HAS_BEEN_INCLUDED
39
40 #include <openvdb/util/NullInterrupter.h>
41 #include <openvdb/tools/Interpolation.h>
42
43 #include "PointDataGrid.h"
44 #include "PointAttribute.h"
45
46 #include <sstream>
47 #include <type_traits>
48
49
50 namespace openvdb {
51 OPENVDB_USE_VERSION_NAMESPACE
52 namespace OPENVDB_VERSION_NAME {
53 namespace points {
54
55
65 template<typename PointDataGridT, typename SourceGridT,
66 typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
67 inline void pointSample(PointDataGridT& points,
68 const SourceGridT& sourceGrid,
69 const Name& targetAttribute = "",
70 const FilterT& filter = NullFilter(),
71 InterrupterT* const interrupter = nullptr);
72
73
83 template<typename PointDataGridT, typename SourceGridT,
84 typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
85 inline void boxSample( PointDataGridT& points,
86 const SourceGridT& sourceGrid,
87 const Name& targetAttribute = "",
88 const FilterT& filter = NullFilter(),
89 InterrupterT* const interrupter = nullptr);
90
91
101 template<typename PointDataGridT, typename SourceGridT,
102 typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
103 inline void quadraticSample(PointDataGridT& points,
104 const SourceGridT& sourceGrid,
105 const Name& targetAttribute = "",
106 const FilterT& filter = NullFilter(),
107 InterrupterT* const interrupter = nullptr);
108
109
110 // This struct samples the source grid accessor using the world-space position supplied,
111 // with SamplerT providing the sampling scheme. In the case where ValueT does not match
112 // the value type of the source grid, the sample() method will also convert the sampled
113 // value into a ValueT value, using round-to-nearest for float-to-integer conversion.
114 struct SampleWithRounding
115 {
116 template<typename ValueT, typename SamplerT, typename AccessorT>
117 inline ValueT sample(const AccessorT& accessor, const Vec3d& position) const;
118 };
119
120
121 // A dummy struct that is used to mean that the sampled attribute should either match the type
122 // of the existing attribute or the type of the source grid (if the attribute doesn't exist yet)
123 struct DummySampleType { };
124
125
139 template<typename PointDataGridT, typename SourceGridT, typename TargetValueT = DummySampleType,
140 typename SamplerT = SampleWithRounding, typename FilterT = NullFilter,
141 typename InterrupterT = util::NullInterrupter>
142 inline void sampleGrid( size_t order,
143 PointDataGridT& points,
144 const SourceGridT& sourceGrid,
145 const Name& targetAttribute,
146 const FilterT& filter = NullFilter(),
147 const SamplerT& sampler = SampleWithRounding(),
148 InterrupterT* const interrupter = nullptr,
149 const bool threaded = true);
150
151
153
154
155 namespace point_sample_internal {
156
157
158 template<typename FromType, typename ToType>
159 struct CompatibleTypes { enum { value = std::is_constructible<ToType, FromType>::value }; };
160
161 // Specializations for types that can be converted from source grid to target attribute
162 template<typename T> struct CompatibleTypes<
163 T, T> { enum { value = true }; };
164 template<typename T> struct CompatibleTypes<
165 T, math::Vec2<T>> { enum { value = true }; };
166 template<typename T> struct CompatibleTypes<
167 T, math::Vec3<T>> { enum { value = true }; };
168 template<typename T> struct CompatibleTypes<
169 T, math::Vec4<T>> { enum { value = true }; };
170 template<typename T> struct CompatibleTypes<
171 math::Vec2<T>, math::Vec2<T>> { enum { value = true }; };
172 template<typename T> struct CompatibleTypes<
173 math::Vec3<T>, math::Vec3<T>> { enum { value = true }; };
174 template<typename T> struct CompatibleTypes<
175 math::Vec4<T>, math::Vec4<T>> { enum { value = true }; };
176 template<typename T0, typename T1> struct CompatibleTypes<
177 math::Vec2<T0>, math::Vec2<T1>> { enum { value = CompatibleTypes<T0, T1>::value }; };
178 template<typename T0, typename T1> struct CompatibleTypes<
179 math::Vec3<T0>, math::Vec3<T1>> { enum { value = CompatibleTypes<T0, T1>::value }; };
180 template<typename T0, typename T1> struct CompatibleTypes<
181 math::Vec4<T0>, math::Vec4<T1>> { enum { value = CompatibleTypes<T0, T1>::value }; };
182 template<typename T> struct CompatibleTypes<
183 ValueMask, T> { enum { value = CompatibleTypes<bool, T>::value }; };
184
185
186 // Ability to access the Staggered template parameter from tools::Sampler<Order, Staggered>
187 template <typename T> struct SamplerTraits {
188 static const bool Staggered = false;
189 };
190 template <size_t T0, bool T1> struct SamplerTraits<tools::Sampler<T0, T1>> {
191 static const bool Staggered = T1;
192 };
193
194
195 // default sampling is incompatible, so throw an error
196 template <typename ValueT, typename SamplerT, typename AccessorT, bool Round, bool Compatible = false>
197 struct SampleWithRoundingOp
198 {
199 static inline void sample(ValueT&, const AccessorT&, const Vec3d&)
200 {
201 std::ostringstream ostr;
202 ostr << "Cannot sample a " << typeNameAsString<typename AccessorT::ValueType>()
203 << " grid on to a " << typeNameAsString<ValueT>() << " attribute";
204 OPENVDB_THROW(TypeError, ostr.str());
205 }
206 };
207 // partial specialization to handle sampling and rounding of compatible conversion
208 template <typename ValueT, typename SamplerT, typename AccessorT>
209 struct SampleWithRoundingOp<ValueT, SamplerT, AccessorT, /*Round=*/true, /*Compatible=*/true>
210 {
211 static inline void sample(ValueT& value, const AccessorT& accessor, const Vec3d& position)
212 {
213 value = ValueT(math::Round(SamplerT::sample(accessor, position)));
214 }
215 };
216 // partial specialization to handle sampling and simple casting of compatible conversion
217 template <typename ValueT, typename SamplerT, typename AccessorT>
218 struct SampleWithRoundingOp<ValueT, SamplerT, AccessorT, /*Round=*/false, /*Compatible=*/true>
219 {
220 static inline void sample(ValueT& value, const AccessorT& accessor, const Vec3d& position)
221 {
222 value = ValueT(SamplerT::sample(accessor, position));
223 }
224 };
225
226
227 template <typename PointDataGridT, typename SamplerT, typename FilterT, typename InterrupterT>
228 class PointDataSampler
229 {
230 public:
231 PointDataSampler(size_t order,
232 PointDataGridT& points,
233 const SamplerT& sampler,
234 const FilterT& filter,
235 InterrupterT* const interrupter,
236 const bool threaded)
237 : mOrder(order)
238 , mPoints(points)
239 , mSampler(sampler)
240 , mFilter(filter)
241 , mInterrupter(interrupter)
242 , mThreaded(threaded) { }
243
244 private:
245 // No-op transformation
246 struct AlignedTransform
247 {
248 inline Vec3d transform(const Vec3d& position) const { return position; }
249 }; // struct AlignedTransform
250
251 // Re-sample world-space position from source to target transforms
252 struct NonAlignedTransform
253 {
254 NonAlignedTransform(const math::Transform& source, const math::Transform& target)
255 : mSource(source)
256 , mTarget(target) { }
257
258 inline Vec3d transform(const Vec3d& position) const
259 {
260 return mSource.worldToIndex(mTarget.indexToWorld(position));
261 }
262
263 private:
264 const math::Transform& mSource;
265 const math::Transform& mTarget;
266 }; // struct NonAlignedTransform
267
268 // A simple convenience wrapper that contains the source grid accessor and the sampler
269 template <typename ValueT, typename SourceGridT, typename GridSamplerT>
270 struct SamplerWrapper
271 {
272 using ValueType = ValueT;
273 using SourceAccessorT = typename SourceGridT::ConstAccessor;
274
275 SamplerWrapper(const SourceGridT& sourceGrid, const SamplerT& sampler)
276 : mAccessor(sourceGrid.getConstAccessor())
277 , mSampler(sampler) { }
278
279 // note that creating a new accessor from the underlying tree is faster than
280 // copying an existing accessor
281 SamplerWrapper(const SamplerWrapper& other)
282 : mAccessor(other.mAccessor.tree())
283 , mSampler(other.mSampler) { }
284
285 inline ValueT sample(const Vec3d& position) const {
286 return mSampler.template sample<ValueT, GridSamplerT, SourceAccessorT>(
287 mAccessor, position);
288 }
289
290 private:
291 SourceAccessorT mAccessor;
292 const SamplerT& mSampler;
293 }; // struct SamplerWrapper
294
295 template <typename SamplerWrapperT, typename TransformerT>
296 inline void doSample(const SamplerWrapperT& sampleWrapper, const Index targetIndex,
297 const TransformerT& transformer)
298 {
299 using PointDataTreeT = typename PointDataGridT::TreeType;
300 using LeafT = typename PointDataTreeT::LeafNodeType;
301 using LeafManagerT = typename tree::LeafManager<PointDataTreeT>;
302
303 const auto& filter(mFilter);
304 const auto& interrupter(mInterrupter);
305
306 auto sampleLambda = [targetIndex, &sampleWrapper, &transformer, &filter, &interrupter](
307 LeafT& leaf, size_t /*idx*/)
308 {
309 using TargetHandleT = AttributeWriteHandle<typename SamplerWrapperT::ValueType>;
310
311 if (util::wasInterrupted(interrupter)) {
312 tbb::task::self().cancel_group_execution();
313 return;
314 }
315
316 SamplerWrapperT newSampleWrapper(sampleWrapper);
317 auto positionHandle = AttributeHandle<Vec3f>::create(leaf.constAttributeArray("P"));
318 auto targetHandle = TargetHandleT::create(leaf.attributeArray(targetIndex));
319 for (auto iter = leaf.beginIndexOn(filter); iter; ++iter) {
320 const Vec3d position = transformer.transform(
321 positionHandle->get(*iter) + iter.getCoord().asVec3d());
322 targetHandle->set(*iter, newSampleWrapper.sample(position));
323 }
324 };
325
326 LeafManagerT leafManager(mPoints.tree());
327
328 if (mInterrupter) mInterrupter->start();
329
330 leafManager.foreach(sampleLambda, mThreaded);
331
332 if (mInterrupter) mInterrupter->end();
333 }
334
335 template <typename SourceGridT, typename SamplerWrapperT>
336 inline void resolveTransform(const SourceGridT& sourceGrid, const SamplerWrapperT& sampleWrapper,
337 const Index targetIndex)
338 {
339 const auto& sourceTransform = sourceGrid.constTransform();
340 const auto& pointsTransform = mPoints.constTransform();
341
342 if (sourceTransform == pointsTransform) {
343 AlignedTransform transformer;
344 doSample(sampleWrapper, targetIndex, transformer);
345 } else {
346 NonAlignedTransform transformer(sourceTransform, pointsTransform);
347 doSample(sampleWrapper, targetIndex, transformer);
348 }
349 }
350
351 template <typename SourceGridT, typename TargetValueT, size_t Order>
352 inline void resolveStaggered(const SourceGridT& sourceGrid, const Index targetIndex)
353 {
354 using SamplerWrapperT = SamplerWrapper<TargetValueT, SourceGridT, tools::Sampler<Order, false>>;
355 using StaggeredSamplerWrapperT = SamplerWrapper<TargetValueT, SourceGridT, tools::Sampler<Order, true>>;
356
357 using SourceValueType = typename SourceGridT::ValueType;
358 if (VecTraits<SourceValueType>::Size == 3 && sourceGrid.getGridClass() == GRID_STAGGERED) {
359 StaggeredSamplerWrapperT sampleWrapper(sourceGrid, mSampler);
360 resolveTransform(sourceGrid, sampleWrapper, targetIndex);
361 } else {
362 SamplerWrapperT sampleWrapper(sourceGrid, mSampler);
363 resolveTransform(sourceGrid, sampleWrapper, targetIndex);
364 }
365 }
366
367 public:
368 template <typename SourceGridT, typename TargetValueT = typename SourceGridT::ValueType>
369 inline void sample(const SourceGridT& sourceGrid, Index targetIndex)
370 {
371 if (mOrder == 0) {
372 resolveStaggered<SourceGridT, TargetValueT, 0>(sourceGrid, targetIndex);
373 } else if (mOrder == 1) {
374 resolveStaggered<SourceGridT, TargetValueT, 1>(sourceGrid, targetIndex);
375 } else if (mOrder == 2) {
376 resolveStaggered<SourceGridT, TargetValueT, 2>(sourceGrid, targetIndex);
377 }
378 }
379
380 private:
381 size_t mOrder;
382 PointDataGridT& mPoints;
383 const SamplerT& mSampler;
384 const FilterT& mFilter;
385 InterrupterT* const mInterrupter;
386 const bool mThreaded;
387 }; // class PointDataSampler
388
389
390 template <typename PointDataGridT, typename ValueT>
391 struct AppendAttributeOp
392 {
393 static void append(PointDataGridT& points, const Name& attribute)
394 {
395 appendAttribute<ValueT>(points.tree(), attribute);
396 }
397 };
398 // partial specialization to disable attempts to append attribute type of DummySampleType
399 template <typename PointDataGridT>
400 struct AppendAttributeOp<PointDataGridT, DummySampleType>
401 {
402 static void append(PointDataGridT&, const Name&) { }
403 };
404
405 } // namespace point_sample_internal
406
407
409
410
411 template<typename ValueT, typename SamplerT, typename AccessorT>
412 ValueT SampleWithRounding::sample(const AccessorT& accessor, const Vec3d& position) const
413 {
414 using namespace point_sample_internal;
415 using SourceValueT = typename AccessorT::ValueType;
416 static const bool staggered = SamplerTraits<SamplerT>::Staggered;
417 static const bool compatible = CompatibleTypes</*from=*/SourceValueT, /*to=*/ValueT>::value &&
418 (!staggered || (staggered && VecTraits<SourceValueT>::Size == 3));
419 static const bool round = std::is_floating_point<SourceValueT>::value &&
420 std::is_integral<ValueT>::value;
421 ValueT value;
422 SampleWithRoundingOp<ValueT, SamplerT, AccessorT, round, compatible>::sample(
423 value, accessor, position);
424 return value;
425 }
426
427
429
430
431 template<typename PointDataGridT, typename SourceGridT, typename TargetValueT,
432 typename SamplerT, typename FilterT, typename InterrupterT>
433 inline void sampleGrid( size_t order,
434 PointDataGridT& points,
435 const SourceGridT& sourceGrid,
436 const Name& targetAttribute,
437 const FilterT& filter,
438 const SamplerT& sampler,
439 InterrupterT* const interrupter,
440 const bool threaded)
441 {
442 using point_sample_internal::AppendAttributeOp;
443 using point_sample_internal::PointDataSampler;
444
445 // use the name of the grid if no target attribute name supplied
446 Name attribute(targetAttribute);
447 if (targetAttribute.empty()) {
448 attribute = sourceGrid.getName();
449 }
450
451 // we do not allow sampling onto the "P" attribute
452 if (attribute == "P") {
453 OPENVDB_THROW(RuntimeError, "Cannot sample onto the \"P\" attribute");
454 }
455
456 auto leaf = points.tree().cbeginLeaf();
457 if (!leaf) return;
458
459 PointDataSampler<PointDataGridT, SamplerT, FilterT, InterrupterT> pointDataSampler(
460 order, points, sampler, filter, interrupter, threaded);
461
462 const auto& descriptor = leaf->attributeSet().descriptor();
463 size_t targetIndex = descriptor.find(attribute);
464 const bool attributeExists = targetIndex != AttributeSet::INVALID_POS;
465
466 if (std::is_same<TargetValueT, DummySampleType>::value) {
467 if (!attributeExists) {
468 // append attribute of source grid value type
469 appendAttribute<typename SourceGridT::ValueType>(points.tree(), attribute);
470 targetIndex = leaf->attributeSet().descriptor().find(attribute);
471 assert(targetIndex != AttributeSet::INVALID_POS);
472
473 // sample using same type as source grid
474 pointDataSampler.template sample<SourceGridT>(sourceGrid, Index(targetIndex));
475 } else {
476 auto targetIdx = static_cast<Index>(targetIndex);
477 // attempt to explicitly sample using type of existing attribute
478 const Name& targetType = descriptor.valueType(targetIndex);
479 if (targetType == typeNameAsString<Vec3f>()) {
480 pointDataSampler.template sample<SourceGridT, Vec3f>(sourceGrid, targetIdx);
481 } else if (targetType == typeNameAsString<Vec3d>()) {
482 pointDataSampler.template sample<SourceGridT, Vec3d>(sourceGrid, targetIdx);
483 } else if (targetType == typeNameAsString<Vec3i>()) {
484 pointDataSampler.template sample<SourceGridT, Vec3i>(sourceGrid, targetIdx);
485 } else if (targetType == typeNameAsString<int16_t>()) {
486 pointDataSampler.template sample<SourceGridT, int16_t>(sourceGrid, targetIdx);
487 } else if (targetType == typeNameAsString<int32_t>()) {
488 pointDataSampler.template sample<SourceGridT, int32_t>(sourceGrid, targetIdx);
489 } else if (targetType == typeNameAsString<int64_t>()) {
490 pointDataSampler.template sample<SourceGridT, int64_t>(sourceGrid, targetIdx);
491 } else if (targetType == typeNameAsString<float>()) {
492 pointDataSampler.template sample<SourceGridT, float>(sourceGrid, targetIdx);
493 } else if (targetType == typeNameAsString<double>()) {
494 pointDataSampler.template sample<SourceGridT, double>(sourceGrid, targetIdx);
495 } else if (targetType == typeNameAsString<bool>()) {
496 pointDataSampler.template sample<SourceGridT, bool>(sourceGrid, targetIdx);
497 } else {
498 std::ostringstream ostr;
499 ostr << "Cannot sample attribute of type - " << targetType;
500 OPENVDB_THROW(TypeError, ostr.str());
501 }
502 }
503 } else {
504 if (!attributeExists) {
505 // append attribute of target value type
506 // (point_sample_internal wrapper disables the ability to use DummySampleType)
507 AppendAttributeOp<PointDataGridT, TargetValueT>::append(points, attribute);
508 targetIndex = leaf->attributeSet().descriptor().find(attribute);
509 assert(targetIndex != AttributeSet::INVALID_POS);
510 }
511 else {
512 const Name targetType = typeNameAsString<TargetValueT>();
513 const Name attributeType = descriptor.valueType(targetIndex);
514 if (targetType != attributeType) {
515 std::ostringstream ostr;
516 ostr << "Requested attribute type " << targetType << " for sampling "
517 << " does not match existing attribute type " << attributeType;
518 OPENVDB_THROW(TypeError, ostr.str());
519 }
520 }
521
522 // sample using target value type
523 pointDataSampler.template sample<SourceGridT, TargetValueT>(
524 sourceGrid, static_cast<Index>(targetIndex));
525 }
526 }
527
528 template<typename PointDataGridT, typename SourceGridT, typename FilterT, typename InterrupterT>
529 inline void pointSample(PointDataGridT& points,
530 const SourceGridT& sourceGrid,
531 const Name& targetAttribute,
532 const FilterT& filter,
533 InterrupterT* const interrupter)
534 {
535 SampleWithRounding sampler;
536 sampleGrid(/*order=*/0, points, sourceGrid, targetAttribute, filter, sampler, interrupter);
537 }
538
539 template<typename PointDataGridT, typename SourceGridT, typename FilterT, typename InterrupterT>
540 inline void boxSample( PointDataGridT& points,
541 const SourceGridT& sourceGrid,
542 const Name& targetAttribute,
543 const FilterT& filter,
544 InterrupterT* const interrupter)
545 {
546 SampleWithRounding sampler;
547 sampleGrid(/*order=*/1, points, sourceGrid, targetAttribute, filter, sampler, interrupter);
548 }
549
550 template<typename PointDataGridT, typename SourceGridT, typename FilterT, typename InterrupterT>
551 inline void quadraticSample(PointDataGridT& points,
552 const SourceGridT& sourceGrid,
553 const Name& targetAttribute,
554 const FilterT& filter,
555 InterrupterT* const interrupter)
556 {
557 SampleWithRounding sampler;
558 sampleGrid(/*order=*/2, points, sourceGrid, targetAttribute, filter, sampler, interrupter);
559 }
560
561
563
564
565 } // namespace points
566 } // namespace OPENVDB_VERSION_NAME
567 } // namespace openvdb
568
569 #endif // OPENVDB_POINTS_POINT_SAMPLE_HAS_BEEN_INCLUDED
570
571 // Copyright (c) 2012-2018 DreamWorks Animation LLC
572 // All rights reserved. This software is distributed under the
573 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
openvdb::v6_0::typeNameAsString< int64_t >
const char * typeNameAsString< int64_t >()
Definition: Types.h:349
openvdb::v6_0::points::point_sample_internal::SampleWithRoundingOp< ValueT, SamplerT, AccessorT, true, true >::sample
static void sample(ValueT &value, const AccessorT &accessor, const Vec3d &position)
Definition: PointSample.h:211
openvdb::v6_0::points::point_sample_internal::AppendAttributeOp::append
static void append(PointDataGridT &points, const Name &attribute)
Definition: PointSample.h:393
openvdb::v6_0::typeNameAsString< Vec3i >
const char * typeNameAsString< Vec3i >()
Definition: Types.h:355
openvdb::v6_0::RuntimeError
Definition: Exceptions.h:90
openvdb::v6_0::math::Round
float Round(float x)
Return x rounded to the nearest integer.
Definition: Math.h:773
openvdb::v6_0::points::NullFilter
A no-op filter that can be used when iterating over all indices.
Definition: IndexIterator.h:77
openvdb::v6_0::VecTraits::Size
static const int Size
Definition: Types.h:217
openvdb::v6_0::points::pointSample
void pointSample(PointDataGridT &points, const SourceGridT &sourceGrid, const Name &targetAttribute="", const FilterT &filter=NullFilter(), InterrupterT *const interrupter=nullptr)
Performs closest point sampling from a VDB grid onto a VDB Points attribute.
Definition: PointSample.h:529
openvdb::v6_0::Index
Index32 Index
Definition: Types.h:61
NullInterrupter.h
openvdb::v6_0::typeNameAsString< double >
const char * typeNameAsString< double >()
Definition: Types.h:343
OPENVDB_THROW
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:109
openvdb::v6_0::math::Vec3d
Vec3< double > Vec3d
Definition: Vec3.h:679
openvdb::v6_0::math::Vec3
Definition: Mat.h:197
openvdb::v6_0::points::point_sample_internal::AppendAttributeOp
Definition: PointSample.h:391
openvdb::v6_0::util::wasInterrupted
bool wasInterrupted(T *i, int percent=-1)
Definition: NullInterrupter.h:76
openvdb::v6_0::points::point_sample_internal::AppendAttributeOp< PointDataGridT, DummySampleType >::append
static void append(PointDataGridT &, const Name &)
Definition: PointSample.h:402
openvdb::v6_0::VecTraits
Definition: Types.h:215
openvdb::v6_0::GRID_STAGGERED
Definition: Types.h:279
openvdb::v6_0::points::point_sample_internal::PointDataSampler::sample
void sample(const SourceGridT &sourceGrid, Index targetIndex)
Definition: PointSample.h:369
openvdb::v6_0::points::point_sample_internal::SampleWithRoundingOp< ValueT, SamplerT, AccessorT, false, true >::sample
static void sample(ValueT &value, const AccessorT &accessor, const Vec3d &position)
Definition: PointSample.h:220
openvdb::v6_0::points::boxSample
void boxSample(PointDataGridT &points, const SourceGridT &sourceGrid, const Name &targetAttribute="", const FilterT &filter=NullFilter(), InterrupterT *const interrupter=nullptr)
Performs tri-linear sampling from a VDB grid onto a VDB Points attribute.
Definition: PointSample.h:540
openvdb::v6_0::typeNameAsString< int32_t >
const char * typeNameAsString< int32_t >()
Definition: Types.h:347
PointAttribute.h
Point attribute manipulation in a VDB Point Grid.
openvdb::v6_0::TypeError
Definition: Exceptions.h:91
openvdb::v6_0::points::point_sample_internal::PointDataSampler::PointDataSampler
PointDataSampler(size_t order, PointDataGridT &points, const SamplerT &sampler, const FilterT &filter, InterrupterT *const interrupter, const bool threaded)
Definition: PointSample.h:231
openvdb::v6_0::points::DummySampleType
Definition: PointSample.h:123
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:136
openvdb::v6_0::typeNameAsString< bool >
const char * typeNameAsString< bool >()
Definition: Types.h:339
openvdb
Definition: Exceptions.h:40
openvdb::v6_0::points::point_sample_internal::SamplerTraits
Definition: PointSample.h:187
openvdb::v6_0::math::Transform
Definition: Transform.h:66
openvdb::v6_0::util::NullInterrupter
Dummy NOOP interrupter class defining interface.
Definition: NullInterrupter.h:52
openvdb::v6_0::typeNameAsString< Vec3d >
const char * typeNameAsString< Vec3d >()
Definition: Types.h:357
openvdb::v6_0::points::quadraticSample
void quadraticSample(PointDataGridT &points, const SourceGridT &sourceGrid, const Name &targetAttribute="", const FilterT &filter=NullFilter(), InterrupterT *const interrupter=nullptr)
Performs tri-quadratic sampling from a VDB grid onto a VDB Points attribute.
Definition: PointSample.h:551
openvdb::v6_0::math::Vec2
Definition: Vec2.h:50
openvdb::v6_0::ValueMask
Definition: Types.h:118
Interpolation.h
PointDataGrid.h
Attribute-owned data structure for points. Point attributes are stored in leaf nodes and ordered by v...
openvdb::v6_0::points::sampleGrid
void sampleGrid(size_t order, PointDataGridT &points, const SourceGridT &sourceGrid, const Name &targetAttribute, const FilterT &filter=NullFilter(), const SamplerT &sampler=SampleWithRounding(), InterrupterT *const interrupter=nullptr, const bool threaded=true)
Performs sampling and conversion from a VDB grid onto a VDB Points attribute.
Definition: PointSample.h:433
openvdb::v6_0::typeNameAsString< float >
const char * typeNameAsString< float >()
Definition: Types.h:342
openvdb::v6_0::points::point_sample_internal::CompatibleTypes
Definition: PointSample.h:159
openvdb::v6_0::points::SampleWithRounding
Definition: PointSample.h:114
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:188
openvdb::v6_0::points::point_sample_internal::PointDataSampler
Definition: PointSample.h:228
openvdb::v6_0::points::point_sample_internal::SampleWithRoundingOp::sample
static void sample(ValueT &, const AccessorT &, const Vec3d &)
Definition: PointSample.h:199
openvdb::v6_0::typeNameAsString< int16_t >
const char * typeNameAsString< int16_t >()
Definition: Types.h:345
openvdb::v6_0::Name
std::string Name
Definition: Name.h:44
openvdb::v6_0::typeNameAsString< Vec3f >
const char * typeNameAsString< Vec3f >()
Definition: Types.h:356
openvdb::v6_0::points::point_sample_internal::SampleWithRoundingOp
Definition: PointSample.h:197
openvdb::v6_0::math::Vec4
Definition: Mat4.h:51