OpenVDB 13.0.0

Loading...
Searching...
No Matches
LevelSetPlatonic.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: Apache-2.0
3
4/// @author Ken Museth
5///
6/// @file LevelSetPlatonic.h
7///
8/// @brief Generate a narrow-band level sets of the five platonic solids.
9///
10/// @note By definition a level set has a fixed narrow band width
11/// (the half width is defined by LEVEL_SET_HALF_WIDTH in Types.h),
12/// whereas an SDF can have a variable narrow band width.
13
14#ifndef OPENVDB_TOOLS_LEVELSETPLATONIC_HAS_BEEN_INCLUDED
15#define OPENVDB_TOOLS_LEVELSETPLATONIC_HAS_BEEN_INCLUDED
16
17#include <openvdb/Grid.h>
18#include <openvdb/Types.h>
19#include <openvdb/math/Math.h>
20#include <openvdb/math/Transform.h>
21#include <openvdb/util/NullInterrupter.h>
22#include <openvdb/openvdb.h>
23
24#include "MeshToVolume.h"
25
26#include <type_traits>
27#include <vector>
28
29
30 namespace openvdb {
31 OPENVDB_USE_VERSION_NAMESPACE
32 namespace OPENVDB_VERSION_NAME {
33 namespace tools {
34
35/// @brief Return a grid of type @c GridType containing a narrow-band level set
36/// representation of a platonic solid.
37///
38/// @param faceCount number of faces of the platonic solid, i.e. 4, 6, 8, 12 or 20
39/// @param scale scale of the platonic solid in world units
40/// @param center center of the platonic solid in world units
41/// @param voxelSize voxel size in world units
42/// @param halfWidth half the width of the narrow band, in voxel units
43/// @param interrupt a pointer adhering to the util::NullInterrupter interface
44///
45/// @details Faces: TETRAHEDRON=4, CUBE=6, OCTAHEDRON=8, DODECAHEDRON=12, ICOSAHEDRON=20
46///
47/// @note @c GridType::ValueType must be a floating-point scalar.
48 template<typename GridType, typename InterruptT>
49 typename GridType::Ptr
50 createLevelSetPlatonic(
51 int faceCount, // 4, 6, 8, 12 or 20
52 float scale = 1.0f,
53 const Vec3f& center = Vec3f(0.0f),
54 float voxelSize = 0.1f,
55 float halfWidth = float(LEVEL_SET_HALF_WIDTH),
56 InterruptT* interrupt = nullptr);
57
58/// @brief Return a grid of type @c GridType containing a narrow-band level set
59/// representation of a platonic solid.
60///
61/// @param faceCount number of faces of the platonic solid, i.e. 4, 6, 8, 12 or 20
62/// @param scale scale of the platonic solid in world units
63/// @param center center of the platonic solid in world units
64/// @param voxelSize voxel size in world units
65/// @param halfWidth half the width of the narrow band, in voxel units
66///
67/// @details Faces: TETRAHEDRON=4, CUBE=6, OCTAHEDRON=8, DODECAHEDRON=12, ICOSAHEDRON=20
68///
69/// @note @c GridType::ValueType must be a floating-point scalar.
70 template<typename GridType>
71 typename GridType::Ptr
72 createLevelSetPlatonic(
73 int faceCount,// 4, 6, 8, 12 or 20
74 float scale = 1.0f,
75 const Vec3f& center = Vec3f(0.0f),
76 float voxelSize = 0.1f,
77 float halfWidth = float(LEVEL_SET_HALF_WIDTH))
78{
79 util::NullInterrupter tmp;
80 return createLevelSetPlatonic<GridType>(faceCount, scale, center, voxelSize, halfWidth, &tmp);
81}
82
83////////////////////////////////////////////////////////////////////////////////
84
85/// @brief Return a grid of type @c GridType containing a narrow-band level set
86/// representation of a tetrahedron.
87///
88/// @param scale scale of the platonic solid in world units
89/// @param center center of the platonic solid in world units
90/// @param voxelSize voxel size in world units
91/// @param halfWidth half the width of the narrow band, in voxel units
92/// @param interrupt a pointer adhering to the util::NullInterrupter interface
93///
94/// @note @c GridType::ValueType must be a floating-point scalar.
95 template<typename GridType, typename InterruptT>
96 typename GridType::Ptr
97 createLevelSetTetrahedron(
98 float scale = 1.0f,
99 const Vec3f& center = Vec3f(0.0f),
100 float voxelSize = 0.1f,
101 float halfWidth = float(LEVEL_SET_HALF_WIDTH),
102 InterruptT* interrupt = nullptr)
103{
104 return createLevelSetPlatonic<GridType, InterruptT>(
105 4, scale, center, voxelSize, halfWidth, interrupt);
106}
107
108/// @brief Return a grid of type @c GridType containing a narrow-band level set
109/// representation of a tetrahedron.
110///
111/// @param scale scale of the platonic solid in world units
112/// @param center center of the platonic solid in world units
113/// @param voxelSize voxel size in world units
114/// @param halfWidth half the width of the narrow band, in voxel units
115///
116/// @note @c GridType::ValueType must be a floating-point scalar.
117 template<typename GridType>
118 typename GridType::Ptr
119 createLevelSetTetrahedron(
120 float scale = 1.0f,
121 const Vec3f& center = Vec3f(0.0f),
122 float voxelSize = 0.1f,
123 float halfWidth = float(LEVEL_SET_HALF_WIDTH))
124{
125 util::NullInterrupter tmp;
126 return createLevelSetPlatonic<GridType>(4, scale, center, voxelSize, halfWidth, &tmp);
127}
128
129////////////////////////////////////////////////////////////////////////////////
130
131/// @brief Return a grid of type @c GridType containing a narrow-band level set
132/// representation of a cube.
133///
134/// @param scale scale of the platonic solid in world units
135/// @param center center of the platonic solid in world units
136/// @param voxelSize voxel size in world units
137/// @param halfWidth half the width of the narrow band, in voxel units
138/// @param interrupt a pointer adhering to the util::NullInterrupter interface
139///
140/// @note @c GridType::ValueType must be a floating-point scalar.
141 template<typename GridType, typename InterruptT>
142 typename GridType::Ptr
143 createLevelSetCube(
144 float scale = 1.0f,
145 const Vec3f& center = Vec3f(0.0f),
146 float voxelSize = 0.1f,
147 float halfWidth = float(LEVEL_SET_HALF_WIDTH),
148 InterruptT* interrupt = nullptr)
149{
150 return createLevelSetPlatonic<GridType>(6, scale, center, voxelSize, halfWidth, interrupt);
151}
152
153/// @brief Return a grid of type @c GridType containing a narrow-band level set
154/// representation of a cube.
155///
156/// @param scale scale of the platonic solid in world units
157/// @param center center of the platonic solid in world units
158/// @param voxelSize voxel size in world units
159/// @param halfWidth half the width of the narrow band, in voxel units
160///
161/// @note @c GridType::ValueType must be a floating-point scalar.
162 template<typename GridType>
163 typename GridType::Ptr
164 createLevelSetCube(
165 float scale = 1.0f,
166 const Vec3f& center = Vec3f(0.0f),
167 float voxelSize = 0.1f,
168 float halfWidth = float(LEVEL_SET_HALF_WIDTH))
169{
170 util::NullInterrupter tmp;
171 return createLevelSetPlatonic<GridType>(6, scale, center, voxelSize, halfWidth, &tmp);
172}
173
174////////////////////////////////////////////////////////////////////////////////
175
176/// @brief Return a grid of type @c GridType containing a narrow-band level set
177/// representation of an octahedron.
178///
179/// @param scale scale of the platonic solid in world units
180/// @param center center of the platonic solid in world units
181/// @param voxelSize voxel size in world units
182/// @param halfWidth half the width of the narrow band, in voxel units
183/// @param interrupt a pointer adhering to the util::NullInterrupter interface
184///
185/// @note @c GridType::ValueType must be a floating-point scalar.
186 template<typename GridType, typename InterruptT>
187 typename GridType::Ptr
188 createLevelSetOctahedron(
189 float scale = 1.0f,
190 const Vec3f& center = Vec3f(0.0f),
191 float voxelSize = 0.1f,
192 float halfWidth = float(LEVEL_SET_HALF_WIDTH),
193 InterruptT* interrupt = nullptr)
194{
195 return createLevelSetPlatonic<GridType>(8, scale, center, voxelSize, halfWidth, interrupt);
196}
197
198/// @brief Return a grid of type @c GridType containing a narrow-band level set
199/// representation of an octahedron.
200///
201/// @param scale scale of the platonic solid in world units
202/// @param center center of the platonic solid in world units
203/// @param voxelSize voxel size in world units
204/// @param halfWidth half the width of the narrow band, in voxel units
205///
206/// @note @c GridType::ValueType must be a floating-point scalar.
207 template<typename GridType>
208 typename GridType::Ptr
209 createLevelSetOctahedron(
210 float scale = 1.0f,
211 const Vec3f& center = Vec3f(0.0f),
212 float voxelSize = 0.1f,
213 float halfWidth = float(LEVEL_SET_HALF_WIDTH))
214{
215 util::NullInterrupter tmp;
216 return createLevelSetPlatonic<GridType>(8, scale, center, voxelSize, halfWidth, &tmp);
217}
218
219////////////////////////////////////////////////////////////////////////////////
220
221/// @brief Return a grid of type @c GridType containing a narrow-band level set
222/// representation of a dodecahedron.
223///
224/// @param scale scale of the platonic solid in world units
225/// @param center center of the platonic solid in world units
226/// @param voxelSize voxel size in world units
227/// @param halfWidth half the width of the narrow band, in voxel units
228/// @param interrupt a pointer adhering to the util::NullInterrupter interface
229///
230/// @note @c GridType::ValueType must be a floating-point scalar.
231 template<typename GridType, typename InterruptT>
232 typename GridType::Ptr
233 createLevelSetDodecahedron(
234 float scale = 1.0f,
235 const Vec3f& center = Vec3f(0.0f),
236 float voxelSize = 0.1f,
237 float halfWidth = float(LEVEL_SET_HALF_WIDTH),
238 InterruptT* interrupt = nullptr)
239{
240 return createLevelSetPlatonic<GridType>(12, scale, center, voxelSize, halfWidth, interrupt);
241}
242
243/// @brief Return a grid of type @c GridType containing a narrow-band level set
244/// representation of a dodecahedron.
245///
246/// @param scale scale of the platonic solid in world units
247/// @param center center of the platonic solid in world units
248/// @param voxelSize voxel size in world units
249/// @param halfWidth half the width of the narrow band, in voxel units
250///
251/// @note @c GridType::ValueType must be a floating-point scalar.
252 template<typename GridType>
253 typename GridType::Ptr
254 createLevelSetDodecahedron(
255 float scale = 1.0f,
256 const Vec3f& center = Vec3f(0.0f),
257 float voxelSize = 0.1f,
258 float halfWidth = float(LEVEL_SET_HALF_WIDTH))
259{
260 util::NullInterrupter tmp;
261 return createLevelSetPlatonic<GridType>(12, scale, center, voxelSize, halfWidth, &tmp);
262}
263
264////////////////////////////////////////////////////////////////////////////////
265
266/// @brief Return a grid of type @c GridType containing a narrow-band level set
267/// representation of an icosahedron.
268///
269/// @param scale scale of the platonic solid in world units
270/// @param center center of the platonic solid in world units
271/// @param voxelSize voxel size in world units
272/// @param halfWidth half the width of the narrow band, in voxel units
273/// @param interrupt a pointer adhering to the util::NullInterrupter interface
274///
275/// @note @c GridType::ValueType must be a floating-point scalar.
276 template<typename GridType, typename InterruptT>
277 typename GridType::Ptr
278 createLevelSetIcosahedron(
279 float scale = 1.0f,
280 const Vec3f& center = Vec3f(0.0f),
281 float voxelSize = 0.1f,
282 float halfWidth = float(LEVEL_SET_HALF_WIDTH),
283 InterruptT* interrupt = nullptr)
284{
285 return createLevelSetPlatonic<GridType>(20, scale, center, voxelSize, halfWidth, interrupt);
286}
287
288/// @brief Return a grid of type @c GridType containing a narrow-band level set
289/// representation of an icosahedron.
290///
291/// @param scale scale of the platonic solid in world units
292/// @param center center of the platonic solid in world units
293/// @param voxelSize voxel size in world units
294/// @param halfWidth half the width of the narrow band, in voxel units
295///
296/// @note @c GridType::ValueType must be a floating-point scalar.
297 template<typename GridType>
298 typename GridType::Ptr
299 createLevelSetIcosahedron(
300 float scale = 1.0f,
301 const Vec3f& center = Vec3f(0.0f),
302 float voxelSize = 0.1f,
303 float halfWidth = float(LEVEL_SET_HALF_WIDTH))
304{
305 util::NullInterrupter tmp;
306 return createLevelSetPlatonic<GridType>(20, scale, center, voxelSize, halfWidth, &tmp);
307}
308
309////////////////////////////////////////////////////////////////////////////////
310
311 template<typename GridType, typename InterruptT>
312 typename GridType::Ptr
313 createLevelSetPlatonic(int faceCount,float scale, const Vec3f& center,
314 float voxelSize, float halfWidth, InterruptT *interrupt)
315{
316 // GridType::ValueType is required to be a floating-point scalar.
317 static_assert(std::is_floating_point<typename GridType::ValueType>::value,
318 "level set grids must have scalar, floating-point value types");
319
320 const math::Transform::Ptr xform = math::Transform::createLinearTransform( voxelSize );
321
322 std::vector<Vec3f> vtx;
323 std::vector<Vec3I> tri;
324 std::vector<Vec4I> qua;
325
326 if (faceCount == 4) {// Tetrahedron
327
328 vtx.push_back( Vec3f( 0.0f, 1.0f, 0.0f) );
329 vtx.push_back( Vec3f(-0.942810297f, -0.333329707f, 0.0f) );
330 vtx.push_back( Vec3f( 0.471405149f, -0.333329707f, 0.816497624f) );
331 vtx.push_back( Vec3f( 0.471405149f, -0.333329707f, -0.816497624f) );
332
333 tri.push_back( Vec3I(0, 2, 3) );
334 tri.push_back( Vec3I(0, 3, 1) );
335 tri.push_back( Vec3I(0, 1, 2) );
336 tri.push_back( Vec3I(1, 3, 2) );
337
338 } else if (faceCount == 6) {// Cube
339
340 vtx.push_back( Vec3f(-0.5f, -0.5f, -0.5f) );
341 vtx.push_back( Vec3f( 0.5f, -0.5f, -0.5f) );
342 vtx.push_back( Vec3f( 0.5f, -0.5f, 0.5f) );
343 vtx.push_back( Vec3f(-0.5f, -0.5f, 0.5f) );
344 vtx.push_back( Vec3f(-0.5f, 0.5f, -0.5f) );
345 vtx.push_back( Vec3f( 0.5f, 0.5f, -0.5f) );
346 vtx.push_back( Vec3f( 0.5f, 0.5f, 0.5f) );
347 vtx.push_back( Vec3f(-0.5f, 0.5f, 0.5f) );
348
349 qua.push_back( Vec4I(1, 0, 4, 5) );
350 qua.push_back( Vec4I(2, 1, 5, 6) );
351 qua.push_back( Vec4I(3, 2, 6, 7) );
352 qua.push_back( Vec4I(0, 3, 7, 4) );
353 qua.push_back( Vec4I(2, 3, 0, 1) );
354 qua.push_back( Vec4I(5, 4, 7, 6) );
355
356 } else if (faceCount == 8) {// Octahedron
357
358 vtx.push_back( Vec3f( 0.0f, 0.0f, -1.0f) );
359 vtx.push_back( Vec3f( 1.0f, 0.0f, 0.0f) );
360 vtx.push_back( Vec3f( 0.0f, 0.0f, 1.0f) );
361 vtx.push_back( Vec3f(-1.0f, 0.0f, 0.0f) );
362 vtx.push_back( Vec3f( 0.0f,-1.0f, 0.0f) );
363 vtx.push_back( Vec3f( 0.0f, 1.0f, 0.0f) );
364
365 tri.push_back( Vec3I(0, 4, 3) );
366 tri.push_back( Vec3I(0, 1, 4) );
367 tri.push_back( Vec3I(1, 2, 4) );
368 tri.push_back( Vec3I(2, 3, 4) );
369 tri.push_back( Vec3I(0, 3, 5) );
370 tri.push_back( Vec3I(0, 5, 1) );
371 tri.push_back( Vec3I(1, 5, 2) );
372 tri.push_back( Vec3I(2, 5, 3) );
373
374 } else if (faceCount == 12) {// Dodecahedron
375
376 vtx.push_back( Vec3f( 0.354437858f, 0.487842113f, -0.789344311f) );
377 vtx.push_back( Vec3f( 0.573492587f, -0.186338872f, -0.78934437f) );
378 vtx.push_back( Vec3f( 0.0f, -0.603005826f, -0.78934443f) );
379 vtx.push_back( Vec3f(-0.573492587f, -0.186338872f, -0.78934437f) );
380 vtx.push_back( Vec3f(-0.354437858f, 0.487842113f, -0.789344311f) );
381 vtx.push_back( Vec3f(-0.573492587f, 0.789345026f, -0.186338797f) );
382 vtx.push_back( Vec3f(-0.927930415f, -0.301502913f, -0.186338872f) );
383 vtx.push_back( Vec3f( 0.0f, -0.975683928f, -0.186338902f) );
384 vtx.push_back( Vec3f( 0.927930415f, -0.301502913f, -0.186338872f) );
385 vtx.push_back( Vec3f( 0.573492587f, 0.789345026f, -0.186338797f) );
386 vtx.push_back( Vec3f( 0.0f, 0.975683868f, 0.186338902f) );
387 vtx.push_back( Vec3f(-0.927930415f, 0.301502913f, 0.186338872f) );
388 vtx.push_back( Vec3f(-0.573492587f, -0.789345026f, 0.186338797f) );
389 vtx.push_back( Vec3f( 0.573492587f, -0.789345026f, 0.186338797f) );
390 vtx.push_back( Vec3f( 0.927930415f, 0.301502913f, 0.186338872f) );
391 vtx.push_back( Vec3f( 0.0f, 0.603005826f, 0.78934443f) );
392 vtx.push_back( Vec3f( 0.573492587f, 0.186338872f, 0.78934437f) );
393 vtx.push_back( Vec3f( 0.354437858f, -0.487842113f, 0.789344311f) );
394 vtx.push_back( Vec3f(-0.354437858f, -0.487842113f, 0.789344311f) );
395 vtx.push_back( Vec3f(-0.573492587f, 0.186338872f, 0.78934437f) );
396
397 qua.push_back( Vec4I(0, 1, 2, 3) );
398 tri.push_back( Vec3I(0, 3, 4) );
399 qua.push_back( Vec4I(0, 4, 5, 10) );
400 tri.push_back( Vec3I(0, 10, 9) );
401 qua.push_back( Vec4I(0, 9, 14, 8) );
402 tri.push_back( Vec3I(0, 8, 1) );
403 qua.push_back( Vec4I(1, 8, 13, 7) );
404 tri.push_back( Vec3I(1, 7, 2) );
405 qua.push_back( Vec4I(2, 7, 12, 6) );
406 tri.push_back( Vec3I(2, 6, 3) );
407 qua.push_back( Vec4I(3, 6, 11, 5) );
408 tri.push_back( Vec3I(3, 5, 4) );
409 qua.push_back( Vec4I(5, 11, 19, 15) );
410 tri.push_back( Vec3I(5, 15, 10) );
411 qua.push_back( Vec4I(6, 12, 18, 19) );
412 tri.push_back( Vec3I(6, 19, 11) );
413 qua.push_back( Vec4I(7, 13, 17, 18) );
414 tri.push_back( Vec3I(7, 18, 12) );
415 qua.push_back( Vec4I(8, 14, 16, 17) );
416 tri.push_back( Vec3I(8, 17, 13) );
417 qua.push_back( Vec4I(9, 10, 15, 16) );
418 tri.push_back( Vec3I(9, 16, 14) );
419 qua.push_back( Vec4I(15, 19, 18, 17) );
420 tri.push_back( Vec3I(15, 17, 16) );
421
422 } else if (faceCount == 20) {// Icosahedron
423
424 vtx.push_back( Vec3f(0.0f, 0.0f, -1.0f) );
425 vtx.push_back( Vec3f(0.0f, 0.894427359f, -0.447213143f) );
426 vtx.push_back( Vec3f(0.850650847f, 0.276393682f, -0.447213203f) );
427 vtx.push_back( Vec3f(0.525731206f, -0.723606944f, -0.447213262f) );
428 vtx.push_back( Vec3f(-0.525731206f, -0.723606944f, -0.447213262f) );
429 vtx.push_back( Vec3f(-0.850650847f, 0.276393682f, -0.447213203f) );
430 vtx.push_back( Vec3f(-0.525731206f, 0.723606944f, 0.447213262f) );
431 vtx.push_back( Vec3f(-0.850650847f, -0.276393682f, 0.447213203f) );
432 vtx.push_back( Vec3f(0.0f, -0.894427359f, 0.447213143f) );
433 vtx.push_back( Vec3f(0.850650847f, -0.276393682f, 0.447213203f) );
434 vtx.push_back( Vec3f(0.525731206f, 0.723606944f, 0.447213262f) );
435 vtx.push_back( Vec3f(0.0f, 0.0f, 1.0f) );
436
437 tri.push_back( Vec3I( 2, 0, 1) );
438 tri.push_back( Vec3I( 3, 0, 2) );
439 tri.push_back( Vec3I( 4, 0, 3) );
440 tri.push_back( Vec3I( 5, 0, 4) );
441 tri.push_back( Vec3I( 1, 0, 5) );
442 tri.push_back( Vec3I( 6, 1, 5) );
443 tri.push_back( Vec3I( 7, 5, 4) );
444 tri.push_back( Vec3I( 8, 4, 3) );
445 tri.push_back( Vec3I( 9, 3, 2) );
446 tri.push_back( Vec3I(10, 2, 1) );
447 tri.push_back( Vec3I(10, 1, 6) );
448 tri.push_back( Vec3I( 6, 5, 7) );
449 tri.push_back( Vec3I( 7, 4, 8) );
450 tri.push_back( Vec3I( 8, 3, 9) );
451 tri.push_back( Vec3I( 9, 2, 10) );
452 tri.push_back( Vec3I( 6, 11, 10) );
453 tri.push_back( Vec3I(10, 11, 9) );
454 tri.push_back( Vec3I( 9, 11, 8) );
455 tri.push_back( Vec3I( 8, 11, 7) );
456 tri.push_back( Vec3I( 7, 11, 6) );
457
458 } else {
459 OPENVDB_THROW(RuntimeError, "Invalid face count");
460 }
461
462 // Apply scale and translation to all the vertices
463 for ( size_t i = 0; i<vtx.size(); ++i ) vtx[i] = scale * vtx[i] + center;
464
465 typename GridType::Ptr grid;
466
467 if (interrupt == nullptr) {
468 util::NullInterrupter tmp;
469 grid = meshToLevelSet<GridType>(tmp, *xform, vtx, tri, qua, halfWidth);
470 } else {
471 grid = meshToLevelSet<GridType>(*interrupt, *xform, vtx, tri, qua, halfWidth);
472 }
473
474 return grid;
475}
476
477
478////////////////////////////////////////
479
480
481// Explicit Template Instantiation
482
483#ifdef OPENVDB_USE_EXPLICIT_INSTANTIATION
484
485#ifdef OPENVDB_INSTANTIATE_LEVELSETPLATONIC
486#include <openvdb/util/ExplicitInstantiation.h>
487#endif
488
489#define _FUNCTION(TreeT) \
490 Grid<TreeT>::Ptr createLevelSetPlatonic<Grid<TreeT>>(int, float, const Vec3f&, float, float, \
491 util::NullInterrupter*)
492 OPENVDB_REAL_TREE_INSTANTIATE(_FUNCTION)
493#undef _FUNCTION
494
495#define _FUNCTION(TreeT) \
496 Grid<TreeT>::Ptr createLevelSetTetrahedron<Grid<TreeT>>(float, const Vec3f&, float, float, \
497 util::NullInterrupter*)
498 OPENVDB_REAL_TREE_INSTANTIATE(_FUNCTION)
499#undef _FUNCTION
500
501#define _FUNCTION(TreeT) \
502 Grid<TreeT>::Ptr createLevelSetCube<Grid<TreeT>>(float, const Vec3f&, float, float, \
503 util::NullInterrupter*)
504 OPENVDB_REAL_TREE_INSTANTIATE(_FUNCTION)
505#undef _FUNCTION
506
507#define _FUNCTION(TreeT) \
508 Grid<TreeT>::Ptr createLevelSetOctahedron<Grid<TreeT>>(float, const Vec3f&, float, float, \
509 util::NullInterrupter*)
510 OPENVDB_REAL_TREE_INSTANTIATE(_FUNCTION)
511#undef _FUNCTION
512
513#define _FUNCTION(TreeT) \
514 Grid<TreeT>::Ptr createLevelSetDodecahedron<Grid<TreeT>>(float, const Vec3f&, float, float, \
515 util::NullInterrupter*)
516 OPENVDB_REAL_TREE_INSTANTIATE(_FUNCTION)
517#undef _FUNCTION
518
519#define _FUNCTION(TreeT) \
520 Grid<TreeT>::Ptr createLevelSetIcosahedron<Grid<TreeT>>(float, const Vec3f&, float, float, \
521 util::NullInterrupter*)
522 OPENVDB_REAL_TREE_INSTANTIATE(_FUNCTION)
523#undef _FUNCTION
524
525#endif // OPENVDB_USE_EXPLICIT_INSTANTIATION
526
527
528} // namespace tools
529} // namespace OPENVDB_VERSION_NAME
530} // namespace openvdb
531
532#endif // OPENVDB_TOOLS_LEVELSETPLATONIC_HAS_BEEN_INCLUDED
ExplicitInstantiation.h
Grid.h
Math.h
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
MeshToVolume.h
Convert polygonal meshes that consist of quads and/or triangles into signed or unsigned distance fiel...
NullInterrupter.h
Transform.h
openvdb::v13_0::RuntimeError
Definition Exceptions.h:63
openvdb::v13_0::math::Transform::Ptr
SharedPtr< Transform > Ptr
Definition Transform.h:42
openvdb::v13_0::math::Transform::createLinearTransform
static Transform::Ptr createLinearTransform(double voxelSize=1.0)
Create and return a shared pointer to a new transform.
openvdb::v13_0::tools::createLevelSetCube
GridType::Ptr createLevelSetCube(float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH), InterruptT *interrupt=nullptr)
Return a grid of type GridType containing a narrow-band level set representation of a cube.
Definition LevelSetPlatonic.h:143
openvdb::v13_0::tools::createLevelSetDodecahedron
GridType::Ptr createLevelSetDodecahedron(float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH), InterruptT *interrupt=nullptr)
Return a grid of type GridType containing a narrow-band level set representation of a dodecahedron.
Definition LevelSetPlatonic.h:233
openvdb::v13_0::tools::meshToLevelSet
GridType::Ptr meshToLevelSet(const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
Convert a triangle mesh to a level set volume.
Definition MeshToVolume.h:3760
openvdb::v13_0::tools::createLevelSetPlatonic
GridType::Ptr createLevelSetPlatonic(int faceCount, float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH), InterruptT *interrupt=nullptr)
Return a grid of type GridType containing a narrow-band level set representation of a platonic solid.
Definition LevelSetPlatonic.h:313
openvdb::v13_0::tools::createLevelSetOctahedron
GridType::Ptr createLevelSetOctahedron(float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH), InterruptT *interrupt=nullptr)
Return a grid of type GridType containing a narrow-band level set representation of an octahedron.
Definition LevelSetPlatonic.h:188
openvdb::v13_0::tools::createLevelSetTetrahedron
GridType::Ptr createLevelSetTetrahedron(float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH), InterruptT *interrupt=nullptr)
Return a grid of type GridType containing a narrow-band level set representation of a tetrahedron.
Definition LevelSetPlatonic.h:97
openvdb::v13_0::tools::createLevelSetIcosahedron
GridType::Ptr createLevelSetIcosahedron(float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH), InterruptT *interrupt=nullptr)
Return a grid of type GridType containing a narrow-band level set representation of an icosahedron.
Definition LevelSetPlatonic.h:278
openvdb::v13_0::LEVEL_SET_HALF_WIDTH
static const Real LEVEL_SET_HALF_WIDTH
Definition Types.h:528
openvdb::v13_0::Vec4I
math::Vec4< Index32 > Vec4I
Definition Types.h:69
openvdb::v13_0::Vec3f
math::Vec3< float > Vec3f
Definition Types.h:55
openvdb::v13_0::Vec3I
math::Vec3< Index32 > Vec3I
Definition Types.h:54
openvdb
Definition Exceptions.h:13
OPENVDB_THROW
#define OPENVDB_THROW(exception, message)
Definition Exceptions.h:74
Types.h
openvdb.h
openvdb::v13_0::util::NullInterrupter
Base class for interrupters.
Definition NullInterrupter.h:26
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218
OPENVDB_REAL_TREE_INSTANTIATE
#define OPENVDB_REAL_TREE_INSTANTIATE(Function)
Definition version.h.in:162