CGAL 6.2 - Shape Detection

Loading...
Searching...
No Matches
List of all members | Classes | Related Functions
CGAL::Shape_detection::Point_set::Least_squares_cylinder_fit_region< GeomTraits, Item_, PointMap, NormalMap > Class Template Reference
Reference Manual » Region Growing » Point Set

`#include <CGAL/Shape_detection/Region_growing/Point_set/Least_squares_cylinder_fit_region.h>`

## Definition

template<typename GeomTraits, typename Item_, typename PointMap, typename NormalMap>
class CGAL::Shape_detection::Point_set::Least_squares_cylinder_fit_region< GeomTraits, Item_, PointMap, NormalMap >

Region type based on the quality of the least squares cylinder fit applied to 3D points.

This class fits an infinite cylinder to chunks of points in a 3D point set and controls the quality of this fit. If all quality conditions are satisfied, the chunk is accepted as a valid region, otherwise rejected.

Template Parameters

  GeomTraits | a model of `Kernel`
  Item_ | a descriptor representing a given point. Must be a model of `Hashable`.
  PointMap | a model of `ReadablePropertyMap` whose key type `Item` and value type is `GeomTraits::Point_3`
  NormalMap | a model of `ReadablePropertyMap` whose key type is `Item` and value type is `GeomTraits::Vector_3`

Is model of
  `RegionType`

## Classes
struct | Primitive
| Primitive. More...

## Related Functions
(Note that these are not member functions.)
template<class PointSet3 >
using | Least_squares_cylinder_fit_region_for_point_set = Least_squares_cylinder_fit_region< typename Kernel_traits< typename PointSet3::Point_3 >::Kernel, typename PointSet3::Index, typename PointSet3::Point_map, typename PointSet3::Vector_map >
| shortcut to ease the definition of the class when using `CGAL::Point_set_3`.
template<class PointSet3 , typename NamedParameters = CGAL::parameters::Default_named_parameters>
Least_squares_cylinder_fit_region_for_point_set< PointSet3 > | make_least_squares_cylinder_fit_region (const PointSet3 &ps, const NamedParameters np=parameters::default_values())
| returns an instance of the sorting class to be used with `CGAL::Point_set_3`, with point and normal maps added to `np`.

## Types
using | FT = typename GeomTraits::FT
| Number type.
using | Item = Item_
| Item type.
using | Region = std::vector< Item >
using | Region_unordered_map = std::unordered_map< Item, std::size_t, internal::hash_item< Item > >
| Region map.
using | Region_index_map = boost::associative_property_map< Region_unordered_map >

## Initialization
template<typename NamedParameters = CGAL::parameters::Default_named_parameters>
| Least_squares_cylinder_fit_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 &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

## ◆ Least_squares_cylinder_fit_region()

template<typename GeomTraits , typename Item_ , typename PointMap , typename NormalMap >
template<typename NamedParameters = CGAL::parameters::Default_named_parameters>

CGAL::Shape_detection::Point_set::Least_squares_cylinder_fit_region< GeomTraits, Item_, PointMap, NormalMap >::Least_squares_cylinder_fit_region | ( | const NamedParameters & | np = `parameters::default_values()` | ) |

initializes all internal data structures.

Template Parameters

  NamedParameters | a sequence of Named Parameters

Parameters

  np | a sequence of Named Parameters among the ones listed below

Optional Named Parameters

  the maximum distance from a point to a cylinder Type: `GeomTraits::FT` Default: 1 |
  the maximum angle in degrees between the normal of a point and the radius of a cylinder Type: `GeomTraits::FT` Default: 25 degrees |
  the cos value computed as `cos(maximum_angle * PI / 180)`, this parameter can be used instead of the `maximum_angle` Type: `GeomTraits::FT` Default: `cos(25 * PI / 180)` |
  the minimum number of 3D points a region must have Type: `std::size_t` Default: 3 |
  the radius below which an estimated cylinder is considered as invalid and discarded Type: `GeomTraits::FT` Default: 0, no limit |
  the radius above which an estimated cylinder is considered as invalid and discarded. Type: `GeomTraits::FT` Default: +infinity, no limit |
  an instance of `PointMap` that maps an item to `GeomTraits::Point_3` Default: `PointMap()` |
  an instance of `NormalMap` that maps an item to `GeomTraits::Vector_3` Default: `NormalMap()` |
  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`
  `minimum_radius >= 0`
  `maximum_radius >= minimum_radius`

## Member Function Documentation

## ◆ is_part_of_region()

template<typename GeomTraits , typename Item_ , typename PointMap , typename NormalMap >

bool CGAL::Shape_detection::Point_set::Least_squares_cylinder_fit_region< GeomTraits, Item_, PointMap, NormalMap >::is_part_of_region | ( | const Item | query,
|  | const Region & | region
| ) |  | const

implements `RegionType::is_part_of_region()`.

This function controls if a point with the index `query_index` is within the `maximum_distance` from the corresponding cylinder and if the angle between its normal and the cylinder radius is within the `maximum_angle`. If both conditions are satisfied, it returns `true`, otherwise `false`.

Parameters

  query | item of the query point
  region | inlier items of the region

Returns
  Boolean `true` or `false`

## ◆ is_valid_region()

template<typename GeomTraits , typename Item_ , typename PointMap , typename NormalMap >

bool CGAL::Shape_detection::Point_set::Least_squares_cylinder_fit_region< GeomTraits, Item_, PointMap, NormalMap >::is_valid_region | ( | const Region & | region | ) | const

implements `RegionType::is_valid_region()`.

This function controls if the estimated radius is between `minimum_radius` and `maximum_radius` and if the `region` contains at least `min_region_size` points.

Parameters

  region | indices of points included in the region

Returns
  Boolean `true` or `false`

## ◆ primitive()

template<typename GeomTraits , typename Item_ , typename PointMap , typename NormalMap >

Primitive CGAL::Shape_detection::Point_set::Least_squares_cylinder_fit_region< GeomTraits, Item_, PointMap, NormalMap >::primitive | ( |  | ) | const

implements `RegionType::primitive()`.

This function provides the last primitive that has been fitted with the region.

Returns
  Primitive parameters that fits the region

Precondition
  `successful fitted primitive via successful call of update(region) with a sufficient large region`

## ◆ region_index_map()

template<typename GeomTraits , typename Item_ , typename PointMap , typename NormalMap >

Region_index_map CGAL::Shape_detection::Point_set::Least_squares_cylinder_fit_region< GeomTraits, Item_, PointMap, NormalMap >::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 PointMap , typename NormalMap >

bool CGAL::Shape_detection::Point_set::Least_squares_cylinder_fit_region< GeomTraits, Item_, PointMap, NormalMap >::update | ( | const Region & | region | ) |

implements `RegionType::update()`.

This function fits the least squares cylinder to all points from the `region`.

Parameters

  region | indices of points included in the region

Returns
  Boolean `true` if the cylinder fitting succeeded and `false` otherwise

Precondition
  `region.size() > 0`