mirror of https://github.com/CGAL/cgal
Fix bitset checks and type consistency
This commit is contained in:
parent
2d8b0e4d03
commit
61e435c9c6
|
|
@ -84,7 +84,7 @@ int main(int argc, char** argv)
|
||||||
std::cout << "Output #vertices: " << points.size() << std::endl;
|
std::cout << "Output #vertices: " << points.size() << std::endl;
|
||||||
std::cout << "Output #triangles: " << triangles.size() << std::endl;
|
std::cout << "Output #triangles: " << triangles.size() << std::endl;
|
||||||
std::cout << "Elapsed time: " << timer.time() << " seconds" << std::endl;
|
std::cout << "Elapsed time: " << timer.time() << " seconds" << std::endl;
|
||||||
CGAL::IO::write_polygon_soup("marching_cubes.off", points, triangles);
|
CGAL::IO::write_polygon_soup("marching_cubes_TMC.off", points, triangles);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Done" << std::endl;
|
std::cout << "Done" << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -278,13 +278,18 @@ public:
|
||||||
CGAL_precondition(m_domain.cell_vertices(cell).size() == 8);
|
CGAL_precondition(m_domain.cell_vertices(cell).size() == 8);
|
||||||
CGAL_precondition(m_domain.cell_edges(cell).size() == 12);
|
CGAL_precondition(m_domain.cell_edges(cell).size() == 12);
|
||||||
|
|
||||||
std::array<FT, 8> values;
|
// @todo for SDFs, we could query at the center of the voxel an early exit
|
||||||
std::array<Point_3, 8> corners;
|
|
||||||
const int i_case = get_cell_corners(m_domain, cell, m_isovalue, corners, values);
|
constexpr std::size_t vpc = Domain::VERTICES_PER_CELL;
|
||||||
|
|
||||||
|
std::array<FT, vpc> values;
|
||||||
|
std::array<Point_3, vpc> corners;
|
||||||
|
const std::size_t i_case = get_cell_corners(m_domain, cell, m_isovalue, corners, values);
|
||||||
|
|
||||||
// skip empty cells
|
// skip empty cells
|
||||||
const int all_bits_set = (1 << (8 + 1)) - 1; // last 8 bits are 1
|
constexpr std::size_t ones = (1 << vpc) - 1;
|
||||||
if(i_case == 0 || i_case == all_bits_set)
|
if((i_case & ones) == ones || // all bits set
|
||||||
|
(i_case & ones) == 0) // no bits set
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::array<Point_3, 12> vertices;
|
std::array<Point_3, 12> vertices;
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ public:
|
||||||
{
|
{
|
||||||
std::array<FT, 8> values;
|
std::array<FT, 8> values;
|
||||||
std::array<Point_3, 8> corners;
|
std::array<Point_3, 8> corners;
|
||||||
const int i_case = get_cell_corners(m_domain, cell, m_isovalue, corners, values);
|
const std::size_t i_case = get_cell_corners(m_domain, cell, m_isovalue, corners, values);
|
||||||
|
|
||||||
// this is the only difference to mc
|
// this is the only difference to mc
|
||||||
const int tcm = Cube_table::t_ambig[i_case];
|
const int tcm = Cube_table::t_ambig[i_case];
|
||||||
|
|
@ -142,8 +142,9 @@ public:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr int all_bits_set = (1 << (8 + 1)) - 1; // last 8 bits are 1
|
constexpr std::size_t ones = (1 << 8) - 1;
|
||||||
if(i_case == 0 || i_case == all_bits_set)
|
if((i_case & ones) == ones || // all bits set
|
||||||
|
(i_case & ones) == 0) // no bits set
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::array<Point_3, 12> vertices;
|
std::array<Point_3, 12> vertices;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue