CGAL 5.0.2 - Polygon Mesh Processing
|
Functions to triangulate faces, and to refine and fair regions of a polygon mesh.
Functions | |
template<class InputMesh , class OutputMesh , class BottomFunctor , class TopFunctor , class NamedParameters1 , class NamedParameters2 > | |
void | CGAL::Polygon_mesh_processing::extrude_mesh (const InputMesh &input, OutputMesh &output, const BottomFunctor &bot, const TopFunctor &top, const NamedParameters1 &np_in, const NamedParameters2 &np_out) |
performs a generalized extrusion of input and puts it in output . More... | |
template<class InputMesh , class OutputMesh , class NamedParameters1 , class NamedParameters2 > | |
void | CGAL::Polygon_mesh_processing::extrude_mesh (const InputMesh &input, OutputMesh &output, Vector_3 v, const NamedParameters1 &np_in, const NamedParameters2 &np_out) |
fills output with a closed mesh bounding the volume swept by input when translating its vertices by v . More... | |
template<typename TriangleMesh , typename VertexRange , typename NamedParameters > | |
bool | CGAL::Polygon_mesh_processing::fair (TriangleMesh &tmesh, const VertexRange &vertices, const NamedParameters &np) |
fairs a region on a triangle mesh. More... | |
template<typename VertexRange , typename TriangleMesh , typename NamedParameters > | |
void | CGAL::Polygon_mesh_processing::random_perturbation (VertexRange vertices, TriangleMesh &tmesh, const double &perturbation_max_size, const NamedParameters &np) |
randomly perturbs the locations of vertices of a triangulated surface mesh. More... | |
template<typename TriangleMesh , typename NamedParameters > | |
void | CGAL::Polygon_mesh_processing::random_perturbation (TriangleMesh &tmesh, const double &perturbation_max_size, const NamedParameters &np) |
same as above, but all non-border vertices of tmesh are perturbed. | |
template<typename TriangleMesh , typename FaceRange , typename FaceOutputIterator , typename VertexOutputIterator , typename NamedParameters > | |
std::pair< FaceOutputIterator, VertexOutputIterator > | CGAL::Polygon_mesh_processing::refine (TriangleMesh &tmesh, const FaceRange &faces, FaceOutputIterator faces_out, VertexOutputIterator vertices_out, const NamedParameters &np) |
refines a region of a triangle mesh More... | |
template<typename PolygonMesh , typename FaceRange , typename NamedParameters > | |
void | CGAL::Polygon_mesh_processing::isotropic_remeshing (const FaceRange &faces, const double &target_edge_length, PolygonMesh &pmesh, const NamedParameters &np) |
remeshes a triangulated region of a polygon mesh. More... | |
template<typename PolygonMesh , typename EdgeRange , typename NamedParameters > | |
void | CGAL::Polygon_mesh_processing::split_long_edges (const EdgeRange &edges, const double &max_length, PolygonMesh &pmesh, const NamedParameters &np) |
splits the edges listed in edges into sub-edges that are not longer than the given threshold max_length . More... | |
template<typename TriangleMesh , typename FaceRange , typename NamedParameters > | |
void | CGAL::Polygon_mesh_processing::smooth_mesh (const FaceRange &faces, TriangleMesh &tmesh, const NamedParameters &np) |
smoothes a triangulated region of a polygon mesh. More... | |
template<typename TriangleMesh , typename FaceRange , typename NamedParameters > | |
void | CGAL::Polygon_mesh_processing::smooth_shape (const FaceRange &faces, TriangleMesh &tmesh, const double time, const NamedParameters &np) |
smooths the overall shape of the mesh by using the mean curvature flow. More... | |
template<typename PolygonMesh , typename NamedParameters > | |
bool | CGAL::Polygon_mesh_processing::triangulate_face (typename boost::graph_traits< PolygonMesh >::face_descriptor f, PolygonMesh &pmesh, const NamedParameters &np) |
triangulates a single face of a polygon mesh. More... | |
template<typename FaceRange , typename PolygonMesh , typename NamedParameters > | |
bool | CGAL::Polygon_mesh_processing::triangulate_faces (FaceRange face_range, PolygonMesh &pmesh, const NamedParameters &np) |
triangulates given faces of a polygon mesh. More... | |
template<typename PolygonMesh , typename NamedParameters > | |
bool | CGAL::Polygon_mesh_processing::triangulate_faces (PolygonMesh &pmesh, const NamedParameters &np) |
triangulates all faces of a polygon mesh. More... | |
void CGAL::Polygon_mesh_processing::extrude_mesh | ( | const InputMesh & | input, |
OutputMesh & | output, | ||
const BottomFunctor & | bot, | ||
const TopFunctor & | top, | ||
const NamedParameters1 & | np_in, | ||
const NamedParameters2 & | np_out | ||
) |
#include <CGAL/Polygon_mesh_processing/extrude.h>
performs a generalized extrusion of input
and puts it in output
.
This function extrudes the open surface mesh input
and puts the result in output
. The mesh generated is a closed surface mesh with a bottom and top part, both having the same graph combinatorics as input
(except that the orientation of the faces of the bottom part is reversed). The bottom and the top parts are connected by a triangle strip between boundary cycles. The coordinates of the points associated to the vertices of the bottom and top part are first initialized to the same value as the corresponding vertices of input
. Then for each vertex, a call to bot
and top
is done for the vertices of the bottom part and the top part, respectively.
output
may be self intersecting. InputMesh | a model of FaceListGraph |
OutputMesh | a model of FaceListGraph and MutableFaceGraph |
NamedParameters1 | a sequence of Named Parameters for InputMesh |
NamedParameters2 | a sequence of Named Parameters for OutputMesh |
BottomFunctor | a functor providing void operator()`(boost::graph_traits<InputMesh>::vertex_descriptor input_v,boost::graph_traits<OutputMesh>::vertex_descriptor output_v) output_v is the copy of input_v from input into the bottom part of output . |
TopFunctor | a functor providing a similar operator() as BottomFunctor . |
input | an open surface mesh to extrude. |
output | a surface mesh that will contain the result of the extrusion. |
bot | functor that will transform all points copied from input in order to shape the bottom part of the extrusion. |
top | functor that will transform all points copied from input in order to shape the top part of the extrusion. |
np_in | an optional sequence of Named Parameters among the ones listed below |
vertex_point_map | the property map that contains the points associated to the vertices of input . If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available for the vertices of input |
np_out | an optional sequence of Named Parameters among the ones listed below |
vertex_point_map | the property map that will contain the points associated to the vertices of output . If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available for the vertices of output |
void CGAL::Polygon_mesh_processing::extrude_mesh | ( | const InputMesh & | input, |
OutputMesh & | output, | ||
Vector_3 | v, | ||
const NamedParameters1 & | np_in, | ||
const NamedParameters2 & | np_out | ||
) |
#include <CGAL/Polygon_mesh_processing/extrude.h>
fills output
with a closed mesh bounding the volume swept by input
when translating its vertices by v
.
The mesh is oriented so that the faces corresponding to input
in output
have the same orientation.
output
may be self intersecting. InputMesh | a model of the concept FaceListGraph |
OutputMesh | a model of the concept FaceListGraph and MutableFaceGraph |
Vector_3 | vector type from the same CGAL kernel as the point of the vertex point map used for OutputMesh . |
NamedParameters1 | a sequence of Named Parameters for InputMesh |
NamedParameters2 | a sequence of Named Parameters for OutputMesh |
input | an open surface mesh to extrude. |
output | a surface mesh that will contain the result of the extrusion. |
v | the vector defining the direction of the extrusion |
np_in | an optional sequence of Named Parameters among the ones listed below |
vertex_point_map | the property map that contains the points associated to the vertices of input . If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available for the vertices of input |
np_out | an optional sequence of Named Parameters among the ones listed below |
vertex_point_map | the property map that will contain the points associated to the vertices of output . If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available for the vertices of output |
bool CGAL::Polygon_mesh_processing::fair | ( | TriangleMesh & | tmesh, |
const VertexRange & | vertices, | ||
const NamedParameters & | np | ||
) |
#include <CGAL/Polygon_mesh_processing/fair.h>
fairs a region on a triangle mesh.
The points of the selected vertices are relocated to yield an as-smooth-as-possible surface patch, based on solving a linear bi-Laplacian system with boundary constraints, described in [3]. The optional parameter fairing_continuity
gives the ability to control the tangential continuity C n of the output mesh.
The region described by vertices
might contain multiple disconnected components. Note that the mesh connectivity is not altered in any way, only vertex locations get updated.
Fairing might fail if fixed vertices, which are used as boundary conditions, do not suffice to solve constructed linear system.
Note that if the vertex range to which fairing is applied contains all the vertices of the triangle mesh, fairing does not fail, but the mesh gets shrinked to CGAL::ORIGIN
.
TriangleMesh | a model of FaceGraph and MutableFaceGraph |
VertexRange | a range of vertex descriptors of TriangleMesh , model of Range . Its iterator type is InputIterator . |
NamedParameters | a sequence of Named Parameters |
tmesh | the triangle mesh with patches to be faired |
vertices | the vertices of the patches to be faired (the positions of only those vertices will be changed) |
np | optional sequence of Named Parameters among the ones listed below |
vertex_point_map | the property map with the points associated to the vertices of tmesh . If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in TriangleMesh |
fairing_continuity | tangential continuity of the output surface patch. The larger fairing_continuity gets, the more fixed vertices are required |
sparse_linear_solver | an instance of the sparse linear solver used for fairing |
true
if fairing is successful, otherwise no vertices are relocatedis_triangle_mesh(tmesh)
void CGAL::Polygon_mesh_processing::isotropic_remeshing | ( | const FaceRange & | faces, |
const double & | target_edge_length, | ||
PolygonMesh & | pmesh, | ||
const NamedParameters & | np | ||
) |
#include <CGAL/Polygon_mesh_processing/remesh.h>
remeshes a triangulated region of a polygon mesh.
This operation sequentially performs edge splits, edge collapses, edge flips, tangential relaxation and projection to the initial surface to generate a smooth mesh with a prescribed edge length.
PolygonMesh | model of MutableFaceGraph . The descriptor types boost::graph_traits<PolygonMesh>::face_descriptor and boost::graph_traits<PolygonMesh>::halfedge_descriptor must be models of Hashable . If PolygonMesh has an internal property map for CGAL::face_index_t , and no face_index_map is given as a named parameter, then the internal one must be initialized |
FaceRange | range of boost::graph_traits<PolygonMesh>::face_descriptor , model of Range . Its iterator type is ForwardIterator . |
NamedParameters | a sequence of Named Parameters |
pmesh | a polygon mesh with triangulated surface patches to be remeshed |
faces | the range of triangular faces defining one or several surface patches to be remeshed |
target_edge_length | the edge length that is targeted in the remeshed patch. If 0 is passed then only the edge-flip, tangential relaxation, and projection steps will be done. |
np | optional sequence of Named Parameters among the ones listed below |
target_edge_length
geom_traits | a geometric traits class instance, model of Kernel . Exact constructions kernels are not supported by this function. |
vertex_point_map | the property map with the points associated to the vertices of pmesh . Instance of a class model of ReadWritePropertyMap . |
face_index_map | a property map containing the index of each face of pmesh |
number_of_iterations | the number of iterations for the sequence of atomic operations performed (listed in the above description) |
edge_is_constrained_map | a property map containing the constrained-or-not status of each edge of pmesh . A constrained edge can be split or collapsed, but not flipped, nor its endpoints moved by smoothing. Sub-edges generated by splitting are set to be constrained. Note that patch boundary edges (i.e. incident to only one face in the range) are always considered as constrained edges. |
vertex_is_constrained_map | a property map containing the constrained-or-not status of each vertex of pmesh . A constrained vertex cannot be modified at all during remeshing |
protect_constraints | If true , the edges set as constrained in edge_is_constrained_map (or by default the boundary edges) are not split nor collapsed during remeshing. Note that around constrained edges that have their length higher than twice target_edge_length , remeshing will fail to provide good quality results. It can even fail to terminate because of cascading vertex insertions. |
collapse_constraints | If true , the edges set as constrained in edge_is_constrained_map (or by default the boundary edges) are collapsed during remeshing. This value is ignored if protect_constraints is true; |
face_patch_map | a property map with the patch id's associated to the faces of faces . Instance of a class model of ReadWritePropertyMap . It gets updated during the remeshing process while new faces are created. |
number_of_relaxation_steps | the number of iterations of tangential relaxation that are performed at each iteration of the remeshing process |
relax_constraints | If true , the end vertices of the edges set as constrained in edge_is_constrained_map and boundary edges move along the constrained polylines they belong to. |
do_project | a boolean that sets whether vertices should be reprojected on the input surface after creation or displacement. |
projection_functor | A function object used to project input vertices (moved by the smoothing) and created vertices. It must have Point_3 operator()(vertex_descriptor) , Point_3 being the value type of the vertex point map. If not provided, vertices are projected on the input surface mesh. |
split_long_edges()
void CGAL::Polygon_mesh_processing::random_perturbation | ( | VertexRange | vertices, |
TriangleMesh & | tmesh, | ||
const double & | perturbation_max_size, | ||
const NamedParameters & | np | ||
) |
#include <CGAL/Polygon_mesh_processing/random_perturbation.h>
randomly perturbs the locations of vertices of a triangulated surface mesh.
By default, the vertices are re-projected onto the input surface after perturbation. Note that no geometric checks are done after the perturbation (face orientation might become incorrect and self-intersections might be introduced).
VertexRange | model of Range , holding vertices of type boost::graph_traits<TriangleMesh>::vertex_descriptor . Its iterator type is ForwardIterator . |
TriangleMesh | model of MutableFaceGraph . |
NamedParameters | a sequence of Named Parameters |
vertices | the range of vertices to be perturbed |
tmesh | the triangulated surface mesh |
perturbation_max_size | the maximal length of moves that can be applied to vertices of tmesh . |
np | optional sequence of Named Parameters among the ones listed below |
geom_traits | a geometric traits class instance, model of Kernel . |
vertex_point_map | the property map with the points associated to the vertices of tmesh . Instance of a class model of ReadWritePropertyMap . |
vertex_is_constrained_map | a property map containing the constrained-or-not status of each vertex of tmesh . A constrained vertex cannot be modified at all during perturbation |
do_project | a boolean that sets whether vertices are reprojected on the input surface after their coordinates random perturbation |
random_seed | a non-negative integer value to seed the random number generator, and make the perturbation deterministic |
std::pair<FaceOutputIterator, VertexOutputIterator> CGAL::Polygon_mesh_processing::refine | ( | TriangleMesh & | tmesh, |
const FaceRange & | faces, | ||
FaceOutputIterator | faces_out, | ||
VertexOutputIterator | vertices_out, | ||
const NamedParameters & | np | ||
) |
#include <CGAL/Polygon_mesh_processing/refine.h>
refines a region of a triangle mesh
TriangleMesh | model of MutableFaceGraph |
FaceRange | range of face descriptors, model of Range . Its iterator type is InputIterator . |
FaceOutputIterator | model of OutputIterator holding boost::graph_traits<TriangleMesh>::face_descriptor for patch faces |
VertexOutputIterator | model of OutputIterator holding boost::graph_traits<TriangleMesh>::vertex_descriptor for patch vertices |
NamedParameters | a sequence of Named Parameters |
tmesh | triangle mesh with patches to be refined |
faces | the range of faces defining the patches to refine |
faces_out | output iterator into which descriptors of new faces are recorded |
vertices_out | output iterator into which descriptors of new vertices are recorded |
np | optional sequence of Named Parameters among the ones listed below |
vertex_point_map | the property map with the points associated to the vertices of tmesh Instance of a class model of ReadWritePropertyMap . If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in TriangleMesh |
density_control_factor | factor to control density of the output mesh, where larger values lead to denser refinements. The density of vertices of faces_out is this factor times higher than the vertices of faces. |
faces_out
and vertices_out
is_triangle_mesh(tmesh)
void CGAL::Polygon_mesh_processing::smooth_mesh | ( | const FaceRange & | faces, |
TriangleMesh & | tmesh, | ||
const NamedParameters & | np | ||
) |
#include <CGAL/Polygon_mesh_processing/smooth_mesh.h>
smoothes a triangulated region of a polygon mesh.
This function attempts to make the triangle angle and area distributions as uniform as possible by moving (non-constrained) vertices.
Angle-based smoothing does not change the combinatorial information of the mesh. Area-based smoothing might change the combinatorial information, unless specified otherwise. It is also possible to make the smoothing algorithm "safer" by rejecting moves that, when applied, would worsen the quality of the mesh, e.g. that would decrease the value of the smallest angle around a vertex or create self-intersections.
Optionally, the points are reprojected after each iteration.
TriangleMesh | model of MutableFaceGraph . |
FaceRange | range of boost::graph_traits<TriangleMesh>::face_descriptor , model of Range . Its iterator type is ForwardIterator . |
NamedParameters | a sequence of Named Parameters |
tmesh | a polygon mesh with triangulated surface patches to be smoothed. |
faces | the range of triangular faces defining one or several surface patches to be smoothed. |
np | optional sequence of Named Parameters among the ones listed below. |
use_angle_smoothing | Boolean value to indicate whether angle-based smoothing should be used. Default is true . |
use_area_smoothing | Boolean value to indicate whether area-based smoothing should be used. Default is true . |
number_of_iterations | the number of iterations for the sequence of the smoothing iterations performed (default is 1). |
use_safety_constraints | if true , vertex moves that would worsen the mesh are ignored. Default is false . |
use_Delaunay_flips | if true (default value), area-based smoothing will be completed by a phase of Delaunay-based edge-flips to prevent the creation of elongated triangles. |
do_project | if true (default value), points are projected onto the initial surface after each iteration. |
vertex_is_constrained_map | a property map containing the constrained-or-not status of each vertex of tmesh . A constrained vertex cannot be modified at all during smoothing. |
edge_is_constrained_map | a property map, model of ReadWritePropertyMap , containing the constrained-or-not status of each edge of tmesh . A constrained edge cannot be flipped and its extremities are tagged as constrained vertices. |
vertex_point_map | the property map, model of ReadWritePropertyMap , with the points associated to the vertices of tmesh . |
geom_traits | a geometric traits class instance, model of Kernel . Exact constructions kernels are not supported by this function. |
tmesh
does not contain any degenerate faces void CGAL::Polygon_mesh_processing::smooth_shape | ( | const FaceRange & | faces, |
TriangleMesh & | tmesh, | ||
const double | time, | ||
const NamedParameters & | np | ||
) |
#include <CGAL/Polygon_mesh_processing/smooth_shape.h>
smooths the overall shape of the mesh by using the mean curvature flow.
The effect depends on the curvature of each area and on a time step which represents the amount by which vertices are allowed to move. The result conformally maps the initial surface to a sphere.
TriangleMesh | model of MutableFaceGraph . |
FaceRange | range of boost::graph_traits<TriangleMesh>::face_descriptor , model of Range . Its iterator type is ForwardIterator . |
NamedParameters | a sequence of Named Parameters |
tmesh | a polygon mesh with triangulated surface patches to be smoothed. |
faces | the range of triangular faces defining one or several surface patches to be smoothed. |
time | a time step that corresponds to the speed by which the surface is smoothed. A larger time step results in faster convergence but details may be distorted to have a larger extent compared to more iterations with a smaller step. Typical values scale in the interval (1e-6, 1]. |
np | optional sequence of Named Parameters among the ones listed below. |
vertex_point_map | the property map with the points associated to the vertices of tmesh . Instance of a class model of ReadWritePropertyMap . |
geom_traits | a geometric traits class instance, model of Kernel . |
vertex_is_constrained_map | a property map containing the constrained-or-not status of each vertex of tmesh . A constrained vertex cannot be modified at all during smoothing. |
number_of_iterations | the number of iterations for the sequence of the smoothing iterations performed. Each iteration is performed with the given time step. |
sparse_linear_solver | an instance of the sparse linear solver used for smoothing |
void CGAL::Polygon_mesh_processing::split_long_edges | ( | const EdgeRange & | edges, |
const double & | max_length, | ||
PolygonMesh & | pmesh, | ||
const NamedParameters & | np | ||
) |
#include <CGAL/Polygon_mesh_processing/remesh.h>
splits the edges listed in edges
into sub-edges that are not longer than the given threshold max_length
.
Note this function is useful to split constrained edges before calling isotropic_remeshing()
with protection of constraints activated (to match the constrained edge length required by the remeshing algorithm to be guaranteed to terminate)
PolygonMesh | model of MutableFaceGraph that has an internal property map for CGAL::vertex_point_t . |
EdgeRange | range of boost::graph_traits<PolygonMesh>::edge_descriptor , model of Range . Its iterator type is InputIterator . |
NamedParameters | a sequence of Named Parameters |
pmesh | a polygon mesh |
edges | the range of edges to be split if they are longer than given threshold |
max_length | the edge length above which an edge from edges is split into to sub-edges |
np | optional Named Parameters, amongst those described below |
vertex_point_map | the property map with the points associated to the vertices of pmesh . Instance of a class model of ReadWritePropertyMap . |
face_index_map | a property map containing the index of each face of pmesh |
edge_is_constrained_map | a property map containing the constrained-or-not status of each edge of pmesh . A constrained edge can be split, and the sub-edges are set to be constrained. |
isotropic_remeshing()
bool CGAL::Polygon_mesh_processing::triangulate_face | ( | typename boost::graph_traits< PolygonMesh >::face_descriptor | f, |
PolygonMesh & | pmesh, | ||
const NamedParameters & | np | ||
) |
#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
triangulates a single face of a polygon mesh.
This function depends on the package 2D Triangulation
PolygonMesh | a model of FaceListGraph and MutableFaceGraph |
NamedParameters | a sequence of Named Parameters |
f | face to be triangulated |
pmesh | the polygon mesh to which the face to be triangulated belongs |
np | optional sequence of Named Parameters among the ones listed below |
vertex_point_map | the property map with the points associated to the vertices of pmesh . If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in PolygonMesh |
geom_traits | a geometric traits class instance |
true
if the face has been triangulated. bool CGAL::Polygon_mesh_processing::triangulate_faces | ( | FaceRange | face_range, |
PolygonMesh & | pmesh, | ||
const NamedParameters & | np | ||
) |
#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
triangulates given faces of a polygon mesh.
This function depends on the package 2D Triangulation
FaceRange | range of boost::graph_traits<PolygonMesh>::face_descriptor , model of Range . Its iterator type is InputIterator . |
PolygonMesh | a model of FaceListGraph and MutableFaceGraph |
NamedParameters | a sequence of Named Parameters |
face_range | the range of faces to be triangulated |
pmesh | the polygon mesh to be triangulated |
np | optional sequence of Named Parameters among the ones listed below |
vertex_point_map | the property map with the points associated to the vertices of pmesh . If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in PolygonMesh |
geom_traits | a geometric traits class instance |
true
if all the faces have been triangulated. bool CGAL::Polygon_mesh_processing::triangulate_faces | ( | PolygonMesh & | pmesh, |
const NamedParameters & | np | ||
) |
#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
triangulates all faces of a polygon mesh.
This function depends on the package 2D Triangulation
PolygonMesh | a model of FaceListGraph and MutableFaceGraph |
NamedParameters | a sequence of Named Parameters |
pmesh | the polygon mesh to be triangulated |
np | optional sequence of Named Parameters among the ones listed below |
vertex_point_map | the property map with the points associated to the vertices of pmesh . If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in PolygonMesh |
geom_traits | a geometric traits class instance |
true
if all the faces have been triangulated.