HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LevelSetPlatonic.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2012-2017 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 //
29 ///////////////////////////////////////////////////////////////////////////
30 
31 /// @author Ken Museth
32 ///
33 /// @file LevelSetPlatonic.h
34 ///
35 /// @brief Generate a narrow-band level sets of the five platonic solids.
36 ///
37 /// @note By definition a level set has a fixed narrow band width
38 /// (the half width is defined by LEVEL_SET_HALF_WIDTH in Types.h),
39 /// whereas an SDF can have a variable narrow band width.
40 
41 #ifndef OPENVDB_TOOLS_LEVELSETPLATONIC_HAS_BEEN_INCLUDED
42 #define OPENVDB_TOOLS_LEVELSETPLATONIC_HAS_BEEN_INCLUDED
43 
44 #include <vector>
45 #include <openvdb/Grid.h>
46 #include <openvdb/Types.h>
47 #include <openvdb/math/Math.h>
48 #include <openvdb/math/Transform.h>
51 #include <hboost/utility.hpp>
52 #include <hboost/type_traits/is_floating_point.hpp>
53 
54 namespace openvdb {
56 namespace OPENVDB_VERSION_NAME {
57 namespace tools {
58 
59 /// @brief Return a grid of type @c GridType containing a narrow-band level set
60 /// representation of a platonic solid.
61 ///
62 /// @param faceCount number of faces of the platonic solid, i.e. 4, 6, 8, 12 or 20
63 /// @param scale scale of the platonic solid in world units
64 /// @param center center of the platonic solid in world units
65 /// @param voxelSize voxel size in world units
66 /// @param halfWidth half the width of the narrow band, in voxel units
67 /// @param interrupt a pointer adhering to the util::NullInterrupter interface
68 ///
69 /// @details Faces: TETRAHEDRON=4, CUBE=6, OCTAHEDRON=8, DODECAHEDRON=12, ICOSAHEDRON=20
70 ///
71 /// @note @c GridType::ValueType must be a floating-point scalar.
72 template<typename GridType, typename InterruptT>
73 typename GridType::Ptr
75  int faceCount, // 4, 6, 8, 12 or 20
76  float scale = 1.0f,
77  const Vec3f& center = Vec3f(0.0f),
78  float voxelSize = 0.1f,
79  float halfWidth = float(LEVEL_SET_HALF_WIDTH),
80  InterruptT* interrupt = nullptr);
81 
82 /// @brief Return a grid of type @c GridType containing a narrow-band level set
83 /// representation of a platonic solid.
84 ///
85 /// @param faceCount number of faces of the platonic solid, i.e. 4, 6, 8, 12 or 20
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 ///
91 /// @details Faces: TETRAHEDRON=4, CUBE=6, OCTAHEDRON=8, DODECAHEDRON=12, ICOSAHEDRON=20
92 ///
93 /// @note @c GridType::ValueType must be a floating-point scalar.
94 template<typename GridType>
95 typename GridType::Ptr
97  int faceCount,// 4, 6, 8, 12 or 20
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 {
104  return createLevelSetPlatonic<GridType>(faceCount, scale, center, voxelSize, halfWidth, &tmp);
105 }
106 
107 ////////////////////////////////////////////////////////////////////////////////
108 
109 /// @brief Return a grid of type @c GridType containing a narrow-band level set
110 /// representation of a tetrahedron.
111 ///
112 /// @param scale scale of the platonic solid in world units
113 /// @param center center of the platonic solid in world units
114 /// @param voxelSize voxel size in world units
115 /// @param halfWidth half the width of the narrow band, in voxel units
116 /// @param interrupt a pointer adhering to the util::NullInterrupter interface
117 ///
118 /// @note @c GridType::ValueType must be a floating-point scalar.
119 template<typename GridType, typename InterruptT>
120 typename GridType::Ptr
122  float scale = 1.0f,
123  const Vec3f& center = Vec3f(0.0f),
124  float voxelSize = 0.1f,
125  float halfWidth = float(LEVEL_SET_HALF_WIDTH),
126  InterruptT* interrupt = nullptr)
127 {
128  return createLevelSetPlatonic<GridType, InterruptT>(
129  4, scale, center, voxelSize, halfWidth, interrupt);
130 }
131 
132 /// @brief Return a grid of type @c GridType containing a narrow-band level set
133 /// representation of a tetrahedron.
134 ///
135 /// @param scale scale of the platonic solid in world units
136 /// @param center center of the platonic solid in world units
137 /// @param voxelSize voxel size in world units
138 /// @param halfWidth half the width of the narrow band, in voxel units
139 ///
140 /// @note @c GridType::ValueType must be a floating-point scalar.
141 template<typename GridType>
142 typename GridType::Ptr
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 {
150  return createLevelSetPlatonic<GridType>(4, scale, center, voxelSize, halfWidth, &tmp);
151 }
152 
153 ////////////////////////////////////////////////////////////////////////////////
154 
155 /// @brief Return a grid of type @c GridType containing a narrow-band level set
156 /// representation of a cube.
157 ///
158 /// @param scale scale of the platonic solid in world units
159 /// @param center center of the platonic solid in world units
160 /// @param voxelSize voxel size in world units
161 /// @param halfWidth half the width of the narrow band, in voxel units
162 /// @param interrupt a pointer adhering to the util::NullInterrupter interface
163 ///
164 /// @note @c GridType::ValueType must be a floating-point scalar.
165 template<typename GridType, typename InterruptT>
166 typename GridType::Ptr
168  float scale = 1.0f,
169  const Vec3f& center = Vec3f(0.0f),
170  float voxelSize = 0.1f,
171  float halfWidth = float(LEVEL_SET_HALF_WIDTH),
172  InterruptT* interrupt = nullptr)
173 {
174  return createLevelSetPlatonic<GridType>(6, scale, center, voxelSize, halfWidth, interrupt);
175 }
176 
177 /// @brief Return a grid of type @c GridType containing a narrow-band level set
178 /// representation of a cube.
179 ///
180 /// @param scale scale of the platonic solid in world units
181 /// @param center center of the platonic solid in world units
182 /// @param voxelSize voxel size in world units
183 /// @param halfWidth half the width of the narrow band, in voxel units
184 ///
185 /// @note @c GridType::ValueType must be a floating-point scalar.
186 template<typename GridType>
187 typename GridType::Ptr
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 {
195  return createLevelSetPlatonic<GridType>(6, scale, center, voxelSize, halfWidth, &tmp);
196 }
197 
198 ////////////////////////////////////////////////////////////////////////////////
199 
200 /// @brief Return a grid of type @c GridType containing a narrow-band level set
201 /// representation of an octahedron.
202 ///
203 /// @param scale scale of the platonic solid in world units
204 /// @param center center of the platonic solid in world units
205 /// @param voxelSize voxel size in world units
206 /// @param halfWidth half the width of the narrow band, in voxel units
207 /// @param interrupt a pointer adhering to the util::NullInterrupter interface
208 ///
209 /// @note @c GridType::ValueType must be a floating-point scalar.
210 template<typename GridType, typename InterruptT>
211 typename GridType::Ptr
213  float scale = 1.0f,
214  const Vec3f& center = Vec3f(0.0f),
215  float voxelSize = 0.1f,
216  float halfWidth = float(LEVEL_SET_HALF_WIDTH),
217  InterruptT* interrupt = nullptr)
218 {
219  return createLevelSetPlatonic<GridType>(8, scale, center, voxelSize, halfWidth, interrupt);
220 }
221 
222 /// @brief Return a grid of type @c GridType containing a narrow-band level set
223 /// representation of an octahedron.
224 ///
225 /// @param scale scale of the platonic solid in world units
226 /// @param center center of the platonic solid in world units
227 /// @param voxelSize voxel size in world units
228 /// @param halfWidth half the width of the narrow band, in voxel units
229 ///
230 /// @note @c GridType::ValueType must be a floating-point scalar.
231 template<typename GridType>
232 typename GridType::Ptr
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 {
240  return createLevelSetPlatonic<GridType>(8, scale, center, voxelSize, halfWidth, &tmp);
241 }
242 
243 ////////////////////////////////////////////////////////////////////////////////
244 
245 /// @brief Return a grid of type @c GridType containing a narrow-band level set
246 /// representation of a dodecahedron.
247 ///
248 /// @param scale scale of the platonic solid in world units
249 /// @param center center of the platonic solid in world units
250 /// @param voxelSize voxel size in world units
251 /// @param halfWidth half the width of the narrow band, in voxel units
252 /// @param interrupt a pointer adhering to the util::NullInterrupter interface
253 ///
254 /// @note @c GridType::ValueType must be a floating-point scalar.
255 template<typename GridType, typename InterruptT>
256 typename GridType::Ptr
258  float scale = 1.0f,
259  const Vec3f& center = Vec3f(0.0f),
260  float voxelSize = 0.1f,
261  float halfWidth = float(LEVEL_SET_HALF_WIDTH),
262  InterruptT* interrupt = nullptr)
263 {
264  return createLevelSetPlatonic<GridType>(12, scale, center, voxelSize, halfWidth, interrupt);
265 }
266 
267 /// @brief Return a grid of type @c GridType containing a narrow-band level set
268 /// representation of a dodecahedron.
269 ///
270 /// @param scale scale of the platonic solid in world units
271 /// @param center center of the platonic solid in world units
272 /// @param voxelSize voxel size in world units
273 /// @param halfWidth half the width of the narrow band, in voxel units
274 ///
275 /// @note @c GridType::ValueType must be a floating-point scalar.
276 template<typename GridType>
277 typename GridType::Ptr
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 {
285  return createLevelSetPlatonic<GridType>(12, scale, center, voxelSize, halfWidth, &tmp);
286 }
287 
288 ////////////////////////////////////////////////////////////////////////////////
289 
290 /// @brief Return a grid of type @c GridType containing a narrow-band level set
291 /// representation of an icosahedron.
292 ///
293 /// @param scale scale of the platonic solid in world units
294 /// @param center center of the platonic solid in world units
295 /// @param voxelSize voxel size in world units
296 /// @param halfWidth half the width of the narrow band, in voxel units
297 /// @param interrupt a pointer adhering to the util::NullInterrupter interface
298 ///
299 /// @note @c GridType::ValueType must be a floating-point scalar.
300 template<typename GridType, typename InterruptT>
301 typename GridType::Ptr
303  float scale = 1.0f,
304  const Vec3f& center = Vec3f(0.0f),
305  float voxelSize = 0.1f,
306  float halfWidth = float(LEVEL_SET_HALF_WIDTH),
307  InterruptT* interrupt = nullptr)
308 {
309  return createLevelSetPlatonic<GridType>(20, scale, center, voxelSize, halfWidth, interrupt);
310 }
311 
312 /// @brief Return a grid of type @c GridType containing a narrow-band level set
313 /// representation of an icosahedron.
314 ///
315 /// @param scale scale of the platonic solid in world units
316 /// @param center center of the platonic solid in world units
317 /// @param voxelSize voxel size in world units
318 /// @param halfWidth half the width of the narrow band, in voxel units
319 ///
320 /// @note @c GridType::ValueType must be a floating-point scalar.
321 template<typename GridType>
322 typename GridType::Ptr
324  float scale = 1.0f,
325  const Vec3f& center = Vec3f(0.0f),
326  float voxelSize = 0.1f,
327  float halfWidth = float(LEVEL_SET_HALF_WIDTH))
328 {
330  return createLevelSetPlatonic<GridType>(20, scale, center, voxelSize, halfWidth, &tmp);
331 }
332 
333 ////////////////////////////////////////////////////////////////////////////////
334 
335 template<typename GridType, typename InterruptT>
336 typename GridType::Ptr
337 createLevelSetPlatonic(int faceCount,float scale, const Vec3f& center,
338  float voxelSize, float halfWidth, InterruptT *interrupt)
339 {
340  // GridType::ValueType is required to be a floating-point scalar.
342 
344 
345  std::vector<Vec3f> vtx;
346  std::vector<Vec3I> tri;
347  std::vector<Vec4I> qua;
348 
349  if (faceCount == 4) {// Tetrahedron
350 
351  vtx.push_back( Vec3f( 0.0f, 1.0f, 0.0f) );
352  vtx.push_back( Vec3f(-0.942810297f, -0.333329707f, 0.0f) );
353  vtx.push_back( Vec3f( 0.471405149f, -0.333329707f, 0.816497624f) );
354  vtx.push_back( Vec3f( 0.471405149f, -0.333329707f, -0.816497624f) );
355 
356  tri.push_back( Vec3I(0, 2, 3) );
357  tri.push_back( Vec3I(0, 3, 1) );
358  tri.push_back( Vec3I(0, 1, 2) );
359  tri.push_back( Vec3I(1, 3, 2) );
360 
361  } else if (faceCount == 6) {// Cube
362 
363  vtx.push_back( Vec3f(-0.5f, -0.5f, -0.5f) );
364  vtx.push_back( Vec3f( 0.5f, -0.5f, -0.5f) );
365  vtx.push_back( Vec3f( 0.5f, -0.5f, 0.5f) );
366  vtx.push_back( Vec3f(-0.5f, -0.5f, 0.5f) );
367  vtx.push_back( Vec3f(-0.5f, 0.5f, -0.5f) );
368  vtx.push_back( Vec3f( 0.5f, 0.5f, -0.5f) );
369  vtx.push_back( Vec3f( 0.5f, 0.5f, 0.5f) );
370  vtx.push_back( Vec3f(-0.5f, 0.5f, 0.5f) );
371 
372  qua.push_back( Vec4I(1, 0, 4, 5) );
373  qua.push_back( Vec4I(2, 1, 5, 6) );
374  qua.push_back( Vec4I(3, 2, 6, 7) );
375  qua.push_back( Vec4I(0, 3, 7, 4) );
376  qua.push_back( Vec4I(2, 3, 0, 1) );
377  qua.push_back( Vec4I(5, 4, 7, 6) );
378 
379  } else if (faceCount == 8) {// Octahedron
380 
381  vtx.push_back( Vec3f( 0.0f, 0.0f, -1.0f) );
382  vtx.push_back( Vec3f( 1.0f, 0.0f, 0.0f) );
383  vtx.push_back( Vec3f( 0.0f, 0.0f, 1.0f) );
384  vtx.push_back( Vec3f(-1.0f, 0.0f, 0.0f) );
385  vtx.push_back( Vec3f( 0.0f,-1.0f, 0.0f) );
386  vtx.push_back( Vec3f( 0.0f, 1.0f, 0.0f) );
387 
388  tri.push_back( Vec3I(0, 4, 3) );
389  tri.push_back( Vec3I(0, 1, 4) );
390  tri.push_back( Vec3I(1, 2, 4) );
391  tri.push_back( Vec3I(2, 3, 4) );
392  tri.push_back( Vec3I(0, 3, 5) );
393  tri.push_back( Vec3I(0, 5, 1) );
394  tri.push_back( Vec3I(1, 5, 2) );
395  tri.push_back( Vec3I(2, 5, 3) );
396 
397  } else if (faceCount == 12) {// Dodecahedron
398 
399  vtx.push_back( Vec3f( 0.354437858f, 0.487842113f, -0.789344311f) );
400  vtx.push_back( Vec3f( 0.573492587f, -0.186338872f, -0.78934437f) );
401  vtx.push_back( Vec3f( 0.0f, -0.603005826f, -0.78934443f) );
402  vtx.push_back( Vec3f(-0.573492587f, -0.186338872f, -0.78934437f) );
403  vtx.push_back( Vec3f(-0.354437858f, 0.487842113f, -0.789344311f) );
404  vtx.push_back( Vec3f(-0.573492587f, 0.789345026f, -0.186338797f) );
405  vtx.push_back( Vec3f(-0.927930415f, -0.301502913f, -0.186338872f) );
406  vtx.push_back( Vec3f( 0.0f, -0.975683928f, -0.186338902f) );
407  vtx.push_back( Vec3f( 0.927930415f, -0.301502913f, -0.186338872f) );
408  vtx.push_back( Vec3f( 0.573492587f, 0.789345026f, -0.186338797f) );
409  vtx.push_back( Vec3f( 0.0f, 0.975683868f, 0.186338902f) );
410  vtx.push_back( Vec3f(-0.927930415f, 0.301502913f, 0.186338872f) );
411  vtx.push_back( Vec3f(-0.573492587f, -0.789345026f, 0.186338797f) );
412  vtx.push_back( Vec3f( 0.573492587f, -0.789345026f, 0.186338797f) );
413  vtx.push_back( Vec3f( 0.927930415f, 0.301502913f, 0.186338872f) );
414  vtx.push_back( Vec3f( 0.0f, 0.603005826f, 0.78934443f) );
415  vtx.push_back( Vec3f( 0.573492587f, 0.186338872f, 0.78934437f) );
416  vtx.push_back( Vec3f( 0.354437858f, -0.487842113f, 0.789344311f) );
417  vtx.push_back( Vec3f(-0.354437858f, -0.487842113f, 0.789344311f) );
418  vtx.push_back( Vec3f(-0.573492587f, 0.186338872f, 0.78934437f) );
419 
420  qua.push_back( Vec4I(0, 1, 2, 3) );
421  tri.push_back( Vec3I(0, 3, 4) );
422  qua.push_back( Vec4I(0, 4, 5, 10) );
423  tri.push_back( Vec3I(0, 10, 9) );
424  qua.push_back( Vec4I(0, 9, 14, 8) );
425  tri.push_back( Vec3I(0, 8, 1) );
426  qua.push_back( Vec4I(1, 8, 13, 7) );
427  tri.push_back( Vec3I(1, 7, 2) );
428  qua.push_back( Vec4I(2, 7, 12, 6) );
429  tri.push_back( Vec3I(2, 6, 3) );
430  qua.push_back( Vec4I(3, 6, 11, 5) );
431  tri.push_back( Vec3I(3, 5, 4) );
432  qua.push_back( Vec4I(5, 11, 19, 15) );
433  tri.push_back( Vec3I(5, 15, 10) );
434  qua.push_back( Vec4I(6, 12, 18, 19) );
435  tri.push_back( Vec3I(6, 19, 11) );
436  qua.push_back( Vec4I(7, 13, 17, 18) );
437  tri.push_back( Vec3I(7, 18, 12) );
438  qua.push_back( Vec4I(8, 14, 16, 17) );
439  tri.push_back( Vec3I(8, 17, 13) );
440  qua.push_back( Vec4I(9, 10, 15, 16) );
441  tri.push_back( Vec3I(9, 16, 14) );
442  qua.push_back( Vec4I(15, 19, 18, 17) );
443  tri.push_back( Vec3I(15, 17, 16) );
444 
445  } else if (faceCount == 20) {// Icosahedron
446 
447  vtx.push_back( Vec3f(0.0f, 0.0f, -1.0f) );
448  vtx.push_back( Vec3f(0.0f, 0.894427359f, -0.447213143f) );
449  vtx.push_back( Vec3f(0.850650847f, 0.276393682f, -0.447213203f) );
450  vtx.push_back( Vec3f(0.525731206f, -0.723606944f, -0.447213262f) );
451  vtx.push_back( Vec3f(-0.525731206f, -0.723606944f, -0.447213262f) );
452  vtx.push_back( Vec3f(-0.850650847f, 0.276393682f, -0.447213203f) );
453  vtx.push_back( Vec3f(-0.525731206f, 0.723606944f, 0.447213262f) );
454  vtx.push_back( Vec3f(-0.850650847f, -0.276393682f, 0.447213203f) );
455  vtx.push_back( Vec3f(0.0f, -0.894427359f, 0.447213143f) );
456  vtx.push_back( Vec3f(0.850650847f, -0.276393682f, 0.447213203f) );
457  vtx.push_back( Vec3f(0.525731206f, 0.723606944f, 0.447213262f) );
458  vtx.push_back( Vec3f(0.0f, 0.0f, 1.0f) );
459 
460  tri.push_back( Vec3I( 2, 0, 1) );
461  tri.push_back( Vec3I( 3, 0, 2) );
462  tri.push_back( Vec3I( 4, 0, 3) );
463  tri.push_back( Vec3I( 5, 0, 4) );
464  tri.push_back( Vec3I( 1, 0, 5) );
465  tri.push_back( Vec3I( 6, 1, 5) );
466  tri.push_back( Vec3I( 7, 5, 4) );
467  tri.push_back( Vec3I( 8, 4, 3) );
468  tri.push_back( Vec3I( 9, 3, 2) );
469  tri.push_back( Vec3I(10, 2, 1) );
470  tri.push_back( Vec3I(10, 1, 6) );
471  tri.push_back( Vec3I( 6, 5, 7) );
472  tri.push_back( Vec3I( 7, 4, 8) );
473  tri.push_back( Vec3I( 8, 3, 9) );
474  tri.push_back( Vec3I( 9, 2, 10) );
475  tri.push_back( Vec3I( 6, 11, 10) );
476  tri.push_back( Vec3I(10, 11, 9) );
477  tri.push_back( Vec3I( 9, 11, 8) );
478  tri.push_back( Vec3I( 8, 11, 7) );
479  tri.push_back( Vec3I( 7, 11, 6) );
480 
481  } else {
482  OPENVDB_THROW(RuntimeError, "Invalid face count");
483  }
484 
485  // Apply scale and translation to all the vertices
486  for ( size_t i = 0; i<vtx.size(); ++i ) vtx[i] = scale * vtx[i] + center;
487 
488  typename GridType::Ptr grid;
489 
490  if (interrupt == nullptr) {
492  grid = meshToLevelSet<GridType>(tmp, *xform, vtx, tri, qua, halfWidth);
493  } else {
494  grid = meshToLevelSet<GridType>(*interrupt, *xform, vtx, tri, qua, halfWidth);
495  }
496 
497  return grid;
498 }
499 
500 } // namespace tools
501 } // namespace OPENVDB_VERSION_NAME
502 } // namespace openvdb
503 
504 #endif // OPENVDB_TOOLS_LEVELSETPLATONIC_HAS_BEEN_INCLUDED
505 
506 // Copyright (c) 2012-2017 DreamWorks Animation LLC
507 // All rights reserved. This software is distributed under the
508 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
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...
Dummy NOOP interrupter class defining interface.
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...
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...
png_uint_32 i
Definition: png.h:2877
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...
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...
GA_API const UT_StringHolder scale
GLfloat f
Definition: glcorearb.h:1925
math::Vec4< Index32 > Vec4I
Definition: Types.h:91
#define OPENVDB_VERSION_NAME
Definition: version.h:43
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
GLsizei const GLfloat * value
Definition: glcorearb.h:823
math::Vec3< Index32 > Vec3I
Definition: Types.h:76
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:71
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...
static Transform::Ptr createLinearTransform(double voxelSize=1.0)
Create and return a shared pointer to a new transform.
Convert polygonal meshes that consist of quads and/or triangles into signed or unsigned distance fiel...
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:101
math::Vec3< float > Vec3f
Definition: Types.h:77