CGAL 6.2 - Shape Detection: CGAL::Shape_detection::Shape_base< Traits > Class Template Reference

CGAL 6.2 - Shape Detection

Loading...
Searching...
No Matches
List of all members | Public Types | Public Member Functions | Protected Member Functions
CGAL::Shape_detection::Shape_base< Traits > Class Template Referenceabstract
Reference Manual » Efficient RANSAC » Shapes

`#include <CGAL/Shape_detection/Efficient_RANSAC/Shape_base.h>`

Inherited by CGAL::Shape_detection::Cone< Traits >, CGAL::Shape_detection::Cylinder< Traits >, CGAL::Shape_detection::Plane< Traits >, CGAL::Shape_detection::Sphere< Traits >, and CGAL::Shape_detection::Torus< Traits >.

## Definition

template<class Traits>
class CGAL::Shape_detection::Shape_base< Traits >

Base class for shape types that defines an interface to construct a shape from a set of points and to compute the point distance and normal deviation from the surface normal.

It is used during detection to identify the inliers from the input data and to extract the largest connected component in the inlier points.

Examples
  Shape_detection/include/efficient_RANSAC_with_custom_shape.h.

## Public Types
typedef Traits::FT | FT
| Number type.
typedef Traits::Point_3 | Point_3
| Point type.
typedef Traits::Vector_3 | Vector_3
| Vector type.

## Public Member Functions
const std::vector< std::size_t > & | indices_of_assigned_points () const
| Returns the indices of the points in the input range assigned to this shape.
virtual std::string | info () const
| Returns a string containing the shape type and the numerical parameters.
virtual FT | squared_distance (const Point_3 &p) const =0
| Computes the squared Euclidean distance from the query point `p` to the shape.

## Protected Member Functions
virtual void | create_shape (const std::vector< std::size_t > &indices)=0
| Constructs the shape based on a minimal set of samples from the input data.
virtual std::size_t | connected_component (std::vector< std::size_t > &indices, FT cluster_epsilon)
| Determines the largest cluster of inlier points.
std::size_t | connected_component_kdTree (std::vector< std::size_t > &indices, FT cluster_epsilon)
| Determines the largest cluster with a point-to-point distance not larger than `cluster_epsilon`.
virtual void | squared_distance (const std::vector< std::size_t > &indices, std::vector< FT > &distances) const =0
| Computes the squared Euclidean distance from a set of points to the shape.
virtual void | cos_to_normal (const std::vector< std::size_t > &indices, std::vector< FT > &angles) const =0
| Computes the deviation of the point normal from the surface normal at the projected point in form of the dot product and writes the result into the provided `angles` vector.
virtual std::size_t | minimum_sample_size () const =0
| Returns minimal number of sample points required for construction.
boost::property_traits< typenameTraits::Point_map >::reference | point (std::size_t i) const
| Retrieves the point location from its index.
boost::property_traits< typenameTraits::Normal_map >::reference | normal (std::size_t i) const
| Retrieves the normal vector from its index.
const Traits & | traits () const
| Retrieves the traits class.

## Member Function Documentation

## ◆ connected_component()

template<class Traits >

virtual std::size_t CGAL::Shape_detection::Shape_base< Traits >::connected_component | ( | std::vector< std::size_t > & | indices,
|  | FT | cluster_epsilon
| ) |  |
| protectedvirtual

Determines the largest cluster of inlier points.

A point belongs to a cluster if there is a point in the cluster closer than `cluster_epsilon` distance.

## ◆ connected_component_kdTree()

template<class Traits >

std::size_t CGAL::Shape_detection::Shape_base< Traits >::connected_component_kdTree | ( | std::vector< std::size_t > & | indices,
|  | FT | cluster_epsilon
| ) |  |
| protected

Determines the largest cluster with a point-to-point distance not larger than `cluster_epsilon`.

This general version performs a region growing within the inliers using a Kd-tree.

## ◆ squared_distance()

template<class Traits >

virtual void CGAL::Shape_detection::Shape_base< Traits >::squared_distance | ( | const std::vector< std::size_t > & | indices,
|  | std::vector< FT > & | distances
| ) |  | const
| protectedpure virtual

Computes the squared Euclidean distance from a set of points to the shape.

The distances will be stored in the so called parameter.