CGAL 5.5.2 - Shape Detection
|
#include <CGAL/Shape_detection/Region_growing/Region_growing_on_polygon_mesh/Least_squares_plane_fit_region.h>
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.
GeomTraits | must be a model of Kernel . |
PolygonMesh | must be a model of FaceListGraph . |
FaceRange | must be a model of ConstRange whose iterator type is RandomAccessIterator and value type is the face type of a polygon mesh. |
VertexToPointMap | must be an LvaluePropertyMap whose key type is the vertex type of a polygon mesh and value type is Kernel::Point_3 . |
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 > ®ion) const |
implements RegionType::is_valid_region() . More... | |
void | update (const std::vector< std::size_t > ®ion) |
implements RegionType::update() . More... | |
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.
pmesh | an instance of PolygonMesh that represents a polygon mesh |
distance_threshold | the maximum distance from the furthest vertex of a face to a plane. Default is 1. |
angle_threshold | the maximum accepted angle in degrees between the normal of a face and the normal of a plane. Default is 25 degrees. |
min_region_size | the minimum number of faces a region must have. Default is 1. |
vertex_to_point_map | an instance of VertexToPointMap that maps a polygon mesh vertex to Kernel::Point_3 |
traits | an instance of GeomTraits |
faces(pmesh).size() > 0
distance_threshold >= 0
angle_threshold >= 0 && angle_threshold <= 90
min_region_size > 0
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
.
query_index | index of the query face |
The first and third parameters are not used in this implementation.
true
or false
query_index >= 0 && query_index < faces(pmesh).size()
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.
region | indices of faces included in the region |
true
or false
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
.
region | indices of faces included in the region |
region.size() > 0