9 #ifndef SE_MARCHING_CUBE_HPP 10 #define SE_MARCHING_CUBE_HPP 34 template<
typename OctreeT>
36 const Eigen::Vector3i& source_coord,
37 const Eigen::Vector3i& dest_coord);
39 template<
typename OctreeT>
46 template<
typename BlockT>
48 typename BlockT::DataType data[8],
53 template<
typename OctreeT>
55 typename OctreeT::DataType data[8],
60 template<
typename OctreeT>
62 const typename OctreeT::BlockType* block_ptr,
73 const Eigen::Vector3f& dual_corner_coord_0,
74 const Eigen::Vector3f& dual_corner_coord_1,
75 const float voxel_dim,
78 template<
typename DataT,
typename ValueSelector>
79 inline Eigen::Vector3f
82 const std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f>>&
84 const float voxel_dim,
85 ValueSelector select_value);
99 template<
typename BlockT,
typename DataT>
103 const Eigen::Vector3f& primal_corner_coord_f,
105 std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f>>& dual_corner_coords_f);
129 const int block_size,
130 std::vector<int>& lower_priority_neighbours,
131 std::vector<int>& higher_priority_neighbours,
149 template<
typename OctreeT,
typename DataT>
151 const OctreeT& octree,
152 const typename OctreeT::BlockType* block,
154 const Eigen::Vector3i& primal_corner_coord,
156 std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f>>& dual_corner_coords_f);
158 template<
typename OctreeT,
typename DataT>
160 const OctreeT& octree,
161 const typename OctreeT::BlockType* block_ptr,
163 const Eigen::Vector3i& primal_corner_coord,
164 uint8_t& edge_pattern_idx,
166 std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f>>& dual_corner_coords_f);
168 inline bool checkVertex(
const Eigen::Vector3f& vertex_M,
const float dim);
174 namespace algorithms {
178 template<
typename OctreeT>
180 std::vector<typename OctreeT::BlockType*>& block_ptrs,
183 template<
typename OctreeT>
185 std::vector<typename OctreeT::BlockType*>& block_ptrs,
196 template<
typename OctreeT>
208 template<
typename OctreeT>
218 template<
typename OctreeT>
230 template<
typename OctreeT>
236 #include "impl/marching_cube_impl.hpp" 238 #endif // SE_MARCHING_CUBE_HPP void gather_dual_data(const BlockT *block, const int scale, const Eigen::Vector3f &primal_corner_coord_f, DataT data[8], std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f >> &dual_corner_coords_f)
bool checkVertex(const Eigen::Vector3f &vertex_M, const float dim)
void gather_data(const BlockT *block, typename BlockT::DataType data[8], const int x, const int y, const int z)
Eigen::Vector3f interp_dual_vertexes(const int edge, const DataT data[8], const std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f >> &dual_corner_coords_f, const float voxel_dim, ValueSelector select_value)
void dual_marching_cube_kernel(OctreeT &octree, std::vector< typename OctreeT::BlockType *> &block_ptrs, TriangleMesh &triangles)
void marching_cube(OctreeT &octree, TriangleMesh &triangles, const int frame)
Generate the triangle mesh using a primal grid marching cube algorithm.
void dual_marching_cube(OctreeT &octree, TriangleMesh &triangles, const int frame)
Generate the triangle mesh using a dual grid marching cube algorithm.
Eigen::Vector3f compute_intersection(const OctreeT &octree, const Eigen::Vector3i &source_coord, const Eigen::Vector3i &dest_coord)
Single-res marching cube implementation.
se::OctantBase * block(const Eigen::Vector3i &voxel_coord, OctreeT &octree, se::OctantBase *base_parent_ptr)
Allocate a block at the provided voxel coordinates.
static const Eigen::Vector3f norm_dual_offset_f[8]
Definition: marching_cube.hpp:90
void marching_cube_kernel(OctreeT &octree, std::vector< typename OctreeT::BlockType *> &block_ptrs, TriangleMesh &triangles)
Mesh< Triangle > TriangleMesh
Definition: mesh.hpp:41
Eigen::Vector3f interp_vertexes(const OctreeT &octree, const unsigned x, const unsigned y, const unsigned z, const int edge)
Definition: marching_cube.hpp:28
void neighbours(const se::key_t key, std::array< se::key_t, 26 > neighbour_keys)
TODO: 26-connectivity.
void compute_dual_index(const OctreeT &octree, const typename OctreeT::BlockType *block_ptr, const int scale, const Eigen::Vector3i &primal_corner_coord, uint8_t &edge_pattern_idx, DataT data[8], std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f >> &dual_corner_coords_f)
Definition: marching_cube.hpp:29
static const Eigen::Vector3i logical_dual_offset[8]
Definition: marching_cube.hpp:140
uint8_t compute_index(const OctreeT &octree, const typename OctreeT::BlockType *block_ptr, const unsigned x, const unsigned y, const unsigned z)
Definition: marching_cube.hpp:27
Helper wrapper to allocate and de-allocate octants in the octree.
Definition: colour_utils.hpp:17
void norm_dual_corner_idxs(const Eigen::Vector3i &primal_corner_coord_rel, const int block_size, std::vector< int > &lower_priority_neighbours, std::vector< int > &higher_priority_neighbours, std::vector< std::vector< int >> &neighbours)
The following strategy is derived from I.
static const std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > scale
The colours used for the various integration scales.
Definition: colour_utils.hpp:22
status
Definition: marching_cube.hpp:26
Eigen::Vector3f compute_dual_intersection(const float value_0, const float value_1, const Eigen::Vector3f &dual_corner_coord_0, const Eigen::Vector3f &dual_corner_coord_1, const float voxel_dim, const int)
Multires-res marching cube implementation.