CGAL::Sweep_line_2<CurveInputIterator, SweepLineTraits_2>

Definition

Sweep_line_2 is a utility class that calculates intersection points between given curves. The following operationas are supported:

The Sweep_line_2 class is implemented in such a way that no assumptions are made regarding the given curves. For example, the curves may be overlapping or vertical. There is also no assumtion that the curves are x-monotone.

The Sweep_line_2 is parametrized by two parameters. The input iterator and the traits parameter. The CurveInputIterator::type_value is equivalent to Traits::Curve_2.

#include <CGAL/Sweep_line_2.h>

Creation

Sweep_line_2<CurveInputIterator, SweepLineTraits_2> sweepLine;
constructs an instance of the Sweep_line_2 class.


Sweep_line_2<CurveInputIterator, SweepLineTraits_2> sweepLine ( SweepLineTraits_2 *traits);
constructs an instance of the Sweep_line_2 class.

Types

Sweep_line_2<CurveInputIterator, SweepLineTraits_2>::Traits
traits class.


Sweep_line_2<CurveInputIterator, SweepLineTraits_2>::Curve_2
a 2D curve as defined in the traits class.


Sweep_line_2<CurveInputIterator, SweepLineTraits_2>::X_monotone_curve_2
an x-monotone 2D curve as defined in the traits class.


Sweep_line_2<CurveInputIterator, SweepLineTraits_2>::Point_2
a 2D point as defined in the traits class.

Query Functions

template <class OutpoutIterator>
void
sweepLine.get_subcurves ( CurveInputIterator curves_begin,
CurveInputIterator curves_end,
OutpoutIterator subcurves,
bool overlapping = false)
given a range of curves, this method returns a container of interior-disjoint curves that are the product of intersecting the specified curves.
The overlapping parameter is an input parameter and is relevant only in case there are overlapping curves in the input. If this parameter is false (default), any overlapping subcurve is reported only once. If the parameter is set to true, the subcurve is reported as many times as it is overlapped.
OutpoutIterator::value_type is equvalent to Traits::X_monotone_curve_2.

template <class OutpoutIterator>
void
sweepLine.get_intersection_points ( CurveInputIterator curves_begin,
CurveInputIterator curves_end,
OutpoutIterator points,
bool endpoints = true,
bool overlapping = false)
given a range of curves, this method returns a list of all intersection points of the curves.
If endpoints is true (default) the end points of the curves are reported as intersection points. Otherwise they are ommited.
The overlapping parameter is an input parameter and is relevant only in case there are overlapping curves in the input. If this parameter is false (default), any overlapping subcurve is reported only once. If the parameter is set to true, the subcurve is reported as many times as it is overlapped.
The OutputIterator::value_type is equivalent to Traits::Point_2.

template <class OutputIterator>
void
sweepLine.get_intersecting_curves ( CurveInputIterator curves_begin,
CurveInputIterator curves_end,
OutputIterator intersecting_curves,
bool endpoints = true)
given a range of curves this method calculates the intersection points between the curves. It returns the list of intersection points, and for each intersection point the list of curves intersecting at that point is given.
If endpoints is true (default) the end points of the curves are reported as intersection points. Otherwise they are ommited.
The OutputIterator::value_type is equivalent to a pair of Point_2 and a container (e.g., list, vector) of Curve_2.

bool
sweepLine.do_curves_intersect ( CurveInputIterator curves_begin,
CurveInputIterator curves_end)
given a range of curves this method returns true if any two curves intersect, false otherwise.