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
)
#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.
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.
the vertices of the patches to be faired (the positions of only those vertices will be changed)
np
an optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
a property map associating points to the vertices of tmesh
Type: a class model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
Default: boost::get(CGAL::vertex_point, tmesh)
Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available for the vertices of tmesh.
A value controling the tangential continuity of the output surface patch. The possible values are 0, 1 and 2, refering to the C0, C1 and C2 continuity.
Type: unsigned int
Default: 1
Extra: The larger fairing_continuity gets, the more fixed vertices are required.
an instance of the sparse linear solver used for fairing
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.
Template Parameters
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.
FaceRange
range of boost::graph_traits<PolygonMesh>::face_descriptor, model of Range. Its iterator type is ForwardIterator.
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
an optional sequence of Named Parameters among the ones listed below
Precondition
if constraints protection is activated, the constrained edges must not be longer than 4/3*target_edge_length
Optional Named Parameters
a property map associating points to the vertices of pmesh
Type: a class model of ReadWritePropertyMap with boost::graph_traits<PolygonMesh>::vertex_descriptor as key type and Point_3 as value type
Default: boost::get(CGAL::vertex_point, pmesh)
Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in PolygonMesh.
Extra: The geometric traits class must be compatible with the vertex point type.
Extra: Exact constructions kernels are not supported by this function.
a property map associating to each face of pmesh a unique index between 0 and num_faces(pmesh) - 1
Type: a class model of ReadablePropertyMap with boost::graph_traits<PolygonMesh>::face_descriptor as key type and std::size_t as value type
Default: an automatically indexed internal map
the number of iterations for the sequence of atomic operations performed (listed in the above description)
Type: unsigned int
Default: 1
a property map containing the constrained-or-not status of each edge of pmesh
Type: a class model of ReadWritePropertyMap with boost::graph_traits<PolygonMesh>::edge_descriptor as key type and bool as value type. It must be default constructible.
Default: a default property map where no edge is constrained
Extra: A constrained edge can be split or collapsed, but not flipped, nor its endpoints moved by smoothing.
Extra: Sub-edges generated by splitting are set to be constrained.
Extra: Patch boundary edges (i.e. incident to only one face in the range) are always considered as constrained edges.
a property map containing the constrained-or-not status of each vertex of pmesh.
Type: a class model of ReadWritePropertyMap with boost::graph_traits<PolygonMesh>::vertex_descriptor as key type and bool as value type. It must be default constructible.
Default: a default property map where no vertex is constrained
Extra: A constrained vertex cannot be modified during remeshing.
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.
Type: Boolean
Default: false
Extra: 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.
If true, the edges set as constrained in edge_is_constrained_map (or by default the boundary edges) are collapsed during remeshing.
Type: Boolean
Default: true
Extra: This value is ignored if protect_constraints is true.
a property map with the patch id's associated to the faces of faces
Default: a default property map where each face is associated with the ID of the connected component it belongs to. Connected components are computed with respect to the constrained edges listed in the property map edge_is_constrained_map
Extra: The map is updated during the remeshing process while new faces are created.
the number of iterations of tangential relaxation that are performed at each iteration of the remeshing process
Type: unsigned int
Default: 1
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.}
Type: Boolean
Default: false
whether vertices should be reprojected on the input surface after creation or displacement
Type: Boolean
Default: true
A function object used to project input vertices (moved by the smoothing) and created vertices
Type: Unary functor that provides Point_3 operator()(vertex_descriptor), Point_3 being the value type of the vertex point map.
Default: If not provided, vertices are projected on the input surface mesh.
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).
Template Parameters
VertexRange
model of Range, holding vertices of type boost::graph_traits<TriangleMesh>::vertex_descriptor. Its iterator type is ForwardIterator.
Extra: The geometric traits class must be compatible with the vertex point type.
a property map containing the constrained-or-not status of each vertex of tmesh
Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and bool as value type. It must be default constructible.
Default: a default property map where no vertex is constrained
Extra: A constrained vertex cannot be modified at all during perturbation
indicates whether vertices are reprojected on the input surface after their coordinates random perturbation
Type: Boolean
Default: true
a value to seed the random number generator, and make the perturbation deterministic
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.
Extra: The geometric traits class must be compatible with the vertex point type.
If true, vertex moves that would worsen the mesh are ignored.
Type: Boolean
Default: false
If true, area-based smoothing will be completed by a phase of Delaunay-based edge-flips to prevent the creation of elongated triangles.
Type: Boolean
Default: true
If true, points are projected onto the initial surface after each iteration.
Type: Boolean
Default: true
a property map containing the constrained-or-not status of each vertex of tmesh.
Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and bool as value type. It must be default constructible.
Default: a default property map where no vertex is constrained
Extra: A constrained vertex cannot be modified at all during smoothing.
a property map containing the constrained-or-not status of each edge of tmesh.
Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::edge_descriptor as key type and bool as value type. It must be default constructible.
Default: a default property map where no edge is constrained
Extra: A constrained edge cannot be modified at all during smoothing.
Warning
The third party library Ceres is required to use area-based smoothing.
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.
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
an optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
the number of iterations for the sequence of the smoothing iterations performed
Type: unsigned int
Default: 1
a property map associating points to the vertices of tmesh
Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
Default: boost::get(CGAL::vertex_point, tmesh)
Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in TriangleMesh.
Extra: The geometric traits class must be compatible with the vertex point type.
a property map containing the constrained-or-not status of each vertex of tmesh.
Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and bool as value type. It must be default constructible.
Default: a default property map where no vertex is constrained
Extra: A constrained vertex cannot be modified at all during smoothing.
an instance of the sparse linear solver used for smoothing
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)
Template Parameters
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.
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
an optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
a property map associating points to the vertices of pmesh
Type: a class model of ReadWritePropertyMap with boost::graph_traits<PolygonMesh>::vertex_descriptor as key type and Point_3 as value type
Default: boost::get(CGAL::vertex_point, pmesh)
Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in PolygonMesh.
a property map associating to each face of pmesh a unique index between 0 and num_faces(pmesh) - 1
Type: a class model of ReadablePropertyMap with boost::graph_traits<PolygonMesh>::face_descriptor as key type and std::size_t as value type
Default: an automatically indexed internal map
a property map containing the constrained-or-not status of each edge of pmesh
Type: a class model of ReadWritePropertyMap with boost::graph_traits<PolygonMesh>::edge_descriptor as key type and bool as value type. It must be default constructible.
Default: a default property map where no edge is constrained
Extra: A constrained edge can be split or collapsed, but not flipped, nor its endpoints moved by smoothing.