CGAL 5.6 - 2D Straight Skeleton and Polygon Offsetting

The following functions are used to construct the skeleton extrusion of a polygon.

Functions

template<typename Polygon , typename FT , typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
bool CGAL::extrude_skeleton (const Polygon &polygon, PolygonMesh &out, const NamedParameters &np=parameters::default_values())
 constructs the straight skeleton-based extrusion of a polygon with holes. More...
 

Function Documentation

◆ extrude_skeleton()

template<typename Polygon , typename FT , typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
bool CGAL::extrude_skeleton ( const Polygon &  polygon,
PolygonMesh &  out,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/extrude_skeleton.h>

constructs the straight skeleton-based extrusion of a polygon with holes.

Given a polygon with holes and a set of weights, the skeleton extrusion is a volume constructed from the weighted straight skeleton by associating a height to the vertices of the skeleton, which corresponds to the time at the vertex. The input polygon is placed at z = 0.

This function allows cropping the extruded skeleton at a maximum height, using the optional maximum_height() named parameter.

The result is a closed, 2-manifold surface triangle mesh. Note that this mesh can have non-local self-intersections if a maximal height is provided due to possible (geometric) non-manifold occurences.

Template Parameters
PolygonWithHolesmust be a model of SequenceContainer with value type InK::Point_2 (e.g. Polygon_2<InK>) or a model of GeneralPolygonWithHoles_2 (e.g. Polygon_with_holes_2<InK>).
PolygonMesha model of MutableFaceGraph
NamedParametersa sequence of Named Parameters
Parameters
polygonthe polygon with holes
outthe output polygon mesh
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a range of weights, one for each edge of the input polygon
  • Type: a model of Range whose value type is a model of Range whose value type is FT
  • Default: an empty range (uniform weights are used)
  • Extra: Weights should be finite and all of the same sign. Negative weights are used to signify exterior extrusion. Contrary to weighted skeleton functions, a weight 0 can here be used to signify a vertical extrusion of this edge.
  • Extra: If neither weights nor angles are provided, uniform weights are used.

  • a range of angles, one for each edge of the input polygon. For each contour edge, the angle is the dihedral angle between the z=0 plane and the desired extrusion plane.
  • Type: a model of Range whose value type is a model of Range whose value type is FT
  • Default: an empty range (uniform weights are used)
  • Extra: Angles are measured in degrees and should be strictly within 0 and 180 degrees and should be eitger all acute (inward extrusion) or all obtuse (outward extrusion).
  • Extra: This parameter is ignored if the weights parameter is provided.
  • Extra: The conversion to weights involves trigonometry and will be inexact, even when using a number type with exact square roots.

  • the maximum height of the extrusion
  • Type: FT, a model of FieldNumberType convertible to the kernel type of the polygon.
  • Default: unused
  • Extra: This parameter should not be null, but can be negative; in this case, the polygon is extruded downwards.

  • Whether information about the extrusion process should be printed to std::cout
  • Type: Boolean
  • Default: false

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the polygon's point type, using CGAL::Kernel_traits

  • a property map associating points to the vertices of out
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<PolygonMesh>::vertex_descriptor as key type and InK::Point_2 as value type.
  • Default: the internal property map for CGAL::vertex_point_t of out
Returns
true if the construction was successful, false otherwise.
Precondition
polygon is a weakly simple polygon with holes.
Holes are weakly simple polygons that do not intersect each other or the outer boundary.
See also
CGAL::create_interior_weighted_skeleton_and_offset_polygons_with_holes_2()
CGAL::Straight_skeleton_2
Examples:
Straight_skeleton_2/extrude_skeleton.cpp.