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

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

Definition

template<typename GeomTraits, typename PolygonMesh, typename VertexToPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::const_type>
class CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region< GeomTraits, PolygonMesh, 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
GeomTraitsa model of Kernel
PolygonMesha model of FaceListGraph
VertexToPointMapa model of ReadablePropertyMap 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_lines_on_segment_set.cpp, and Shape_detection/region_growing_planes_on_polygon_mesh.cpp.

Types

typedef GeomTraits::FT FT
 Number type.
 
using Item = face_descriptor
 Item type.
 
using Region = std::vector< Item >
 
using Primitive = typename GeomTraits::Plane_3
 Primitive.
 
using Region_index_map = typename boost::property_map< Face_graph, CGAL::dynamic_face_property_t< std::size_t > >::const_type
 Region map.
 

Initialization

template<typename NamedParameters = CGAL::parameters::Default_named_parameters>
 Least_squares_plane_fit_region (const PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
 initializes all internal data structures. More...
 

Access

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

Constructor & Destructor Documentation

◆ Least_squares_plane_fit_region()

template<typename GeomTraits , typename PolygonMesh , typename VertexToPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::const_type>
template<typename NamedParameters = CGAL::parameters::Default_named_parameters>
CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region< GeomTraits, PolygonMesh, VertexToPointMap >::Least_squares_plane_fit_region ( const PolygonMesh &  pmesh,
const NamedParameters &  np = parameters::default_values() 
)

initializes all internal data structures.

Template Parameters
NamedParametersa sequence of Named Parameters
Parameters
pmeshan instance of PolygonMesh that represents a polygon mesh
npa sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • the maximum distance from the furthest vertex of a face to a plane
  • Type: GeomTraits::FT
  • Default: 1
  • the maximum angle in degrees between the normal of a face and the normal of a plane
  • 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 faces a region must have
  • Type: std::size_t
  • Default: 1
  • an instance of VertexToPointMap that maps a polygon mesh vertex to Kernel::Point_3
  • Default: boost::get(CGAL::vertex_point, pmesh)
  • an instance of GeomTraits
  • Default: GeomTraits()
Precondition
faces(tmesh).size() > 0
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 PolygonMesh , typename VertexToPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::const_type>
bool CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region< GeomTraits, PolygonMesh, VertexToPointMap >::is_part_of_region ( const Item  query,
const Region &   
) const

implements RegionType::is_part_of_region().

This function controls if the face query is within the maximum_distance from the corresponding plane and if the angle between its normal and the plane's normal is within the maximum_angle. If both conditions are satisfied, it returns true, otherwise false.

Parameters
queryItem of the query face

The last parameter is not used in this implementation.

Returns
Boolean true or false
Precondition
query is a valid const_iterator of input_range

◆ is_valid_region()

template<typename GeomTraits , typename PolygonMesh , typename VertexToPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::const_type>
bool CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region< GeomTraits, PolygonMesh, VertexToPointMap >::is_valid_region ( const Region &  region) const

implements RegionType::is_valid_region().

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

Parameters
regionFaces of the region represented as Items.
Returns
Boolean true or false

◆ primitive()

template<typename GeomTraits , typename PolygonMesh , typename VertexToPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::const_type>
Primitive CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region< GeomTraits, PolygonMesh, VertexToPointMap >::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 PolygonMesh , typename VertexToPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::const_type>
Region_index_map CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region< GeomTraits, PolygonMesh, VertexToPointMap >::region_index_map ( )

implements RegionType::region_index_map().

This function creates an empty property map that maps each face to a std::size_t

◆ update()

template<typename GeomTraits , typename PolygonMesh , typename VertexToPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::const_type>
bool CGAL::Shape_detection::Polygon_mesh::Least_squares_plane_fit_region< GeomTraits, PolygonMesh, VertexToPointMap >::update ( const Region &  region)

implements RegionType::update().

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

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