#include <CGAL/Shape_regularization/Segments/Angle_regularization_2.h>
template<typename GeomTraits, typename InputRange, typename SegmentMap = CGAL::Identity_property_map<typename GeomTraits::Segment_2>>
class CGAL::Shape_regularization::Segments::Angle_regularization_2< GeomTraits, InputRange, SegmentMap >
An angle-based regularization type for 2D segments that reinforces parallelism and orthogonality relationships.
Template Parameters
Is Model Of: RegularizationType
Examples: Shape_regularization/regularize_100_segments_angles.cpp , Shape_regularization/regularize_15_segments.cpp , and Shape_regularization/regularize_real_data_2.cpp .
typedef GeomTraits::FT FT
Number type.
template<typename NamedParameters >
Angle_regularization_2 (InputRange &input_range, const NamedParameters &np)
initializes all internal data structures. More...
template<typename IndexRange >
void add_group (const IndexRange &index_range)
inserts a group of segments from input_range
. More...
FT target (const std::size_t i, const std::size_t j) const
calculates the target value between 2 segments, which are direct neighbors to each other. More...
const FT bound (const std::size_t) const
returns maximum_angle
.
void update (const std::vector< FT > &solution)
applies new orientations computed by the QuadraticProgramTraits
to the initial segments. More...
template<typename OutIterator >
OutIterator parallel_groups (OutIterator groups) const
creates groups of indices, where each group represents parallel segments. More...
template<typename OutIterator >
OutIterator orthogonal_groups (OutIterator groups) const
creates groups of indices, where each group represents orthogonal segments. More...
void clear ()
clears all internal data structures.
◆ Angle_regularization_2()
template<typename GeomTraits , typename InputRange , typename SegmentMap = CGAL::Identity_property_map<typename GeomTraits::Segment_2>>
template<typename NamedParameters >
initializes all internal data structures.
Template Parameters
Parameters
input_range a range of 2D segments to be regularized
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
maximum_angle
maximum allowed angle deviation in degrees of a segment from its initial orientation
Type: GeomTraits::FT
Default: 25 degrees
segment_map
an instance of SegmentMap
that maps an item from input_range
to GeomTraits::Segment_2
Default: SegmentMap()
Precondition input_range.size() >= 2
maximum_angle >= 0 && maximum_angle <= 90
◆ add_group()
template<typename GeomTraits , typename InputRange , typename SegmentMap = CGAL::Identity_property_map<typename GeomTraits::Segment_2>>
template<typename IndexRange >
inserts a group of segments from input_range
.
Each group of segments is provided as a collection of their indices and only segments within the group are being regularized that is no relationships between segments from different groups are taken into account.
The user must not use this method until he has meaningful groups of segments (see more in the user manual). By default, all segments are inserted as a group.
Template Parameters
IndexRange a model of ConstRange
whose value type is std::size_t
Parameters
index_range a const range of segment indices
Precondition index_range.size() >= 2
◆ orthogonal_groups()
template<typename GeomTraits , typename InputRange , typename SegmentMap = CGAL::Identity_property_map<typename GeomTraits::Segment_2>>
template<typename OutIterator >
creates groups of indices, where each group represents orthogonal segments.
This method calls Segments::orthogonal_groups()
.
Template Parameters
OutIterator a model of OutputIterator
that accepts elements of type std::vector<std::size_t>
Parameters
groups an output iterator with groups of segment indices
◆ parallel_groups()
template<typename GeomTraits , typename InputRange , typename SegmentMap = CGAL::Identity_property_map<typename GeomTraits::Segment_2>>
template<typename OutIterator >
creates groups of indices, where each group represents parallel segments.
This method calls Segments::parallel_groups()
.
Template Parameters
OutIterator a model of OutputIterator
that accepts elements of type std::vector<std::size_t>
Parameters
groups an output iterator with groups of segment indices
◆ target()
template<typename GeomTraits , typename InputRange , typename SegmentMap = CGAL::Identity_property_map<typename GeomTraits::Segment_2>>
calculates the target value between 2 segments, which are direct neighbors to each other.
The target value is the angle difference between initial orientations of two segments i
and j
.
Parameters
i index of the first segment
j index of the second segment
Precondition i >= 0 && i < input_range.size()
j >= 0 && j < input_range.size()
◆ update()
template<typename GeomTraits , typename InputRange , typename SegmentMap = CGAL::Identity_property_map<typename GeomTraits::Segment_2>>
applies new orientations computed by the QuadraticProgramTraits
to the initial segments.
Number of values in solution
equals to the number n of segments being regularized + the number m of neighbor pairs between these segments. Each of n values is an angle that is added to the initial segment orientation.
Parameters
solution a vector with angles in degrees
Precondition solution.size() >= 1