CGAL 6.1 - 2D Straight Skeleton and Polygon Offsetting

Loading...
Searching...
No Matches
Functions
Weighted Offset Construction Functions
Reference Manual » Functions

##

The following functions are used to construct the inward or outward weighted offsets of a polygon.

## Functions
template<typename OfKPolygon , typename FT , typename InKPolygon , typename InKWeights , typename HoleIterator , typename OfK , typename SsK >
std::vector< std::shared_ptr< OfKPolygon > > | CGAL::create_interior_weighted_skeleton_and_offset_polygons_2 (FT offset, const InKPolygon &outer_boundary, HoleIterator holes_begin, HoleIterator holes_end, const InKWeights &outer_boundary_weights, HoleWeightsIterator holes_weights_begin, HoleWeightsIterator holes_weights_end, OfK ofk=CGAL::Exact_predicates_inexact_constructions_kernel, SsK ssk=CGAL::Exact_predicates_inexact_constructions_kernel())
| returns a container with all the inner offset polygons at distance `offset` of a 2D polygon with holes.
template<typename OfKPolygon , typename FT , typename InKPolygon , typename InKWeights , typename OfK , typename SsK >
std::vector< std::shared_ptr< OfKPolygon > > | CGAL::create_interior_weighted_skeleton_and_offset_polygons_2 (FT offset, const InKPolygon &poly, const InKWeights &weights, OfK ofk=CGAL::Exact_predicates_inexact_constructions_kernel, SsK ssk=CGAL::Exact_predicates_inexact_constructions_kernel())
| returns a container with all the inner offset polygons at distance `offset` of the 2D polygon `poly`.
template<typename OfKPolygon , typename FT , typename InKPolygon , typename InKWeights , typename OfK , typename SsK >
std::vector< std::shared_ptr< OfKPolygon > > | CGAL::create_exterior_weighted_skeleton_and_offset_polygons_2 (FT offset, const InKPolygon &poly, const InKWeights &weights, OfK ofk=Exact_predicates_inexact_constructions_kernel(), SsK ssk=Exact_predicates_inexact_constructions_kernel())
| returns a container with all the outer offset polygons at distance `offset` of the 2D polygon `poly`.
template<class OfKPolygon , class FT , class InKPolygon , class OfK , class SsK >
std::vector< std::shared_ptr< OfKPolygon > > | CGAL::create_interior_weighted_skeleton_and_offset_polygons_with_holes_2 (FT offset, const InKPolygon &poly_with_holes, OfK ofk=CGAL::Exact_predicates_inexact_constructions_kernel, SsK ssk=CGAL::Exact_predicates_inexact_constructions_kernel)
| returns a container with all the inner offset polygons with holes at distance `offset` of the 2D polygon with holes `poly_with_holes`.
template<class OfKPolygon , class FT , class InKPolygon , class OfK , class SsK >
std::vector< std::shared_ptr< OfKPolygon > > | CGAL::create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2 (FT offset, const InKPolygon &poly_with_holes, const InKWeights &weights, OfK ofk=Exact_predicates_inexact_constructions_kernel(), SsK ssk=Exact_predicates_inexact_constructions_kernel())
| returns a container with all the outer offset polygons with holes at distance `offset` of the 2D polygon `poly_with_holes`.

## Function Documentation

## ◆ create_exterior_weighted_skeleton_and_offset_polygons_2()

template<typename OfKPolygon , typename FT , typename InKPolygon , typename InKWeights , typename OfK , typename SsK >

std::vector< std::shared_ptr< OfKPolygon > > CGAL::create_exterior_weighted_skeleton_and_offset_polygons_2 | ( | FT | offset,
|  | const InKPolygon & | poly,
|  | const InKWeights & | weights,
|  | OfK | ofk = `Exact_predicates_inexact_constructions_kernel()`,
|  | SsK | ssk = `Exact_predicates_inexact_constructions_kernel()`
| ) |  |

`#include <CGAL/create_weighted_offset_polygons_2.h>`

returns a container with all the outer offset polygons at distance `offset` of the 2D polygon `poly`.

Weights of the polygon are given by `weights`, in the same order as the vertices of the polygon: the `i`-th weight in the range is associated to the contour edge between the `i-1`-th and `i`-th vertices.

The exterior skeleton is limited by an outer rectangular frame placed at a margin sufficiently large to allow the offset polygons to be constructed.

Note
  A temporary straight skeleton is constructed in the limited exterior of the input polygon to obtain the offsets. The construction of this skeleton is the most expensive operation, therefore, to construct offsets at more than one single distance, use the separate functions `create_exterior_straight_skeleton_2()` and `create_offset_polygons_2()` instead.

Template Parameters

  OfKPolygon | is a polygon without holes type determined from `OfK` and `InKPolygon`, see Section Polygon Return Type.
  FT | must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`.
  InKPolygon | must 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>`).
  InKWeights | must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`.
  OfK | must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2<OfK>` for constructing the offset polygons.
  SsK | must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2<SsK>` for constructing the straight skeleton.

Note
  If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2<OfK>`.

Precondition
  `offset` is positive
  `poly` is weakly simple, counterclockwise polygon.

See also
  `CGAL::create_interior_skeleton_and_offset_polygons_2()`
  `CGAL::create_exterior_skeleton_and_offset_polygons_with_holes_2()`
  `Polygon_offset_builder_2`

## ◆ create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2()

template<class OfKPolygon , class FT , class InKPolygon , class OfK , class SsK >

std::vector< std::shared_ptr< OfKPolygon > > CGAL::create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2 | ( | FT | offset,
|  | const InKPolygon & | poly_with_holes,
|  | const InKWeights & | weights,
|  | OfK | ofk = `Exact_predicates_inexact_constructions_kernel()`,
|  | SsK | ssk = `Exact_predicates_inexact_constructions_kernel()`
| ) |  |

`#include <CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h>`

returns a container with all the outer offset polygons with holes at distance `offset` of the 2D polygon `poly_with_holes`.

Note that the offset of the outer frame is ignored.

This is equivalent to a call to `CGAL::arrange_offset_polygons_2()` on the output of `create_exterior_weighted_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk)` after having filtered out the polygon corresponding to the offset of the outer frame and having reversed the orientation of all other polygons.

Template Parameters

  OfKPolygon | is a polygon without holes type determined by `OfK` and `InKPolygon`, see Section Polygon Return Type.
  FT | must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`.
  InKPolygon | must 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>`).
  InKWeights | must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`.
  OfK | must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2<OfK>` for constructing the offset polygons.
  SsK | must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2<SsK>` for constructing the straight skeleton.

Note
  If `SsK != OfK` the constructed weighted straight skeleton is converted to `CGAL::Straight_skeleton_2<OfK>`.

See also
  `CGAL::create_exterior_weighted_skeleton_and_offset_polygons_2()`
  `CGAL::create_interior_weighted_skeleton_and_offset_polygons_with_holes_2()`
  `Polygon_offset_builder_2`

## ◆ create_interior_weighted_skeleton_and_offset_polygons_2() [1/2]

template<typename OfKPolygon , typename FT , typename InKPolygon , typename InKWeights , typename HoleIterator , typename OfK , typename SsK >

std::vector< std::shared_ptr< OfKPolygon > > CGAL::create_interior_weighted_skeleton_and_offset_polygons_2 | ( | FT | offset,
|  | const InKPolygon & | outer_boundary,
|  | HoleIterator | holes_begin,
|  | HoleIterator | holes_end,
|  | const InKWeights & | outer_boundary_weights,
|  | HoleWeightsIterator | holes_weights_begin,
|  | HoleWeightsIterator | holes_weights_end,
|  | OfK | ofk = `CGAL::Exact_predicates_inexact_constructions_kernel`,
|  | SsK | ssk = `CGAL::Exact_predicates_inexact_constructions_kernel()`
| ) |  |

`#include <CGAL/create_weighted_offset_polygons_2.h>`

returns a container with all the inner offset polygons at distance `offset` of a 2D polygon with holes.

The outer boundary is `outer_boundary` and its holes are given by `[holes_begin,holes_end)`. Weights of the outer contour are given by `outer_boundary_weights` and weights of the holes are given by `[holes_weights_begin, holes_weights_end]`, in the same order as holes appear in the iterator range. Within each weight range, weights are given in the same order as the vertices of the contour: the `i`-th weight in the range is associated to the contour edge between the `i-1`-th and `i`-th vertices.

Note
  A temporary straight skeleton is constructed in the interior of the input polygon to obtain the offsets. The construction of this skeleton is the most expensive operation, therefore, to construct offsets at more than one single distance, it is advised to use the separate functions `create_interior_straight_skeleton_2()` and `create_offset_polygons_2()` instead.

Template Parameters

  OfKPolygon | is a polygon without holes type determined from `OfK` and `InKPolygon`, see Section Polygon Return Type.
  FT | must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`.
  InKPolygon | must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2<InK>`).
  HoleIterator | must be a model of `InputIterator` with value type being a model of `ConstRange` with value type `SsK::Point_2`.
  InKWeights | must be a model of `SequenceContainer` whose value type is `InK::FT`.
  HoleWeightsIterator | must be a model of `InputIterator` with value type being a model of `SequenceContainer` with value type `InK::FT`.
  OfK | must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2<OfK>` for constructing the offset polygons.
  SsK | must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2<SsK>` for constructing the straight skeleton.

Note
  If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2<OfK>`.

See also
  `CGAL::create_exterior_skeleton_and_offset_polygons_2()`
  `CGAL::create_interior_skeleton_and_offset_polygons_with_holes_2()`
  `Polygon_offset_builder_2`

## ◆ create_interior_weighted_skeleton_and_offset_polygons_2() [2/2]

template<typename OfKPolygon , typename FT , typename InKPolygon , typename InKWeights , typename OfK , typename SsK >

std::vector< std::shared_ptr< OfKPolygon > > CGAL::create_interior_weighted_skeleton_and_offset_polygons_2 | ( | FT | offset,
|  | const InKPolygon & | poly,
|  | const InKWeights & | weights,
|  | OfK | ofk = `CGAL::Exact_predicates_inexact_constructions_kernel`,
|  | SsK | ssk = `CGAL::Exact_predicates_inexact_constructions_kernel()`
| ) |  |

`#include <CGAL/create_weighted_offset_polygons_2.h>`

returns a container with all the inner offset polygons at distance `offset` of the 2D polygon `poly`.

Weights of the polygon are given by `weights`, in the same order as the vertices of the polygon: the `i`-th weight in the range is associated to the contour edge between the `i-1`-th and `i`-th vertices.

Note
  A temporary straight skeleton is constructed in the interior of the input polygon to obtain the offsets. The construction of this skeleton is the most expensive operation, therefore, to construct offsets at more than one single distance, use the separate functions `create_interior_straight_skeleton_2()` and `create_offset_polygons_2()` instead.

Template Parameters

  OfKPolygon | is a polygon without holes type determined by `OfK` and `InKPolygon`, see Section Polygon Return Type.
  FT | must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`.
  InKPolygon | must 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>`).
  InKWeights | must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`.
  OfK | must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2<OfK>` for constructing the offset polygons.
  SsK | must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2<SsK>` for constructing the straight skeleton.

Note
  If `SsK != OfK` the constructed straight skeleton is converted to `CGAL::Straight_skeleton_2<OfK>`.

See also
  `CGAL::create_exterior_skeleton_and_offset_polygons_2()`
  `CGAL::create_interior_skeleton_and_offset_polygons_with_holes_2()`
  `Polygon_offset_builder_2`

## ◆ create_interior_weighted_skeleton_and_offset_polygons_with_holes_2()

template<class OfKPolygon , class FT , class InKPolygon , class OfK , class SsK >

std::vector< std::shared_ptr< OfKPolygon > > CGAL::create_interior_weighted_skeleton_and_offset_polygons_with_holes_2 | ( | FT | offset,
|  | const InKPolygon & | poly_with_holes,
|  | OfK | ofk = `CGAL::Exact_predicates_inexact_constructions_kernel`,
|  | SsK | ssk = `CGAL::Exact_predicates_inexact_constructions_kernel`
| ) |  |

`#include <CGAL/create_weighted_offset_polygons_from_polygon_with_holes_2.h>`

returns a container with all the inner offset polygons with holes at distance `offset` of the 2D polygon with holes `poly_with_holes`.

This is equivalent to `arrange_offset_polygons_2(create_interior_weighted_skeleton_and_offset_polygons_2(offset, poly_with_holes, ofk, ssk))`.

Template Parameters

  OfKPolygon | is a polygon without holes type determined by `OfK` and `InKPolygon`, see Section Polygon Return Type.
  FT | must be a model of `FieldNumberType` convertible to `OfK::FT` and `SsK::FT`.
  InKPolygon | must 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>`).
  InKWeights | must be a model of `SequenceContainer` whose value type is itself a model of `SequenceContainer` with value type `InK::FT`.
  OfK | must be a model of `Kernel`. It is used to instantiate `Polygon_offset_builder_traits_2<OfK>` for constructing the offset polygons.
  SsK | must be a model of `Kernel`. It is used to instantiate `Straight_skeleton_builder_traits_2<SsK>` for constructing the weighted straight skeleton.

Note
  If `SsK != OfK` the constructed weighted straight skeleton is converted to `CGAL::Straight_skeleton_2<OfK>`.

See also
  `CGAL::create_interior_weighted_skeleton_and_offset_polygons_2()`
  `CGAL::create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2()`
  `Polygon_offset_builder_2`