18#include "Topology/TriangleSet.h"
26 typedef unsigned long long int OcKey;
27 typedef unsigned short Level;
39 key |= (x & mask << i) << 2 * i | (y & mask << i) << (2 * i + 1) | (z & mask << i) << (2 * i + 2);
51 OcKey x_buf = ((key >> 3 * i) & 1U) << i;
52 OcKey y_buf = ((key >> (3 * i + 1)) & 1U) << i;
53 OcKey z_buf = ((key >> (3 * i + 2)) & 1U) << i;
61 template<
typename TCoord>
103 template<
typename TCoord>
110 for (
int i = 0; i < 6; i++)
116 template<
typename TCoord>
123 for (
int i = 0; i < 6; i++)
129 template<
typename TCoord>
138 for (
int i = 0; i < 6; i++)
144 template<
typename TCoord>
153 for (
int i = 0; i < 6; i++)
159 template<
typename TCoord>
173 template<
typename TCoord>
189 template<
typename TCoord>
198 template<
typename TDataType>
203 typedef typename TDataType::Real
Real;
204 typedef typename TDataType::Coord
Coord;
234 int top_nx =
m_nx / top_index;
235 int top_ny =
m_ny / top_index;
236 int top_nz =
m_nz / top_index;
237 int top_level_start =
m_octree.size() - top_nx * top_ny*top_nz;
239 int i_top = std::floor(point_i / top_index);
240 int j_top = std::floor(point_j / top_index);
241 int k_top = std::floor(point_k / top_index);
243 int point_index = i_top + j_top * top_nx + k_top * top_nx*top_ny;
245 id = top_level_start + point_index;
250 int l_this = node.
level();
251 int i_this = std::floor(point_i /
pow(
Real(2),
int(l_this - 1)));
252 int j_this = std::floor(point_j /
pow(
Real(2),
int(l_this - 1)));
253 int k_this = std::floor(point_k /
pow(
Real(2),
int(l_this - 1)));
255 int gIndex = key_this & 7U;
257 int child_index = node.
child();
258 id = child_index + (7 - gIndex);
259 node =
m_octree[child_index + (7 - gIndex)];
296 bool inverted =
false);
306 bool inverted =
false);
#define DECLARE_TCLASS(name, T1)
void getSignDistance(DArray< Coord > point_pos, DArray< Real > &point_sdf, DArray< Coord > &point_normal, bool inverted=false)
void getCellVertices(DArray< Coord > &pos)
DYN_FUNC Coord getOrigin()
void getLeafsValue(DArray< Coord > &pos, DArray< Real > &val)
DYN_FUNC void getGrid(int &nx, int &ny, int &nz)
DArrayList< int > & getNeighbors()
void getLeafs(DArray< Coord > &pos, DArray< int > &pos_pos)
DArray< VoxelOctreeNode< Coord > > & getVoxelOctree()
DArray< Real > & getSdfValues()
DYN_FUNC void setLevel0(int level0)
GPU_FUNC void getNode(int point_i, int point_j, int point_k, VoxelOctreeNode< Coord > &node_index, int &id)
DYN_FUNC void setGrid(int nx, int ny, int nz)
void getCellVertices0(DArray< Coord > &pos)
DYN_FUNC int getLevelNum()
DYN_FUNC uint size() const
DArray< VoxelOctreeNode< Coord > > m_octree
DYN_FUNC void setDx(Real dx)
void getSignDistanceMLS(DArray< Coord > point_pos, DArray< Real > &point_sdf, DArray< Coord > &point_normal, bool inverted=false)
DArrayList< int > m_neighbors
GPU_FUNC VoxelOctreeNode< Coord > & operator[](unsigned int id)
void setSdfValues(DArray< Real > &vals)
DYN_FUNC Coord getTopOrigin()
void getCellVertices1(DArray< Coord > &pos)
void getCellVertices2(DArray< Coord > &pos)
void setVoxelOctree(DArray< VoxelOctreeNode< Coord > > &oct)
DYN_FUNC void setLevelNum(int num)
void getSignDistanceKernel(DArray< Coord > point_pos, DArray< Real > &point_sdf)
DYN_FUNC void setOrigin(Coord origin)
DYN_FUNC VoxelOctreeNode()
DYN_FUNC bool midside() const
DYN_FUNC void setLevel(Level lev)
DYN_FUNC TCoord position() const
DYN_FUNC OcKey key() const
DYN_FUNC bool isContainedStrictlyIn(const VoxelOctreeNode< TCoord > &) const
DYN_FUNC void plusChildIndex(int id)
DYN_FUNC void setKey(OcKey key)
DYN_FUNC int child() const
DYN_FUNC void setChildIndex(int id)
DYN_FUNC void setValueLocation(int id)
DYN_FUNC void setMidsideNode()
DYN_FUNC void setPosition(TCoord pos)
DYN_FUNC int value() const
DYN_FUNC bool operator>(const VoxelOctreeNode< TCoord > &) const
DYN_FUNC Level level() const
This is an implementation of AdditiveCCD based on peridyno.
Array< T, DeviceType::GPU > DArray
DYN_FUNC Complex< Real > pow(const Complex< Real > &, const Real &)
static DYN_FUNC void RecoverFromMortonCode(OcKey key, OcIndex &x, OcIndex &y, OcIndex &z)
static DYN_FUNC OcKey CalculateMortonCode(OcIndex x, OcIndex y, OcIndex z)
ArrayList< ElementType, DeviceType::GPU > DArrayList
unsigned long long int OcKey