36#pragma warning(disable : 4456 4701)
73 const size_t sampling)
const = 0;
136 const size_t sampling)
const override;
204 const size_t sampling)
const override;
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,
250 const double (&rot)[3][3]);
251 unsigned char&
GetVoxel(
const size_t i,
const size_t j,
const size_t k)
253 assert(i <
m_dim[0]);
255 assert(k <
m_dim[2]);
258 const unsigned char&
GetVoxel(
const size_t i,
const size_t j,
const size_t k)
const
260 assert(i <
m_dim[0]);
262 assert(k <
m_dim[2]);
282 const uint32_t stridePoints,
283 const uint32_t nPoints,
285 const double (&rot)[3][3]);
307 const double (&rot)[3][3],
313 const double (&rot)[3][3],
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;
327 const double (&rot)[3][3],
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;
339 const uint32_t stridePoints,
340 const uint32_t nPoints,
342 const double (&rot)[3][3])
348 for (uint32_t
v = 1;
v < nPoints; ++
v)
351 for (int32_t i = 0; i < 3; ++i)
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,
369 const double (&rot)[3][3])
375 ComputeBB(points, stridePoints, nPoints, barycenter, rot);
379 if (d[0] >= d[1] && d[0] >= d[2])
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]);
386 else if (d[1] >= d[0] && d[1] >= d[2])
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]);
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]);
402 double invScale = (dim - 1) / r;
416 for (
size_t t = 0, ti = 0; t < nTriangles; ++t, ti += strideTriangles)
418 Vec3<int32_t> tri(triangles[ti + 0], triangles[ti + 1], triangles[ti + 2]);
419 for (int32_t
c = 0;
c < 3; ++
c)
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);
464 for (
size_t i = i0; i < i1; ++i)
466 boxcenter[0] = (double)i;
467 for (
size_t j = j0;
j < j1; ++
j)
469 boxcenter[1] = (double)
j;
470 for (
size_t k = k0; k < k1; ++k)
472 boxcenter[2] = (double)k;
473 int32_t res =
TriBoxOverlap(boxcenter, boxhalfsize, p[0], p[1], p[2]);
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 RevertAlignToPrincipalAxes()=0
virtual void Convert(Mesh &mesh, const VOXEL_VALUE value) const =0
virtual void ComputePrincipalAxes()=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 void ComputeBB()=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 void AlignToPrincipalAxes()=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
~VoxelSet()=default
Destructor.
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
#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
Collision::Ptr c
Definition: tesseract_scene_graph_link_unit.cpp:130
object axis
Definition: tesseract_scene_graph_serialization_unit.cpp:81