Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
vhacdVolume.h
Go to the documentation of this file.
1/* Copyright (c) 2011 Khaled Mamou (kmamou at gmail dot com)
2 All rights reserved.
3
4
5 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
6 following conditions are met:
7
8 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
9 disclaimer.
10
11 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
12 disclaimer in the documentation and/or other materials provided with the distribution.
13
14 3. The names of the contributors may not be used to endorse or promote products derived from this software without
15 specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25#pragma once
26
29
32#include <assert.h>
33
34#ifdef _MSC_VER
35#pragma warning(push)
36#pragma warning(disable : 4456 4701)
37#endif
38
39namespace tesseract_collision
40{
41namespace VHACD
42{
44{
49};
50
51struct Voxel
52{
53public:
54 short m_coord[3];
55 short m_data;
56};
57
59{
60public:
61 virtual ~PrimitiveSet(){};
62 virtual PrimitiveSet* Create() const = 0;
63 virtual size_t GetNPrimitives() const = 0;
64 virtual size_t GetNPrimitivesOnSurf() const = 0;
65 virtual size_t GetNPrimitivesInsideSurf() const = 0;
66 virtual double GetEigenValue(AXIS axis) const = 0;
67 virtual double ComputeMaxVolumeError() const = 0;
68 virtual double ComputeVolume() const = 0;
69 virtual void Clip(const Plane& plane, PrimitiveSet* const positivePart, PrimitiveSet* const negativePart) const = 0;
70 virtual void Intersect(const Plane& plane,
71 SArray<Vec3<double> >* const positivePts,
72 SArray<Vec3<double> >* const negativePts,
73 const size_t sampling) const = 0;
74 virtual void ComputeExteriorPoints(const Plane& plane,
75 const Mesh& mesh,
76 SArray<Vec3<double> >* const exteriorPts) const = 0;
77 virtual void ComputeClippedVolumes(const Plane& plane, double& positiveVolume, double& negativeVolume) const = 0;
78 virtual void SelectOnSurface(PrimitiveSet* const onSurfP) const = 0;
79 virtual void ComputeConvexHull(Mesh& meshCH, const size_t sampling = 1) const = 0;
80 virtual void ComputeBB() = 0;
81 virtual void ComputePrincipalAxes() = 0;
82 virtual void AlignToPrincipalAxes() = 0;
83 virtual void RevertAlignToPrincipalAxes() = 0;
84 virtual void Convert(Mesh& mesh, const VOXEL_VALUE value) const = 0;
85 const Mesh& GetConvexHull() const { return m_convexHull; };
87
88private:
90};
91
93class VoxelSet : public PrimitiveSet
94{
95 friend class Volume;
96
97public:
99 ~VoxelSet() = default;
101 VoxelSet();
102
103 size_t GetNPrimitives() const override { return m_voxels.Size(); }
104 size_t GetNPrimitivesOnSurf() const override { return m_numVoxelsOnSurface; }
105 size_t GetNPrimitivesInsideSurf() const override { return m_numVoxelsInsideSurface; }
106 double GetEigenValue(AXIS axis) const override { return m_D[axis][axis]; }
107 double ComputeVolume() const override { return m_unitVolume * static_cast<double>(m_voxels.Size()); }
108 double ComputeMaxVolumeError() const override { return m_unitVolume * static_cast<double>(m_numVoxelsOnSurface); }
109 const Vec3<short>& GetMinBBVoxels() const { return m_minBBVoxels; }
110 const Vec3<short>& GetMaxBBVoxels() const { return m_maxBBVoxels; }
111 const Vec3<double>& GetMinBB() const { return m_minBB; }
112 const double& GetScale() const { return m_scale; }
113 const double& GetUnitVolume() const { return m_unitVolume; }
115 {
116 return Vec3<double>(
117 voxel[0] * m_scale + m_minBB[0], voxel[1] * m_scale + m_minBB[1], voxel[2] * m_scale + m_minBB[2]);
118 }
119 Vec3<double> GetPoint(const Voxel& voxel) const
120 {
121 return Vec3<double>(voxel.m_coord[0] * m_scale + m_minBB[0],
122 voxel.m_coord[1] * m_scale + m_minBB[1],
123 voxel.m_coord[2] * m_scale + m_minBB[2]);
124 }
126 {
127 return Vec3<double>(
128 voxel[0] * m_scale + m_minBB[0], voxel[1] * m_scale + m_minBB[1], voxel[2] * m_scale + m_minBB[2]);
129 }
130 void GetPoints(const Voxel& voxel, Vec3<double>* const pts) const;
131 void ComputeConvexHull(Mesh& meshCH, const size_t sampling = 1) const override;
132 void Clip(const Plane& plane, PrimitiveSet* const positivePart, PrimitiveSet* const negativePart) const override;
133 void Intersect(const Plane& plane,
134 SArray<Vec3<double> >* const positivePts,
135 SArray<Vec3<double> >* const negativePts,
136 const size_t sampling) const override;
138 const Mesh& mesh,
139 SArray<Vec3<double> >* const exteriorPts) const override;
140 void ComputeClippedVolumes(const Plane& plane, double& positiveVolume, double& negativeVolume) const override;
141 void SelectOnSurface(PrimitiveSet* const onSurfP) const override;
142 void ComputeBB() override;
143 void Convert(Mesh& mesh, const VOXEL_VALUE value) const override;
144 void ComputePrincipalAxes() override;
145 PrimitiveSet* Create() const override { return new VoxelSet(); }
146 void AlignToPrincipalAxes() override {}
147 void RevertAlignToPrincipalAxes() override {}
148 Voxel* GetVoxels() { return m_voxels.Data(); }
149 const Voxel* GetVoxels() const { return m_voxels.Data(); }
150
151private:
155 double m_scale;
163 double m_Q[3][3];
164 double m_D[3][3];
166};
167
169{
170public:
172 unsigned char m_data;
173};
174
177{
178 friend class Volume;
179
180public:
182 ~TetrahedronSet(void);
185
186 size_t GetNPrimitives() const override { return m_tetrahedra.Size(); }
187 size_t GetNPrimitivesOnSurf() const override { return m_numTetrahedraOnSurface; }
188 size_t GetNPrimitivesInsideSurf() const override { return m_numTetrahedraInsideSurface; }
189 const Vec3<double>& GetMinBB() const { return m_minBB; }
190 const Vec3<double>& GetMaxBB() const { return m_maxBB; }
191 const Vec3<double>& GetBarycenter() const { return m_barycenter; }
192 double GetEigenValue(AXIS axis) const override { return m_D[axis][axis]; }
193 double GetSacle() const { return m_scale; }
194 double ComputeVolume() const override;
195 double ComputeMaxVolumeError() const override;
196 void ComputeConvexHull(Mesh& meshCH, const size_t sampling = 1) const override;
197 void ComputePrincipalAxes() override;
198 void AlignToPrincipalAxes() override;
199 void RevertAlignToPrincipalAxes() override;
200 void Clip(const Plane& plane, PrimitiveSet* const positivePart, PrimitiveSet* const negativePart) const override;
201 void Intersect(const Plane& plane,
202 SArray<Vec3<double> >* const positivePts,
203 SArray<Vec3<double> >* const negativePts,
204 const size_t sampling) const override;
206 const Mesh& mesh,
207 SArray<Vec3<double> >* const exteriorPts) const override;
208 void ComputeClippedVolumes(const Plane& plane, double& positiveVolume, double& negativeVolume) const override;
209 void SelectOnSurface(PrimitiveSet* const onSurfP) const override;
210 void ComputeBB() override;
211 void Convert(Mesh& mesh, const VOXEL_VALUE value) const override;
212 inline bool Add(Tetrahedron& tetrahedron);
213 PrimitiveSet* Create() const override { return new TetrahedronSet(); }
214 static const double EPS;
215
216private:
217 void AddClippedTetrahedra(const Vec3<double> (&pts)[10], const int32_t nPts);
218
221 double m_scale;
226 double m_Q[3][3];
227 double m_D[3][3];
228};
229
232{
233public:
235 ~Volume(void);
236
238 Volume();
239
241 template <class T>
242 void Voxelize(const T* const points,
243 const uint32_t stridePoints,
244 const uint32_t nPoints,
245 const int32_t* const triangles,
246 const uint32_t strideTriangles,
247 const uint32_t nTriangles,
248 const size_t dim,
249 const Vec3<double>& barycenter,
250 const double (&rot)[3][3]);
251 unsigned char& GetVoxel(const size_t i, const size_t j, const size_t k)
252 {
253 assert(i < m_dim[0]);
254 assert(j < m_dim[1]);
255 assert(k < m_dim[2]);
256 return m_data[i + j * m_dim[0] + k * m_dim[0] * m_dim[1]];
257 }
258 const unsigned char& GetVoxel(const size_t i, const size_t j, const size_t k) const
259 {
260 assert(i < m_dim[0]);
261 assert(j < m_dim[1]);
262 assert(k < m_dim[2]);
263 return m_data[i + j * m_dim[0] + k * m_dim[0] * m_dim[1]];
264 }
267 void Convert(Mesh& mesh, const VOXEL_VALUE value) const;
268 void Convert(VoxelSet& vset) const;
269 void Convert(TetrahedronSet& tset) const;
270 void AlignToPrincipalAxes(double (&rot)[3][3]) const;
271
272private:
273 void FillOutsideSurface(const size_t i0,
274 const size_t j0,
275 const size_t k0,
276 const size_t i1,
277 const size_t j1,
278 const size_t k1);
279 void FillInsideSurface();
280 template <class T>
281 void ComputeBB(const T* const points,
282 const uint32_t stridePoints,
283 const uint32_t nPoints,
284 const Vec3<double>& barycenter,
285 const double (&rot)[3][3]);
286 void Allocate();
287 void Free();
288
291 double m_scale;
292 size_t m_dim[3]; //>! dim
296 unsigned char* m_data;
297};
298int32_t TriBoxOverlap(const Vec3<double>& boxcenter,
299 const Vec3<double>& boxhalfsize,
300 const Vec3<double>& triver0,
301 const Vec3<double>& triver1,
302 const Vec3<double>& triver2);
303template <class T>
304inline void ComputeAlignedPoint(const T* const points,
305 const uint32_t idx,
306 const Vec3<double>& barycenter,
307 const double (&rot)[3][3],
308 Vec3<double>& pt){};
309template <>
310inline void ComputeAlignedPoint<float>(const float* const points,
311 const uint32_t idx,
312 const Vec3<double>& barycenter,
313 const double (&rot)[3][3],
314 Vec3<double>& pt)
315{
316 double x = points[idx + 0] - barycenter[0];
317 double y = points[idx + 1] - barycenter[1];
318 double z = points[idx + 2] - barycenter[2];
319 pt[0] = rot[0][0] * x + rot[1][0] * y + rot[2][0] * z;
320 pt[1] = rot[0][1] * x + rot[1][1] * y + rot[2][1] * z;
321 pt[2] = rot[0][2] * x + rot[1][2] * y + rot[2][2] * z;
322}
323template <>
324inline void ComputeAlignedPoint<double>(const double* const points,
325 const uint32_t idx,
326 const Vec3<double>& barycenter,
327 const double (&rot)[3][3],
328 Vec3<double>& pt)
329{
330 double x = points[idx + 0] - barycenter[0];
331 double y = points[idx + 1] - barycenter[1];
332 double z = points[idx + 2] - barycenter[2];
333 pt[0] = rot[0][0] * x + rot[1][0] * y + rot[2][0] * z;
334 pt[1] = rot[0][1] * x + rot[1][1] * y + rot[2][1] * z;
335 pt[2] = rot[0][2] * x + rot[1][2] * y + rot[2][2] * z;
336}
337template <class T>
338void Volume::ComputeBB(const T* const points,
339 const uint32_t stridePoints,
340 const uint32_t nPoints,
341 const Vec3<double>& barycenter,
342 const double (&rot)[3][3])
343{
344 Vec3<double> pt;
345 ComputeAlignedPoint(points, 0, barycenter, rot, pt);
346 m_maxBB = pt;
347 m_minBB = pt;
348 for (uint32_t v = 1; v < nPoints; ++v)
349 {
350 ComputeAlignedPoint(points, v * stridePoints, barycenter, rot, pt);
351 for (int32_t i = 0; i < 3; ++i)
352 {
353 if (pt[i] < m_minBB[i])
354 m_minBB[i] = pt[i];
355 else if (pt[i] > m_maxBB[i])
356 m_maxBB[i] = pt[i];
357 }
358 }
359}
360template <class T>
361void Volume::Voxelize(const T* const points,
362 const uint32_t stridePoints,
363 const uint32_t nPoints,
364 const int32_t* const triangles,
365 const uint32_t strideTriangles,
366 const uint32_t nTriangles,
367 const size_t dim,
368 const Vec3<double>& barycenter,
369 const double (&rot)[3][3])
370{
371 if (nPoints == 0)
372 {
373 return;
374 }
375 ComputeBB(points, stridePoints, nPoints, barycenter, rot);
376
377 double d[3] = { m_maxBB[0] - m_minBB[0], m_maxBB[1] - m_minBB[1], m_maxBB[2] - m_minBB[2] };
378 double r;
379 if (d[0] >= d[1] && d[0] >= d[2])
380 {
381 r = d[0];
382 m_dim[0] = dim;
383 m_dim[1] = 2 + static_cast<size_t>(dim * d[1] / d[0]);
384 m_dim[2] = 2 + static_cast<size_t>(dim * d[2] / d[0]);
385 }
386 else if (d[1] >= d[0] && d[1] >= d[2])
387 {
388 r = d[1];
389 m_dim[1] = dim;
390 m_dim[0] = 2 + static_cast<size_t>(dim * d[0] / d[1]);
391 m_dim[2] = 2 + static_cast<size_t>(dim * d[2] / d[1]);
392 }
393 else
394 {
395 r = d[2];
396 m_dim[2] = dim;
397 m_dim[0] = 2 + static_cast<size_t>(dim * d[0] / d[2]);
398 m_dim[1] = 2 + static_cast<size_t>(dim * d[1] / d[2]);
399 }
400
401 m_scale = r / (dim - 1);
402 double invScale = (dim - 1) / r;
403
404 Allocate();
408
409 Vec3<double> p[3];
410 size_t i, j, k;
411 size_t i0, j0, k0;
412 size_t i1, j1, k1;
413 Vec3<double> boxcenter;
414 Vec3<double> pt;
415 const Vec3<double> boxhalfsize(0.5, 0.5, 0.5);
416 for (size_t t = 0, ti = 0; t < nTriangles; ++t, ti += strideTriangles)
417 {
418 Vec3<int32_t> tri(triangles[ti + 0], triangles[ti + 1], triangles[ti + 2]);
419 for (int32_t c = 0; c < 3; ++c)
420 {
421 ComputeAlignedPoint(points, tri[c] * stridePoints, barycenter, rot, pt);
422 p[c][0] = (pt[0] - m_minBB[0]) * invScale;
423 p[c][1] = (pt[1] - m_minBB[1]) * invScale;
424 p[c][2] = (pt[2] - m_minBB[2]) * invScale;
425 i = static_cast<size_t>(p[c][0] + 0.5);
426 j = static_cast<size_t>(p[c][1] + 0.5);
427 k = static_cast<size_t>(p[c][2] + 0.5);
428 assert(i < m_dim[0] && i >= 0 && j < m_dim[1] && j >= 0 && k < m_dim[2] && k >= 0);
429
430 if (c == 0)
431 {
432 i0 = i1 = i;
433 j0 = j1 = j;
434 k0 = k1 = k;
435 }
436 else
437 {
438 if (i < i0)
439 i0 = i;
440 if (j < j0)
441 j0 = j;
442 if (k < k0)
443 k0 = k;
444 if (i > i1)
445 i1 = i;
446 if (j > j1)
447 j1 = j;
448 if (k > k1)
449 k1 = k;
450 }
451 }
452 if (i0 > 0)
453 --i0;
454 if (j0 > 0)
455 --j0;
456 if (k0 > 0)
457 --k0;
458 if (i1 < m_dim[0])
459 ++i1;
460 if (j1 < m_dim[1])
461 ++j1;
462 if (k1 < m_dim[2])
463 ++k1;
464 for (size_t i = i0; i < i1; ++i)
465 {
466 boxcenter[0] = (double)i;
467 for (size_t j = j0; j < j1; ++j)
468 {
469 boxcenter[1] = (double)j;
470 for (size_t k = k0; k < k1; ++k)
471 {
472 boxcenter[2] = (double)k;
473 int32_t res = TriBoxOverlap(boxcenter, boxhalfsize, p[0], p[1], p[2]);
474 unsigned char& value = GetVoxel(i, j, k);
475 if (res == 1 && value == PRIMITIVE_UNDEFINED)
476 {
479 }
480 }
481 }
482 }
483 }
484 FillOutsideSurface(0, 0, 0, m_dim[0], m_dim[1], 1);
485 FillOutsideSurface(0, 0, m_dim[2] - 1, m_dim[0], m_dim[1], m_dim[2]);
486 FillOutsideSurface(0, 0, 0, m_dim[0], 1, m_dim[2]);
487 FillOutsideSurface(0, m_dim[1] - 1, 0, m_dim[0], m_dim[1], m_dim[2]);
488 FillOutsideSurface(0, 0, 0, 1, m_dim[1], m_dim[2]);
489 FillOutsideSurface(m_dim[0] - 1, 0, 0, m_dim[0], m_dim[1], m_dim[2]);
491}
492} // namespace VHACD
493} // namespace tesseract_collision
494
495#ifdef _MSC_VER
496#pragma warning(pop)
497#endif
498
Triangular mesh data structure.
Definition: vhacdMesh.h:80
Definition: vhacdVolume.h:59
virtual void Intersect(const Plane &plane, SArray< Vec3< double > > *const positivePts, SArray< Vec3< double > > *const negativePts, const size_t sampling) const =0
virtual size_t GetNPrimitives() const =0
virtual double ComputeVolume() const =0
virtual size_t GetNPrimitivesOnSurf() const =0
virtual void Convert(Mesh &mesh, const VOXEL_VALUE value) const =0
virtual void ComputeConvexHull(Mesh &meshCH, const size_t sampling=1) const =0
virtual size_t GetNPrimitivesInsideSurf() const =0
virtual void Clip(const Plane &plane, PrimitiveSet *const positivePart, PrimitiveSet *const negativePart) const =0
virtual double GetEigenValue(AXIS axis) const =0
const Mesh & GetConvexHull() const
Definition: vhacdVolume.h:85
Mesh & GetConvexHull()
Definition: vhacdVolume.h:86
virtual double ComputeMaxVolumeError() const =0
virtual void ComputeExteriorPoints(const Plane &plane, const Mesh &mesh, SArray< Vec3< double > > *const exteriorPts) const =0
virtual ~PrimitiveSet()
Definition: vhacdVolume.h:61
virtual void SelectOnSurface(PrimitiveSet *const onSurfP) const =0
virtual void ComputeClippedVolumes(const Plane &plane, double &positiveVolume, double &negativeVolume) const =0
virtual PrimitiveSet * Create() const =0
Mesh m_convexHull
Definition: vhacdVolume.h:89
SArray.
Definition: vhacdSArray.h:42
Definition: vhacdVolume.h:177
Vec3< double > m_maxBB
Definition: vhacdVolume.h:223
Vec3< double > m_minBB
Definition: vhacdVolume.h:222
void Convert(Mesh &mesh, const VOXEL_VALUE value) const override
Definition: vhacdVolume.cpp:1672
void Intersect(const Plane &plane, SArray< Vec3< double > > *const positivePts, SArray< Vec3< double > > *const negativePts, const size_t sampling) const override
Definition: vhacdVolume.cpp:1502
size_t m_numTetrahedraInsideSurface
Definition: vhacdVolume.h:220
const Vec3< double > & GetBarycenter() const
Definition: vhacdVolume.h:191
double m_scale
Definition: vhacdVolume.h:221
double ComputeVolume() const override
Definition: vhacdVolume.cpp:1694
size_t GetNPrimitivesInsideSurf() const override
Definition: vhacdVolume.h:188
double ComputeMaxVolumeError() const override
Definition: vhacdVolume.cpp:1708
SArray< Tetrahedron, 8 > m_tetrahedra
Definition: vhacdVolume.h:225
static const double EPS
Definition: vhacdVolume.h:214
double m_Q[3][3]
Definition: vhacdVolume.h:226
~TetrahedronSet(void)
Destructor.
Definition: vhacdVolume.cpp:1167
void AlignToPrincipalAxes() override
Definition: vhacdVolume.cpp:1781
void Clip(const Plane &plane, PrimitiveSet *const positivePart, PrimitiveSet *const negativePart) const override
Definition: vhacdVolume.cpp:1557
const Vec3< double > & GetMaxBB() const
Definition: vhacdVolume.h:190
Vec3< double > m_barycenter
Definition: vhacdVolume.h:224
const Vec3< double > & GetMinBB() const
Definition: vhacdVolume.h:189
void ComputePrincipalAxes() override
Definition: vhacdVolume.cpp:1746
void ComputeExteriorPoints(const Plane &plane, const Mesh &mesh, SArray< Vec3< double > > *const exteriorPts) const override
Definition: vhacdVolume.cpp:1511
size_t GetNPrimitives() const override
Definition: vhacdVolume.h:186
void RevertAlignToPrincipalAxes() override
Definition: vhacdVolume.cpp:1725
bool Add(Tetrahedron &tetrahedron)
Definition: vhacdVolume.cpp:1266
double m_D[3][3]
Definition: vhacdVolume.h:227
double GetSacle() const
Definition: vhacdVolume.h:193
PrimitiveSet * Create() const override
Definition: vhacdVolume.h:213
TetrahedronSet()
Constructor.
Definition: vhacdVolume.cpp:1156
size_t m_numTetrahedraOnSurface
Definition: vhacdVolume.h:219
void ComputeBB() override
Definition: vhacdVolume.cpp:1168
double GetEigenValue(AXIS axis) const override
Definition: vhacdVolume.h:192
void ComputeClippedVolumes(const Plane &plane, double &positiveVolume, double &negativeVolume) const override
Definition: vhacdVolume.cpp:1516
void AddClippedTetrahedra(const Vec3< double >(&pts)[10], const int32_t nPts)
Definition: vhacdVolume.cpp:1294
void ComputeConvexHull(Mesh &meshCH, const size_t sampling=1) const override
Definition: vhacdVolume.cpp:1195
size_t GetNPrimitivesOnSurf() const override
Definition: vhacdVolume.h:187
void SelectOnSurface(PrimitiveSet *const onSurfP) const override
Definition: vhacdVolume.cpp:1525
Vector dim 3.
Definition: vhacdVector.h:37
Definition: vhacdVolume.h:232
size_t GetNPrimitivesOnSurf() const
Definition: vhacdVolume.h:265
void Voxelize(const T *const points, const uint32_t stridePoints, const uint32_t nPoints, const int32_t *const triangles, const uint32_t strideTriangles, const uint32_t nTriangles, const size_t dim, const Vec3< double > &barycenter, const double(&rot)[3][3])
Voxelize.
Definition: vhacdVolume.h:361
void FillInsideSurface()
Definition: vhacdVolume.cpp:906
void AlignToPrincipalAxes(double(&rot)[3][3]) const
Definition: vhacdVolume.cpp:1100
Vec3< double > m_maxBB
Definition: vhacdVolume.h:290
size_t m_numVoxelsOnSurface
Definition: vhacdVolume.h:293
void Convert(Mesh &mesh, const VOXEL_VALUE value) const
Definition: vhacdVolume.cpp:927
void Free()
Definition: vhacdVolume.cpp:849
size_t m_numVoxelsInsideSurface
Definition: vhacdVolume.h:294
void FillOutsideSurface(const size_t i0, const size_t j0, const size_t k0, const size_t i1, const size_t j1, const size_t k1)
Definition: vhacdVolume.cpp:854
size_t m_numVoxelsOutsideSurface
Definition: vhacdVolume.h:295
Vec3< double > m_minBB
Definition: vhacdVolume.h:289
double m_scale
Definition: vhacdVolume.h:291
size_t GetNPrimitivesInsideSurf() const
Definition: vhacdVolume.h:266
unsigned char & GetVoxel(const size_t i, const size_t j, const size_t k)
Definition: vhacdVolume.h:251
size_t m_dim[3]
Definition: vhacdVolume.h:292
void ComputeBB(const T *const points, const uint32_t stridePoints, const uint32_t nPoints, const Vec3< double > &barycenter, const double(&rot)[3][3])
Definition: vhacdVolume.h:338
~Volume(void)
Destructor.
Definition: vhacdVolume.cpp:841
Volume()
Constructor.
Definition: vhacdVolume.cpp:830
void Allocate()
Definition: vhacdVolume.cpp:842
const unsigned char & GetVoxel(const size_t i, const size_t j, const size_t k) const
Definition: vhacdVolume.h:258
unsigned char * m_data
Definition: vhacdVolume.h:296
Definition: vhacdVolume.h:94
const Vec3< short > & GetMaxBBVoxels() const
Definition: vhacdVolume.h:110
void AlignToPrincipalAxes() override
Definition: vhacdVolume.h:146
Vec3< short > m_minBBVoxels
Definition: vhacdVolume.h:160
size_t m_numVoxelsOnSurface
Definition: vhacdVolume.h:152
const double & GetScale() const
Definition: vhacdVolume.h:112
double m_unitVolume
Definition: vhacdVolume.h:157
size_t m_numVoxelsInsideSurface
Definition: vhacdVolume.h:153
void ComputeExteriorPoints(const Plane &plane, const Mesh &mesh, SArray< Vec3< double > > *const exteriorPts) const override
Definition: vhacdVolume.cpp:620
void ComputePrincipalAxes() override
Definition: vhacdVolume.cpp:789
void ComputeClippedVolumes(const Plane &plane, double &positiveVolume, double &negativeVolume) const override
Definition: vhacdVolume.cpp:649
size_t GetNPrimitivesInsideSurf() const override
Definition: vhacdVolume.h:105
double ComputeVolume() const override
Definition: vhacdVolume.h:107
Vec3< double > m_maxBBPts
Definition: vhacdVolume.h:159
Vec3< double > m_minBBPts
Definition: vhacdVolume.h:158
void GetPoints(const Voxel &voxel, Vec3< double > *const pts) const
Definition: vhacdVolume.cpp:518
PrimitiveSet * Create() const override
Definition: vhacdVolume.h:145
VoxelSet()
Constructor.
Definition: vhacdVolume.cpp:389
Voxel * GetVoxels()
Definition: vhacdVolume.h:148
double ComputeMaxVolumeError() const override
Definition: vhacdVolume.h:108
SArray< Voxel, 8 > m_voxels
Definition: vhacdVolume.h:156
void Intersect(const Plane &plane, SArray< Vec3< double > > *const positivePts, SArray< Vec3< double > > *const negativePts, const size_t sampling) const override
Definition: vhacdVolume.cpp:548
Vec3< double > m_minBB
Definition: vhacdVolume.h:154
Vec3< double > GetPoint(Vec3< double > voxel) const
Definition: vhacdVolume.h:125
double m_Q[3][3]
Definition: vhacdVolume.h:163
void Convert(Mesh &mesh, const VOXEL_VALUE value) const override
Definition: vhacdVolume.cpp:756
const Vec3< double > & GetMinBB() const
Definition: vhacdVolume.h:111
const Vec3< short > & GetMinBBVoxels() const
Definition: vhacdVolume.h:109
Vec3< double > GetPoint(Vec3< short > voxel) const
Definition: vhacdVolume.h:114
Vec3< short > m_barycenter
Definition: vhacdVolume.h:162
void RevertAlignToPrincipalAxes() override
Definition: vhacdVolume.h:147
Vec3< short > m_maxBBVoxels
Definition: vhacdVolume.h:161
size_t GetNPrimitivesOnSurf() const override
Definition: vhacdVolume.h:104
size_t GetNPrimitives() const override
Definition: vhacdVolume.h:103
const Voxel * GetVoxels() const
Definition: vhacdVolume.h:149
const double & GetUnitVolume() const
Definition: vhacdVolume.h:113
void ComputeConvexHull(Mesh &meshCH, const size_t sampling=1) const override
Definition: vhacdVolume.cpp:436
Vec3< double > GetPoint(const Voxel &voxel) const
Definition: vhacdVolume.h:119
Vec3< double > m_barycenterPCA
Definition: vhacdVolume.h:165
double m_scale
Definition: vhacdVolume.h:155
void Clip(const Plane &plane, PrimitiveSet *const positivePart, PrimitiveSet *const negativePart) const override
Definition: vhacdVolume.cpp:696
void ComputeBB() override
Definition: vhacdVolume.cpp:406
double GetEigenValue(AXIS axis) const override
Definition: vhacdVolume.h:106
double m_D[3][3]
Definition: vhacdVolume.h:164
void SelectOnSurface(PrimitiveSet *const onSurfP) const override
Definition: vhacdVolume.cpp:669
Definition: polygon_mesh.h:46
Common Tesseract Macros.
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
Definition: create_convex_hull.cpp:36
VOXEL_VALUE
Definition: vhacdVolume.h:44
@ PRIMITIVE_OUTSIDE_SURFACE
Definition: vhacdVolume.h:46
@ PRIMITIVE_UNDEFINED
Definition: vhacdVolume.h:45
@ PRIMITIVE_INSIDE_SURFACE
Definition: vhacdVolume.h:47
@ PRIMITIVE_ON_SURFACE
Definition: vhacdVolume.h:48
int32_t TriBoxOverlap(const Vec3< double > &boxcenter, const Vec3< double > &boxhalfsize, const Vec3< double > &triver0, const Vec3< double > &triver1, const Vec3< double > &triver2)
Definition: vhacdVolume.cpp:200
void ComputeAlignedPoint(const T *const points, const uint32_t idx, const Vec3< double > &barycenter, const double(&rot)[3][3], Vec3< double > &pt)
Definition: vhacdVolume.h:304
void ComputeAlignedPoint< float >(const float *const points, const uint32_t idx, const Vec3< double > &barycenter, const double(&rot)[3][3], Vec3< double > &pt)
Definition: vhacdVolume.h:310
AXIS
Definition: vhacdMesh.h:37
void ComputeAlignedPoint< double >(const double *const points, const uint32_t idx, const Vec3< double > &barycenter, const double(&rot)[3][3], Vec3< double > &pt)
Definition: vhacdVolume.h:324
Definition: bullet_cast_bvh_manager.h:49
Definition: vhacdMesh.h:43
Definition: vhacdVolume.h:169
unsigned char m_data
Definition: vhacdVolume.h:172
Vec3< double > m_pts[4]
Definition: vhacdVolume.h:171
Definition: vhacdVolume.h:52
short m_data
Definition: vhacdVolume.h:55
short m_coord[3]
Definition: vhacdVolume.h:54
object value
Definition: tesseract_common_serialization_unit.cpp:495
v
Definition: tesseract_common_unit.cpp:369
auto plane
Definition: tesseract_geometry_unit.cpp:22
auto mesh
Definition: tesseract_geometry_unit.cpp:25
JointDynamics j
Definition: tesseract_scene_graph_joint_unit.cpp:15
object axis
Definition: tesseract_scene_graph_serialization_unit.cpp:81