CGAL 6.2 - Shape Detection
Loading...
Searching...
No Matches
CGAL::Shape_detection::Segment_set::Line_segment_region< GeomTraits, Item_, SegmentMap > Class Template Reference

#include <CGAL/Shape_detection/Region_growing/Segment_set/Line_segment_region.h>

Definition

template<typename GeomTraits, typename Item_, typename SegmentMap>
class CGAL::Shape_detection::Segment_set::Line_segment_region< GeomTraits, Item_, SegmentMap >

Region type based on the line of the first segment selected.

This class uses the supporting line of the first segment picked for the region and expands it for all segments with a direction close to that of the first segment (close being defined by the maximum_distance parameter) and such that endpoints are not far from that supporting line (far being defined by the maximum_angle or cosine_of_maximum_angle parameter).

Template Parameters
GeomTraitsa model of Kernel
Item_a descriptor representing a given segment. Must be a model of Hashable.
SegmentMapa model of ReadablePropertyMap whose key type is Item_ and value type is GeomTraits::Segment_2 or GeomTraits::Segment_3
Is model of
RegionType
Examples
Shape_detection/region_growing_lines_on_segment_set.cpp.

Types

using Segment_map = SegmentMap
 
using Segment_type = typename Segment_map::value_type
 
using FT = typename GeomTraits::FT
 Number type.
 
using Item = Item_
 Item type.
 
using Region = std::vector< Item >
 
using Primitive = typename GeomTraits::Line_2 or typename GeomTraits::Line_3
 
using Region_unordered_map = std::unordered_map< Item, std::size_t, internal::hash_item< Item > >
 
using Region_index_map = boost::associative_property_map< Region_unordered_map >
 

Initialization

template<typename NamedParameters = parameters::Default_named_parameters>
 Line_segment_region (const NamedParameters &np=parameters::default_values())
 initializes all internal data structures.
 

Access

Region_index_map region_index_map ()
 implements RegionType::region_index_map().
 
Primitive primitive () const
 implements RegionType::primitive().
 
bool is_part_of_region (const Item query, const Region &) const
 implements RegionType::is_part_of_region().
 
bool is_valid_region (const Region &region) const
 implements RegionType::is_valid_region().
 
bool update (const Region &region)
 implements RegionType::update().
 

Constructor & Destructor Documentation

◆ Line_segment_region()

template<typename GeomTraits , typename Item_ , typename SegmentMap >
template<typename NamedParameters = parameters::Default_named_parameters>
CGAL::Shape_detection::Segment_set::Line_segment_region< GeomTraits, Item_, SegmentMap >::Line_segment_region ( const NamedParameters &  np = parameters::default_values())

initializes all internal data structures.

Template Parameters
NamedParametersa sequence of Named Parameters
Parameters
npa sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • the maximum distance from the furthest vertex of a segment to a line
  • Type: GeomTraits::FT
  • Default: 1
  • the maximum angle in degrees between the direction of a segment and the direction of a line
  • Type: GeomTraits::FT
  • Default: 25 degrees
  • the cosine value cos(maximum_angle * PI / 180), to be used instead of the parameter maximum_angle()
  • Type: GeomTraits::FT
  • Default: cos(25 * PI / 180)
  • the minimum number of segments a region must have
  • Type: std::size_t
  • Default: 1
  • an instance of SegmentMap that maps Item_ to GeomTraits::Segment_2 or GeomTraits::Segment_3
  • Default: SegmentMap()
  • an instance of GeomTraits
  • Default: GeomTraits()
Precondition
maximum_distance >= 0
maximum_angle >= 0 && maximum_angle <= 90
cosine_of_maximum_angle >= 0 && cosine_of_maximum_angle <= 1
minimum_region_size > 0

Member Function Documentation

◆ is_part_of_region()

template<typename GeomTraits , typename Item_ , typename SegmentMap >
bool CGAL::Shape_detection::Segment_set::Line_segment_region< GeomTraits, Item_, SegmentMap >::is_part_of_region ( const Item  query,
const Region &   
) const

implements RegionType::is_part_of_region().

This function determines if a segment with the index query is within the maximum_distance from the corresponding line and if the angle between the direction of this segment and the line's direction is within the maximum_angle. If both conditions are satisfied, it returns true, otherwise false.

Parameters
queryitem of the query segment

◆ is_valid_region()

template<typename GeomTraits , typename Item_ , typename SegmentMap >
bool CGAL::Shape_detection::Segment_set::Line_segment_region< GeomTraits, Item_, SegmentMap >::is_valid_region ( const Region &  region) const

implements RegionType::is_valid_region().

This function controls if the region contains at least minimum_region_size segments.

Parameters
regionSegments of the region represented as Items.

◆ primitive()

template<typename GeomTraits , typename Item_ , typename SegmentMap >
Primitive CGAL::Shape_detection::Segment_set::Line_segment_region< GeomTraits, Item_, SegmentMap >::primitive ( ) const

implements RegionType::primitive().

This function provides the support line of the seed segment.

Returns
Primitive parameters that fits the region
Precondition
is_valid_region(region)
update(region)

◆ region_index_map()

template<typename GeomTraits , typename Item_ , typename SegmentMap >
Region_index_map CGAL::Shape_detection::Segment_set::Line_segment_region< GeomTraits, Item_, SegmentMap >::region_index_map ( )

implements RegionType::region_index_map().

This function creates an empty property map that maps iterators on the input range Item to std::size_t.

◆ update()

template<typename GeomTraits , typename Item_ , typename SegmentMap >
bool CGAL::Shape_detection::Segment_set::Line_segment_region< GeomTraits, Item_, SegmentMap >::update ( const Region &  region)

implements RegionType::update().

This function uses the support line of the seed segment as primitive.

Parameters
regionSegments of the region represented as Items.
Returns
Boolean true if the line fitting succeeded and false otherwise
Precondition
region.size() > 0