CGAL 5.1.3 - Shape Detection
CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region< GeomTraits, PolygonMesh, FaceRange, VertexToPointMap > Class Template Reference

#include <CGAL/Shape_detection/Region_growing/Region_growing_on_polygon_mesh/Least_squares_plane_fit_region.h>

Definition

template<typename GeomTraits, typename PolygonMesh, typename FaceRange = typename PolygonMesh::Face_range, typename VertexToPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
class CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region< GeomTraits, PolygonMesh, FaceRange, VertexToPointMap >

Region type based on the quality of the least squares plane fit applied to faces of a polygon mesh.

This class fits a plane, using PCA, to chunks of faces in a polygon mesh 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
GeomTraitsmust be a model of Kernel.
PolygonMeshmust be a model of FaceListGraph.
FaceRangemust be a model of ConstRange whose iterator type is RandomAccessIterator and value type is the face type of a polygon mesh.
VertexToPointMapmust be an LvaluePropertyMap whose key type is the vertex type of a polygon mesh and value type is Kernel::Point_3.
Is Model Of:
RegionType
Examples:
Shape_detection/region_growing_on_polygon_mesh.cpp.

Types

typedef GeomTraits::FT FT
 Number type.
 

Initialization

 Least_squares_plane_fit_region (const PolygonMesh &pmesh, const FT distance_threshold=FT(1), const FT angle_threshold=FT(25), const std::size_t min_region_size=1, const VertexToPointMap vertex_to_point_map=VertexToPointMap(), const GeomTraits traits=GeomTraits())
 initializes all internal data structures. More...
 

Access

bool is_part_of_region (const std::size_t, const std::size_t query_index, const std::vector< std::size_t > &) const
 implements RegionType::is_part_of_region(). More...
 
bool is_valid_region (const std::vector< std::size_t > &region) const
 implements RegionType::is_valid_region(). More...
 
void update (const std::vector< std::size_t > &region)
 implements RegionType::update(). More...
 

Constructor & Destructor Documentation

◆ Least_squares_plane_fit_region()

template<typename GeomTraits , typename PolygonMesh , typename FaceRange = typename PolygonMesh::Face_range, typename VertexToPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region< GeomTraits, PolygonMesh, FaceRange, VertexToPointMap >::Least_squares_plane_fit_region ( const PolygonMesh &  pmesh,
const FT  distance_threshold = FT(1),
const FT  angle_threshold = FT(25),
const std::size_t  min_region_size = 1,
const VertexToPointMap  vertex_to_point_map = VertexToPointMap(),
const GeomTraits  traits = GeomTraits() 
)

initializes all internal data structures.

Parameters
pmeshan instance of PolygonMesh that represents a polygon mesh
distance_thresholdthe maximum distance from the furthest vertex of a face to a plane. Default is 1.
angle_thresholdthe maximum accepted angle in degrees between the normal of a face and the normal of a plane. Default is 25 degrees.
min_region_sizethe minimum number of faces a region must have. Default is 1.
vertex_to_point_mapan instance of VertexToPointMap that maps a polygon mesh vertex to Kernel::Point_3
traitsan instance of GeomTraits
Precondition
faces(pmesh).size() > 0
distance_threshold >= 0
angle_threshold >= 0 && angle_threshold <= 90
min_region_size > 0

Member Function Documentation

◆ is_part_of_region()

template<typename GeomTraits , typename PolygonMesh , typename FaceRange = typename PolygonMesh::Face_range, typename VertexToPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
bool CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region< GeomTraits, PolygonMesh, FaceRange, VertexToPointMap >::is_part_of_region ( const std::size_t  ,
const std::size_t  query_index,
const std::vector< std::size_t > &   
) const

implements RegionType::is_part_of_region().

This function controls if a face with the index query_index is within the distance_threshold from the corresponding plane and if the angle between its normal and the plane's normal is within the angle_threshold. If both conditions are satisfied, it returns true, otherwise false.

Parameters
query_indexindex of the query face

The first and third parameters are not used in this implementation.

Returns
Boolean true or false
Precondition
query_index >= 0 && query_index < faces(pmesh).size()

◆ is_valid_region()

template<typename GeomTraits , typename PolygonMesh , typename FaceRange = typename PolygonMesh::Face_range, typename VertexToPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
bool CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region< GeomTraits, PolygonMesh, FaceRange, VertexToPointMap >::is_valid_region ( const std::vector< std::size_t > &  region) const

implements RegionType::is_valid_region().

This function controls if the region contains at least min_region_size faces.

Parameters
regionindices of faces included in the region
Returns
Boolean true or false

◆ update()

template<typename GeomTraits , typename PolygonMesh , typename FaceRange = typename PolygonMesh::Face_range, typename VertexToPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
void CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region< GeomTraits, PolygonMesh, FaceRange, VertexToPointMap >::update ( const std::vector< std::size_t > &  region)

implements RegionType::update().

This function fits the least squares plane to all vertices of the faces from the region.

Parameters
regionindices of faces included in the region
Precondition
region.size() > 0