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