#include <CGAL/Shape_regularization/Contours/Longest_direction_2.h>
template<typename GeomTraits, typename InputRange, typename PointMap = CGAL::Identity_property_map<typename GeomTraits::Point_2>>
class CGAL::Shape_regularization::Contours::Longest_direction_2< GeomTraits, InputRange, PointMap >
Estimates the longest principal direction of the contour.
This algorithm finds the longest contour edge and sets its direction as the principal direction of the contour.
Template Parameters
Is Model Of: ContourDirections
Examples: Shape_regularization/regularize_open_contour.cpp .
void orient (const std::size_t query_index, Segment_2 &segment) const
orients a given segment
with the index query_index
towards the longest principal direction. More...
◆ Longest_direction_2()
template<typename GeomTraits , typename InputRange , typename PointMap = CGAL::Identity_property_map<typename GeomTraits::Point_2>>
template<typename NamedParameters = parameters::Default_named_parameters>
initializes all internal data structures.
Template Parameters
Parameters
input_range a const range of ordered 2D points, which form a contour
is_closed indicates whether the contour is closed or open
np an optional sequence of Named Parameters among the ones listed below; this parameter can be omitted, the default values are then used
Optional Named Parameters
point_map
an instance of PointMap
that maps an item from input_range
to GeomTraits::Point_2
Default: PointMap()
Precondition input_range.size() >= 3 for closed contours
input_range.size() >= 2 for open contours
◆ number_of_directions()
template<typename GeomTraits , typename InputRange , typename PointMap = CGAL::Identity_property_map<typename GeomTraits::Point_2>>
returns the number of principal directions of the contour.
The returned number is always one.
◆ orient()
template<typename GeomTraits , typename InputRange , typename PointMap = CGAL::Identity_property_map<typename GeomTraits::Point_2>>
orients a given segment
with the index query_index
towards the longest principal direction.
Parameters
query_index an index of the contour vertex that emits the contour edge being segment
segment a segment to be rotated
Precondition query_index >= 0 && query_index < input_range.size() for closed contours
query_index >= 0 && query_index < input_range.size() - 1 for open contours