mirror of https://github.com/CGAL/cgal
Misc minor changes
This commit is contained in:
parent
e1fb8735b4
commit
1f91e3df40
|
|
@ -29,6 +29,8 @@ using Gradients = CGAL::Isosurfacing::Gradient_function_3<Octree>;
|
||||||
using MC_Domain = CGAL::Isosurfacing::Marching_cubes_domain_3<Octree, Values>;
|
using MC_Domain = CGAL::Isosurfacing::Marching_cubes_domain_3<Octree, Values>;
|
||||||
using Domain = CGAL::Isosurfacing::Dual_contouring_domain_3<Octree, Values, Gradients>;
|
using Domain = CGAL::Isosurfacing::Dual_contouring_domain_3<Octree, Values, Gradients>;
|
||||||
|
|
||||||
|
namespace IS = CGAL::Isosurfacing;
|
||||||
|
|
||||||
// Refine one of the octant
|
// Refine one of the octant
|
||||||
struct Refine_one_eighth
|
struct Refine_one_eighth
|
||||||
{
|
{
|
||||||
|
|
@ -114,7 +116,9 @@ int main(int argc, char** argv)
|
||||||
Polygon_range triangles;
|
Polygon_range triangles;
|
||||||
|
|
||||||
// run Dual Contouring
|
// run Dual Contouring
|
||||||
CGAL::Isosurfacing::dual_contouring<CGAL::Parallel_if_available_tag>(domain, isovalue, points, triangles, CGAL::parameters::do_not_triangulate_faces(true));
|
IS::dual_contouring<CGAL::Parallel_if_available_tag>(domain, isovalue, points, triangles,
|
||||||
|
CGAL::parameters::do_not_triangulate_faces(true)
|
||||||
|
.constrain_to_cell(false));
|
||||||
|
|
||||||
// run Marching Cubes
|
// run Marching Cubes
|
||||||
// ToDo: Does not yet work with topologically correct marching cubes
|
// ToDo: Does not yet work with topologically correct marching cubes
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ CGAL::Image_3 convert_grid_to_image(const Grid& grid,
|
||||||
|
|
||||||
// error handling
|
// error handling
|
||||||
if(im == nullptr || im->data == nullptr)
|
if(im == nullptr || im->data == nullptr)
|
||||||
throw std::bad_alloc(); // @todo idk?
|
throw std::bad_alloc();
|
||||||
|
|
||||||
// set min coordinates
|
// set min coordinates
|
||||||
const Point_3& min_p = vertex(grid.span(), 0);
|
const Point_3& min_p = vertex(grid.span(), 0);
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,6 @@ bool cell_position_QEM(const typename Domain::cell_descriptor& c,
|
||||||
Eigen_vector_x v_svd;
|
Eigen_vector_x v_svd;
|
||||||
v_svd = x_hat + svd.solve(rhs - A * x_hat);
|
v_svd = x_hat + svd.solve(rhs - A * x_hat);
|
||||||
|
|
||||||
|
|
||||||
if(constrain_to_cell)
|
if(constrain_to_cell)
|
||||||
{
|
{
|
||||||
// @todo clamping back doesn't necessarily yield the optimal position within the cell
|
// @todo clamping back doesn't necessarily yield the optimal position within the cell
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,8 @@ std::size_t get_cell_corners(const Domain& domain,
|
||||||
// collect function values and build index
|
// collect function values and build index
|
||||||
std::size_t v_id = 0;
|
std::size_t v_id = 0;
|
||||||
std::bitset<Domain::VERTICES_PER_CELL> index = 0;
|
std::bitset<Domain::VERTICES_PER_CELL> index = 0;
|
||||||
|
static_assert(Domain::VERTICES_PER_CELL == 8);
|
||||||
|
|
||||||
for(const vertex_descriptor& v : vertices)
|
for(const vertex_descriptor& v : vertices)
|
||||||
{
|
{
|
||||||
auto val = domain.value(v);
|
auto val = domain.value(v);
|
||||||
|
|
@ -199,7 +201,6 @@ void MC_construct_triangles(const std::size_t i_case,
|
||||||
if(Cube_table::triangle_cases[t_index] == -1)
|
if(Cube_table::triangle_cases[t_index] == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// @todo move more of this stuff into the table
|
|
||||||
const int eg0 = Cube_table::triangle_cases[t_index + 0];
|
const int eg0 = Cube_table::triangle_cases[t_index + 0];
|
||||||
const int eg1 = Cube_table::triangle_cases[t_index + 1];
|
const int eg1 = Cube_table::triangle_cases[t_index + 1];
|
||||||
const int eg2 = Cube_table::triangle_cases[t_index + 2];
|
const int eg2 = Cube_table::triangle_cases[t_index + 2];
|
||||||
|
|
@ -298,7 +299,7 @@ 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);
|
||||||
|
|
||||||
// @todo for SDFs, we could query at the center of the voxel an early exit
|
// @speed for SDFs, we could query at the center of the voxel an early exit
|
||||||
|
|
||||||
constexpr std::size_t vpc = Domain::VERTICES_PER_CELL;
|
constexpr std::size_t vpc = Domain::VERTICES_PER_CELL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -394,7 +394,7 @@ public:
|
||||||
Sequential_tag)
|
Sequential_tag)
|
||||||
{
|
{
|
||||||
for(const edge_descriptor& e : get_leaf_edges(o))
|
for(const edge_descriptor& e : get_leaf_edges(o))
|
||||||
f(e);
|
f(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Functor>
|
template <typename Functor>
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,6 @@ public:
|
||||||
if(Cube_table::triangle_cases[t_index] == -1)
|
if(Cube_table::triangle_cases[t_index] == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// @todo move more of this stuff into the table
|
|
||||||
const int eg0 = Cube_table::triangle_cases[t_index + 0];
|
const int eg0 = Cube_table::triangle_cases[t_index + 0];
|
||||||
const int eg1 = Cube_table::triangle_cases[t_index + 1];
|
const int eg1 = Cube_table::triangle_cases[t_index + 1];
|
||||||
const int eg2 = Cube_table::triangle_cases[t_index + 2];
|
const int eg2 = Cube_table::triangle_cases[t_index + 2];
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
Algebraic_foundations
|
Algebraic_foundations
|
||||||
BGL
|
BGL
|
||||||
Cartesian_kernel
|
|
||||||
CGAL_ImageIO
|
CGAL_ImageIO
|
||||||
|
Cartesian_kernel
|
||||||
Circulator
|
Circulator
|
||||||
Distance_2
|
Distance_2
|
||||||
Distance_3
|
Distance_3
|
||||||
|
|
|
||||||
|
|
@ -522,11 +522,11 @@ public:
|
||||||
compute_cartesian_coordinate(std::uint32_t gc, std::size_t depth, int ci) const
|
compute_cartesian_coordinate(std::uint32_t gc, std::size_t depth, int ci) const
|
||||||
{
|
{
|
||||||
CGAL_assertion(depth <= m_side_per_depth.size());
|
CGAL_assertion(depth <= m_side_per_depth.size());
|
||||||
// an odd coordinate will be first compute at the current depth,
|
// an odd coordinate will be first computed at the current depth,
|
||||||
// while an even coordinate has already been computed at a previous depth.
|
// while an even coordinate has already been computed at a previous depth.
|
||||||
// So while the coordinate is even, we decrease the depth to end up of the first
|
// So while the coordinate is even, we decrease the depth to end up of the first
|
||||||
// non-even coordinate to compute it (with particular case for bbox limits).
|
// non-even coordinate to compute it (with particular case for bbox limits).
|
||||||
// Note that is depth becomes too large, we might end up with incorrect coordinates
|
// Note that if the depth becomes too large, we might end up with incorrect coordinates
|
||||||
// due to rounding errors.
|
// due to rounding errors.
|
||||||
if (gc == (1u << depth)) return (m_bbox.max)()[ci]; // gc == 2^node_depth
|
if (gc == (1u << depth)) return (m_bbox.max)()[ci]; // gc == 2^node_depth
|
||||||
if (gc == 0) return (m_bbox.min)()[ci];
|
if (gc == 0) return (m_bbox.min)()[ci];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue