CGAL 6.2 - 2D Snap Rounding
Loading...
Searching...
No Matches
Snap Rounding Common

Functions to round segments or polygons safely.

Functions

template<class Traits , class InputIterator , class OutputContainer >
void CGAL::snap_rounding_2 (InputIterator begin, InputIterator end, OutputContainer &output_container, typename Traits::NT pixel_size, bool do_isr=true, bool int_output=true, unsigned int number_of_kd_trees=1)
 
template<class SegmentRange , class OutputContainer , class NamedParameters = parameters::Default_named_parameters>
OutputContainer CGAL::snap_rounding_2 (const SegmentRange &segments, OutputContainer &out, const NamedParameters &np=parameters::default_values())
 subdivides and rounds a range of segments so that they are pairwise disjoint in their interiors.
 
template<class PolygonRange , class OutputContainer , class NamedParameters = parameters::Default_named_parameters>
void CGAL::snap_rounding_2 (const PolygonRange &polygons, OutputContainer &out, const NamedParameters &np=parameters::default_values())
 subdivides and rounds a range of polygons so that their boundary segments are pairwise disjoint in their interiors.
 

Function Documentation

◆ snap_rounding_2() [1/3]

template<class PolygonRange , class OutputContainer , class NamedParameters = parameters::Default_named_parameters>
void CGAL::snap_rounding_2 ( const PolygonRange &  polygons,
OutputContainer &  out,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Snap_rounding_2.h>

subdivides and rounds a range of polygons so that their boundary segments are pairwise disjoint in their interiors.

If the input polygons are disjoint, the output polygons remain non-overlapping, although they may share vertices or edges. Each output polygon is free of self-intersections but may present pinched sections.

By default, this function rounds on double precision coordinates using CGAL::vertical_slab_snap_rounding_2(). Other rounding schemes or methods can be used by providing a geom_traits that is model of VerticalSlabSnapRoundingTraits_2 or HotPixelSnapRoundingTraits_2.

Template Parameters
PolygonRangemodel of a ConstRange whose iterator is model of ForwardIterator and whose value_type is model of CGAL::Polygon_2.
OutputContainermodel of the concept BackInsertionSequence whose value type is model of CGAL::Polygon_2.
NamedParametersa sequence of Named Parameters
Parameters
polygonsthe range of input polygons
outthe output inserter
npan optional sequence of Named Parameters including the one listed below
Optional Named Parameters
Warning
a convex input polygon might no longer be convex after rounding.

◆ snap_rounding_2() [2/3]

template<class SegmentRange , class OutputContainer , class NamedParameters = parameters::Default_named_parameters>
OutputContainer CGAL::snap_rounding_2 ( const SegmentRange &  segments,
OutputContainer &  out,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Snap_rounding_2.h>

subdivides and rounds a range of segments so that they are pairwise disjoint in their interiors.

By default, each polyline of the output corresponds to an input segment. Consequently, duplicate segments may appear in the output, for instance when multiple input segments collapse. When the parameter output_unique_segments is set to true, the polylines are decomposed into individual segments (represented as polylines with two points), and duplicates are removed.

By default, this function rounds on double precision coordinates using CGAL::vertical_slab_snap_rounding_2(). Other rounding schemes or methods can be used by providing a geom_traits that is model of VerticalSlabSnapRoundingTraits_2 or HotPixelSnapRoundingTraits_2.

Template Parameters
SegmentRangemodel of the concept ConstRange whose iterator is model of ForwardIterator and whose value_type is geom_traits::Segment_2, where the type of geom_traits is detailed by np::geom_traits.
OutputContainermodel of the concept BackInsertionSequence whose value type is itself a model of the concepts DefaultConstructible and BackInsertionSequence whose value type is geom_traits::Point_2
NamedParametersa sequence of Named Parameters
Parameters
segmentsthe input segment range
outthe output container
npan optional sequence of Named Parameters including the ones listed below
Optional Named Parameters
  • If set to true, the output polylines are unique pairs of distinct points represented a segment. As a result, the total number of output polylines may differ from the number of input segments.
  • Type: Boolean
  • Default: true

◆ snap_rounding_2() [3/3]

template<class Traits , class InputIterator , class OutputContainer >
void CGAL::snap_rounding_2 ( InputIterator  begin,
InputIterator  end,
OutputContainer &  output_container,
typename Traits::NT  pixel_size,
bool  do_isr = true,
bool  int_output = true,
unsigned int  number_of_kd_trees = 1 
)

#include <CGAL/Snap_rounding_2.h>

Deprecated:
This function is deprecated since CGAL 6.2, use newer API of CGAL::snap_rounding_2() or CGAL::hot_pixel_snap_rounding_2()
Template Parameters
Traitsmust be a model of HotPixelSnapRoundingTraits_2.
InputIteratormust be an iterator with value type Traits::Segment_2.
OutputContainermust be a container with a method push_back(const OutputContainer::value_type& c), where OutputContainer::value_type must be a container with a method push_back(const Traits::Point_2& p)
Parameters
begin,enddenote the iterator range of the input segments.
output_containeris a reference to a container of the output polylines. Since a polyline is composed of a sequence of points, a polyline is a container itself.
pixel_sizedenotes the pixel size w. The plane will be tiled with square pixels of width w such that the origin is the center of a pixel. pixel_size must have a positive value.
do_isrdetermines whether to apply ISR or SR.
int_outputIf set to true, the output coordinates are expressed in the integer grid (pixel indices). Otherwise, they are given in the input coordinate system.
number_of_kd_treesThe seventh parameter is briefly described later on this page; for a detailed description see [3].
Examples
Snap_rounding_2/snap_rounding_to_double.cpp.