mirror of https://github.com/CGAL/cgal
add links in user manual about examples, and smooth readability of examples
This commit is contained in:
parent
4f74701eee
commit
f0715a5216
|
|
@ -171,7 +171,7 @@ The following example illustrates how to use the helper function
|
||||||
Delaunay triangulation from a given PLC.
|
Delaunay triangulation from a given PLC.
|
||||||
|
|
||||||
The triangulation is saved in the MEDIT file format, using the
|
The triangulation is saved in the MEDIT file format, using the
|
||||||
\link PkgCDT3IOFunctions CGAL::IO::write_MEDIT() \endlink function.
|
\link PkgCDT3IOFunctions `CGAL::IO::write_MEDIT()` \endlink function.
|
||||||
|
|
||||||
\cgalExample{Constrained_triangulation_3/conforming_constrained_Delaunay_triangulation_3.cpp }
|
\cgalExample{Constrained_triangulation_3/conforming_constrained_Delaunay_triangulation_3.cpp }
|
||||||
|
|
||||||
|
|
@ -191,8 +191,11 @@ If the user already knows the set of polygon identifiers to associate with each
|
||||||
provided and preserved throughout the construction of the conforming constrained Delaunay
|
provided and preserved throughout the construction of the conforming constrained Delaunay
|
||||||
triangulation.
|
triangulation.
|
||||||
|
|
||||||
The following example demonstrates how to detect planar surface patches, remesh them as coarsely
|
The following example demonstrates how to detect planar surface patches and remesh them as coarsely
|
||||||
as possible, and use this segmentation during the tetrahedralization process.
|
as possible using
|
||||||
|
\link CGAL::Polygon_mesh_processing::remesh_planar_patches(const TriangleMeshIn&,PolygonMeshOut&,const NamedParametersIn&,const NamedParametersOut&) `CGAL::Polygon_mesh_processing::remesh_planar_patches()` \endlink
|
||||||
|
from the \ref PkgPolygonMeshProcessing package.
|
||||||
|
The resulting patches and segmentation are then used to build a conforming constrained Delaunay triangulation.
|
||||||
|
|
||||||
When the named parameter `plc_facet_id` is specified, each constrained facet in the 3D triangulation
|
When the named parameter `plc_facet_id` is specified, each constrained facet in the 3D triangulation
|
||||||
is assigned to the corresponding input PLC facet, as identified by the provided property map.
|
is assigned to the corresponding input PLC facet, as identified by the provided property map.
|
||||||
|
|
@ -218,7 +221,8 @@ From left to right: Input PLC;
|
||||||
\subsection CT_3_example_ccdt_region_growing_fimap Build a Conforming Constrained Delaunay Triangulation with Detected Polygon Identifiers
|
\subsection CT_3_example_ccdt_region_growing_fimap Build a Conforming Constrained Delaunay Triangulation with Detected Polygon Identifiers
|
||||||
|
|
||||||
If the user does not know the set of polygon identifiers to associate with each PLC facet, this information can be
|
If the user does not know the set of polygon identifiers to associate with each PLC facet, this information can be
|
||||||
automatically detected using the \link CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces(const PolygonMesh& mesh,RegionMap region_map,const NamedParameters& np) `CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces()`\endlink
|
automatically detected using the
|
||||||
|
\link CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces(const PolygonMesh& mesh,RegionMap region_map,const NamedParameters& np) `CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces()`\endlink
|
||||||
function from the \ref PkgPolygonMeshProcessing package.
|
function from the \ref PkgPolygonMeshProcessing package.
|
||||||
|
|
||||||
The following example demonstrates how to detect planar surface patches and build a conforming
|
The following example demonstrates how to detect planar surface patches and build a conforming
|
||||||
|
|
@ -238,7 +242,7 @@ preconditions are met.
|
||||||
|
|
||||||
\subsubsection CT_3_example_ccdt_autorefinement Autorefinement of the Input Mesh
|
\subsubsection CT_3_example_ccdt_autorefinement Autorefinement of the Input Mesh
|
||||||
|
|
||||||
The following examples shows how autorefinement can be used to preprocess the input mesh,
|
The following example shows how autorefinement can be used to preprocess the input mesh,
|
||||||
when it is self-intersecting.
|
when it is self-intersecting.
|
||||||
|
|
||||||
\cgalExample{Constrained_triangulation_3/ccdt_3_after_autorefinement.cpp }
|
\cgalExample{Constrained_triangulation_3/ccdt_3_after_autorefinement.cpp }
|
||||||
|
|
@ -249,16 +253,21 @@ when it is self-intersecting.
|
||||||
The following example demonstrates how to construct a conforming constrained Delaunay triangulation from
|
The following example demonstrates how to construct a conforming constrained Delaunay triangulation from
|
||||||
an input mesh that is not triangulated and may contain self-intersections.
|
an input mesh that is not triangulated and may contain self-intersections.
|
||||||
|
|
||||||
The function `CGAL::Polygon_mesh_processing::does_self_intersect()` can be used to detect self-intersections,
|
The function
|
||||||
|
\link CGAL::Polygon_mesh_processing::does_self_intersect(const FaceRange&, const TriangleMesh&, const NamedParameters&) `CGAL::Polygon_mesh_processing::does_self_intersect()` \endlink
|
||||||
|
can be used to detect self-intersections,
|
||||||
but it requires the input mesh to be triangulated. Therefore, the input mesh must first be triangulated
|
but it requires the input mesh to be triangulated. Therefore, the input mesh must first be triangulated
|
||||||
using `CGAL::Polygon_mesh_processing::triangulate_faces()` before performing the self-intersection check.
|
using
|
||||||
|
\link CGAL::Polygon_mesh_processing::triangulate_faces(FaceRange,PolygonMesh&,const NamedParameters&) `CGAL::Polygon_mesh_processing::triangulate_faces()`\endlink
|
||||||
|
before performing the self-intersection check.
|
||||||
|
|
||||||
If self-intersections are found, the triangulated mesh is converted into a triangle soup, which can then be
|
If self-intersections are found, the triangulated mesh is converted into a triangle soup, which can then be
|
||||||
processed with `CGAL::Polygon_mesh_processing::autorefine_triangle_soup()` to resolve the self-intersections.
|
processed with
|
||||||
|
\link CGAL::Polygon_mesh_processing::autorefine_triangle_soup(PointRange&,TriangleRange&,const NamedParameters&) `CGAL::Polygon_mesh_processing::autorefine_triangle_soup()`\endlink
|
||||||
|
to resolve the self-intersections.
|
||||||
|
|
||||||
\cgalExample{Constrained_triangulation_3/ccdt_3_preprocessing.cpp }
|
\cgalExample{Constrained_triangulation_3/ccdt_3_preprocessing.cpp }
|
||||||
|
|
||||||
|
|
||||||
\subsection CT_3_example_remesh Remeshing a Conforming Constrained Delaunay Triangulation
|
\subsection CT_3_example_remesh Remeshing a Conforming Constrained Delaunay Triangulation
|
||||||
|
|
||||||
After constructing the triangulation, you can improve its quality or adapt it to a specific sizing
|
After constructing the triangulation, you can improve its quality or adapt it to a specific sizing
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ int main(int argc, char* argv[])
|
||||||
std::cout << "Mesh self-intersects, performing autorefine...\n";
|
std::cout << "Mesh self-intersects, performing autorefine...\n";
|
||||||
|
|
||||||
// use a polygon soup as container as the output will most likely be non-manifold
|
// use a polygon soup as container as the output will most likely be non-manifold
|
||||||
std::vector<K::Point_3> points;
|
std::vector<Point> points;
|
||||||
std::vector<std::vector<std::size_t>> polygons;
|
std::vector<std::vector<std::size_t>> polygons;
|
||||||
PMP::polygon_mesh_to_polygon_soup(mesh, points, polygons);
|
PMP::polygon_mesh_to_polygon_soup(mesh, points, polygons);
|
||||||
PMP::autorefine_triangle_soup(points, polygons);
|
PMP::autorefine_triangle_soup(points, polygons);
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,13 @@ int main(int argc, char* argv[])
|
||||||
std::cout << "Merging facets into coplanar patches..." << std::endl;
|
std::cout << "Merging facets into coplanar patches..." << std::endl;
|
||||||
|
|
||||||
auto number_of_patches = CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces(
|
auto number_of_patches = CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces(
|
||||||
mesh, face_patch_map,
|
mesh,
|
||||||
CGAL::parameters::maximum_distance(bbox_max_span * 1.e-6).maximum_angle(5.));
|
face_patch_map,
|
||||||
for(auto f: faces(mesh)) {
|
CGAL::parameters::maximum_distance(bbox_max_span * 1.e-6)
|
||||||
|
.maximum_angle(5.));
|
||||||
|
|
||||||
|
for(auto f: faces(mesh))
|
||||||
|
{
|
||||||
// if region growing did not assign a patch id, assign one
|
// if region growing did not assign a patch id, assign one
|
||||||
if(get(face_patch_map, f) == static_cast<std::size_t>(-1)) {
|
if(get(face_patch_map, f) == static_cast<std::size_t>(-1)) {
|
||||||
put(face_patch_map, f, number_of_patches++);
|
put(face_patch_map, f, number_of_patches++);
|
||||||
|
|
@ -52,6 +56,7 @@ int main(int argc, char* argv[])
|
||||||
.face_patch_map(face_patch_map));
|
.face_patch_map(face_patch_map));
|
||||||
std::cout << "-- Wrote segmented mesh to \"" << filename << "\"\n";
|
std::cout << "-- Wrote segmented mesh to \"" << filename << "\"\n";
|
||||||
|
|
||||||
|
std::cout << "Creating a conforming constrained Delaunay triangulation...\n";
|
||||||
auto ccdt = CGAL::make_conforming_constrained_Delaunay_triangulation_3(mesh,
|
auto ccdt = CGAL::make_conforming_constrained_Delaunay_triangulation_3(mesh,
|
||||||
CGAL::parameters::plc_facet_id(face_patch_map));
|
CGAL::parameters::plc_facet_id(face_patch_map));
|
||||||
|
|
||||||
|
|
@ -60,6 +65,7 @@ int main(int argc, char* argv[])
|
||||||
<< "Number of constrained facets in the CDT: "
|
<< "Number of constrained facets in the CDT: "
|
||||||
<< ccdt.number_of_constrained_facets() << '\n';
|
<< ccdt.number_of_constrained_facets() << '\n';
|
||||||
|
|
||||||
|
// Write the CDT to a file, with the PLC face ids
|
||||||
filename = argc > 3 ? argv[3] : "out.mesh";
|
filename = argc > 3 ? argv[3] : "out.mesh";
|
||||||
std::ofstream out(filename);
|
std::ofstream out(filename);
|
||||||
out.precision(17);
|
out.precision(17);
|
||||||
|
|
@ -68,4 +74,3 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,13 @@ using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||||
using Mesh = CGAL::Surface_mesh<K::Point_3>;
|
using Mesh = CGAL::Surface_mesh<K::Point_3>;
|
||||||
using face_descriptor = boost::graph_traits<Mesh>::face_descriptor;
|
using face_descriptor = boost::graph_traits<Mesh>::face_descriptor;
|
||||||
|
|
||||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/cross.off");
|
std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/cross.off");
|
||||||
|
|
||||||
Mesh input;
|
Mesh input;
|
||||||
if(!PMP::IO::read_polygon_mesh(filename, input)) {
|
if(!CGAL::Polygon_mesh_processing::IO::read_polygon_mesh(filename, input)) {
|
||||||
std::cerr << "Invalid input." << std::endl;
|
std::cerr << "Invalid input." << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -29,16 +28,20 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
Mesh mesh;
|
Mesh mesh;
|
||||||
auto plc_facet_map = get(CGAL::face_patch_id_t<int>(), mesh);
|
auto plc_facet_map = get(CGAL::face_patch_id_t<int>(), mesh);
|
||||||
PMP::remesh_planar_patches(input, mesh,
|
|
||||||
|
// Remesh planar patches and segment the mesh into planar patches
|
||||||
|
CGAL::Polygon_mesh_processing::remesh_planar_patches(input, mesh,
|
||||||
CGAL::parameters::default_values(),
|
CGAL::parameters::default_values(),
|
||||||
CGAL::parameters::face_patch_map(plc_facet_map)
|
CGAL::parameters::face_patch_map(plc_facet_map)
|
||||||
.do_not_triangulate_faces(true));
|
.do_not_triangulate_faces(true));
|
||||||
|
|
||||||
|
|
||||||
filename = argc > 2 ? argv[2] : "mesh.ply";
|
filename = argc > 2 ? argv[2] : "mesh.ply";
|
||||||
CGAL::IO::write_polygon_mesh(filename, mesh,
|
CGAL::IO::write_polygon_mesh(filename, mesh,
|
||||||
CGAL::parameters::stream_precision(17));
|
CGAL::parameters::stream_precision(17));
|
||||||
std::cout << "Wrote segmented mesh to " << filename << "\n";
|
std::cout << "Wrote segmented mesh to " << filename << "\n";
|
||||||
|
|
||||||
|
// Create a conforming constrained Delaunay triangulation from the mesh
|
||||||
auto ccdt = CGAL::make_conforming_constrained_Delaunay_triangulation_3(mesh,
|
auto ccdt = CGAL::make_conforming_constrained_Delaunay_triangulation_3(mesh,
|
||||||
CGAL::parameters::plc_facet_id(plc_facet_map));
|
CGAL::parameters::plc_facet_id(plc_facet_map));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,8 @@ int main(int argc, char* argv[])
|
||||||
std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/mpi.off");
|
std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/mpi.off");
|
||||||
|
|
||||||
CGAL::Surface_mesh<K::Point_3> mesh;
|
CGAL::Surface_mesh<K::Point_3> mesh;
|
||||||
if(!CGAL::IO::read_polygon_mesh(filename, mesh)) {
|
if(!CGAL::IO::read_polygon_mesh(filename, mesh))
|
||||||
|
{
|
||||||
std::cerr << "Error: cannot read file " << filename << std::endl;
|
std::cerr << "Error: cannot read file " << filename << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +66,8 @@ int main(int argc, char* argv[])
|
||||||
//! [move ccdt to tr]
|
//! [move ccdt to tr]
|
||||||
std::cout << "Number of vertices in tr: " << tr.number_of_vertices() << std::endl;
|
std::cout << "Number of vertices in tr: " << tr.number_of_vertices() << std::endl;
|
||||||
|
|
||||||
CGAL::tetrahedral_isotropic_remeshing(tr, 1.,
|
CGAL::tetrahedral_isotropic_remeshing(tr,
|
||||||
|
1., // target edge length
|
||||||
np::number_of_iterations(3)
|
np::number_of_iterations(3)
|
||||||
.edge_is_constrained_map(constraints_pmap));
|
.edge_is_constrained_map(constraints_pmap));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue