mirror of https://github.com/CGAL/cgal
massaging Isosurfacing examples
rename mesh offset to signed mesh offset
This commit is contained in:
parent
e627a68205
commit
1a50b533c7
|
|
@ -8,7 +8,7 @@ find_package(CGAL REQUIRED)
|
|||
|
||||
create_single_source_cgal_program( "marching_cubes_implicit_sphere.cpp" )
|
||||
create_single_source_cgal_program( "marching_cubes_cartesian_grid_sphere.cpp" )
|
||||
create_single_source_cgal_program( "marching_cubes_mesh_offset.cpp" )
|
||||
create_single_source_cgal_program( "marching_cubes_signed_mesh_offset.cpp" )
|
||||
create_single_source_cgal_program( "marching_cubes_inrimage.cpp" )
|
||||
|
||||
find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater)
|
||||
|
|
@ -37,7 +37,7 @@ include(CGAL_TBB_support)
|
|||
if(TARGET CGAL::TBB_support)
|
||||
target_link_libraries(marching_cubes_implicit_sphere PRIVATE CGAL::TBB_support)
|
||||
target_link_libraries(marching_cubes_cartesian_grid_sphere PRIVATE CGAL::TBB_support)
|
||||
target_link_libraries(marching_cubes_mesh_offset PRIVATE CGAL::TBB_support)
|
||||
target_link_libraries(marching_cubes_signed_mesh_offset PRIVATE CGAL::TBB_support)
|
||||
target_link_libraries(marching_cubes_inrimage PRIVATE CGAL::TBB_support)
|
||||
|
||||
if(TARGET CGAL::Eigen3_support)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ int main() {
|
|||
|
||||
// create bounding box and grid
|
||||
const CGAL::Bbox_3 bbox(-1.0, -1.0, -1.0, 1.0, 1.0, 1.0);
|
||||
std::shared_ptr<Grid> grid = std::make_shar ed<Grid>(30, 30, 30, bbox);
|
||||
std::shared_ptr<Grid> grid = std::make_shared<Grid>(30, 30, 30, bbox);
|
||||
|
||||
// compute field values and gradients
|
||||
for (std::size_t x = 0; x < grid->xdim(); x++) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ int main() {
|
|||
|
||||
// compute loose bounding box of the mesh
|
||||
CGAL::Bbox_3 aabb_grid = CGAL::Polygon_mesh_processing::bbox(mesh_input);
|
||||
const FT loose_offset = offset_value + 0 .01;
|
||||
const FT loose_offset = offset_value + 0.01;
|
||||
Vector aabb_increase_vec = Vector(loose_offset, loose_offset, loose_offset);
|
||||
aabb_grid += (Point(aabb_grid.xmax(), aabb_grid.ymax(), aabb_grid.zmax()) + aabb_increase_vec).bbox();
|
||||
aabb_grid += (Point(aabb_grid.xmin(), aabb_grid.ymin(), aabb_grid.zmin()) - aabb_increase_vec).bbox();
|
||||
|
|
@ -85,13 +85,13 @@ int main() {
|
|||
// create domain from the grid
|
||||
auto domain = CGAL::Isosurfacing::create_explicit_cartesian_grid_domain<Kernel>(grid);
|
||||
|
||||
// prepare collections for output indexed surface mesh
|
||||
// containers for output indexed triangle soup
|
||||
Point_range points;
|
||||
Polygon_range polygons;
|
||||
|
||||
// execute marching cubes with an isovalue equating offset
|
||||
CGAL::Isosurfacing::marching_cubes(domain, offset_value, points, polygons);
|
||||
|
||||
// save output indexed surface mesh to a file, in the OFF format
|
||||
CGAL::IO::write_OFF("result.off", points, polygons);
|
||||
// save output indexed triangle soup to a file, in the OFF format
|
||||
CGAL::IO::write_OFF("output.off", points, polygons);
|
||||
}
|
||||
Loading…
Reference in New Issue