ReUseX  0.0.1
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
ReUseX::geometry Namespace Reference

Classes

class  CellComplex
struct  MeshOptions
 Options for mesh generation. More...
class  Registry
class  SceneGraph
class  Solidifier
 Solidifier solves room segmentation using Mixed Integer Programming. More...

Typedefs

template<typename Scalar>
using Plane = Eigen::Matrix<Scalar, 4, 1>
template<typename Scalar>
using PlaneVector

Functions

pcl::PolygonMeshPtr mesh (CloudConstPtr cloud, CloudNConstPtr normals, EigenVectorContainer< double, 4 > &planes, EigenVectorContainer< double, 3 > &centroids, std::vector< IndicesPtr > &inliers, CloudLConstPtr rooms, MeshOptions const opt=MeshOptions{}, std::shared_ptr< ReUseX::visualize::Visualizer > viewer=nullptr)
 Generate a mesh from point cloud and geometric primitives.
template<typename Scalar, typename PointT>
auto regularizePlanes (PlaneVector< Scalar > &planes, typename pcl::PointCloud< PointT >::ConstPtr points, std::vector< pcl::IndicesPtr > &inliers, double angle_threshold=25.0, double distance_threshold=0.01)
auto segment_planes_impl (CloudConstPtr cloud, CloudNConstPtr normals, const float angle_threshold, const float plane_dist_threshold, const int min_inliers, const float radius, const float interval_0, const float interval_factor, const bool visualize) -> std::tuple< CloudLPtr, CloudLocPtr, CloudNPtr >
 BOOST_PARAMETER_FUNCTION ((std::tuple< CloudLPtr, CloudLocPtr, CloudNPtr >), segment_planes, tag,(required(cloud,(CloudConstPtr))(normals,(CloudNConstPtr)))(optional(angle_threshold,(float), 25.0)(plane_dist_threshold,(float), 0.07)(min_inliers,(int), 1000)(radius,(float), 0.5)(interval_0,(int), 16)(interval_factor,(float), 1.5)(visualize,(bool), false)))
auto segment_rooms_impl (CloudConstPtr cloud, CloudNConstPtr normals, CloudLConstPtr planes, const float grid_size, const float inflation, const float expansion, const float pruning_threshold, const float convergence_threshold, const int max_iter, const bool visualize) -> CloudLPtr
 BOOST_PARAMETER_FUNCTION ((CloudLPtr), segment_rooms, tag,(required(cloud,(CloudConstPtr))(normals,(CloudNConstPtr))(planes,(CloudLConstPtr)))(optional(grid_size,(double), 0.5)(inflation,(double), 2.0)(expansion,(int), 2)(pruning_threshold,(double), 0.0001)(convergence_threshold,(double), 1e-8)(max_iter,(int), 100)(visualize,(bool), false)))
pcl::TextureMesh::Ptr texture_mesh_with_cloud (pcl::PolygonMesh::Ptr mesh, CloudConstPtr cloud)
pcl::TextureMesh::Ptr texture_mesh (pcl::PolygonMesh::Ptr mesh, std::map< int, rtabmap::Transform > const &poses, std::map< int, rtabmap::Signature > const &nodes)
auto dist_plane_point (const Eigen::Vector4d &plane, const Eigen::Vector3d &point) -> double
 Calculate distance from a point to a plane.
auto make_pairs (EigenVectorContainer< double, 4 > &planes, std::vector< IndicesPtr > &inliers, EigenVectorContainer< double, 3 > &centroids, const double threshold=0.6, const double new_plane_offset=0.5) -> std::vector< std::pair< size_t, size_t > >
 Create pairs of opposite parallel planes.
auto force_orthogonal_planes (EigenVectorContainer< double, 4 > &planes, const double threshold=0.1, const Eigen::Matrix< double, 3, 1 > &up=Eigen::Matrix< double, 3, 1 >(0, 0, 1)) -> EigenVectorContainer< double, 4 >
 Force planes to be orthogonal to a reference direction.
auto compute_number_of_inliers (CloudConstPtr cloud, Eigen::Vector4d const &plane, IndicesConstPtr indices, const float threshold=0.2) -> size_t
 Count number of inliers for a plane.
auto merge_planes (EigenVectorContainer< double, 4 > const &planes_, std::vector< IndicesPtr > const &inliers_, EigenVectorContainer< double, 3 > const &centroids_, CloudConstPtr cloud, const double angle_threshold=0.1, const double distance_threshold=0.5, const double min_overlap=0.8) -> std::tuple< EigenVectorContainer< double, 4 >, std::vector< IndicesPtr >, EigenVectorContainer< double, 3 > >
 Merge similar planes based on angle, distance, and overlap.
auto separate_planes (const EigenVectorContainer< double, 4 > &planes, const Eigen::Vector3d &up=Eigen::Vector3d(0, 0, 1), const double epsilon=0.1) -> std::tuple< std::vector< size_t >, std::vector< size_t > >
 Separate planes into horizontal and vertical based on up vector.
template<typename CloudPtr>
auto compute_polygon_normal (const pcl::Vertices &poly, const CloudPtr &cloud) -> Eigen::Vector3f
 Compute the normal vector of a polygon.

Typedef Documentation

◆ Plane

template<typename Scalar>
using ReUseX::geometry::Plane = Eigen::Matrix<Scalar, 4, 1>

Definition at line 74 of file regularization.hpp.

◆ PlaneVector

template<typename Scalar>
using ReUseX::geometry::PlaneVector
Initial value:
std::vector<Plane<Scalar>, Eigen::aligned_allocator<Plane<Scalar>>>

Definition at line 77 of file regularization.hpp.

Function Documentation

◆ BOOST_PARAMETER_FUNCTION() [1/2]

ReUseX::geometry::BOOST_PARAMETER_FUNCTION ( (CloudLPtr) ,
segment_rooms ,
tag ,
(required(cloud,(CloudConstPtr))(normals,(CloudNConstPtr))(planes,(CloudLConstPtr)))(optional(grid_size,(double), 0.5)(inflation,(double), 2.0)(expansion,(int), 2)(pruning_threshold,(double), 0.0001)(convergence_threshold,(double), 1e-8)(max_iter,(int), 100)(visualize,(bool), false))  )

Definition at line 59 of file segment_rooms.hpp.

References BOOST_PARAMETER_FUNCTION(), and segment_rooms_impl().

◆ BOOST_PARAMETER_FUNCTION() [2/2]

ReUseX::geometry::BOOST_PARAMETER_FUNCTION ( (std::tuple< CloudLPtr, CloudLocPtr, CloudNPtr >) ,
segment_planes ,
tag ,
(required(cloud,(CloudConstPtr))(normals,(CloudNConstPtr)))(optional(angle_threshold,(float), 25.0)(plane_dist_threshold,(float), 0.07)(min_inliers,(int), 1000)(radius,(float), 0.5)(interval_0,(int), 16)(interval_factor,(float), 1.5)(visualize,(bool), false))  )

◆ compute_number_of_inliers()

auto ReUseX::geometry::compute_number_of_inliers ( CloudConstPtr cloud,
Eigen::Vector4d const & plane,
IndicesConstPtr indices,
const float threshold = 0.2 ) -> size_t

Count number of inliers for a plane.

Parameters
cloudInput point cloud.
planePlane coefficients.
indicesPoint indices to check.
thresholdDistance threshold for inliers. Default 0.2.
Returns
Number of inliers.

◆ compute_polygon_normal()

template<typename CloudPtr>
auto ReUseX::geometry::compute_polygon_normal ( const pcl::Vertices & poly,
const CloudPtr & cloud ) -> Eigen::Vector3f

Compute the normal vector of a polygon.

Calculates the normal vector of a polygon using the cross product sum method (also known as Newell's method). The normal is automatically normalized.

Template Parameters
CloudPtrPoint cloud pointer type (const or non-const, e.g., CloudLocConstPtr).
Parameters
polyPolygon with vertex indices.
cloudPoint cloud containing the vertices (read-only).
Returns
Normalized normal vector of the polygon.
Exceptions
std::invalid_argumentif polygon has fewer than 3 vertices.
std::runtime_errorif polygon is degenerate (zero normal magnitude).

Definition at line 128 of file utils.hpp.

◆ dist_plane_point()

auto ReUseX::geometry::dist_plane_point ( const Eigen::Vector4d & plane,
const Eigen::Vector3d & point ) -> double

Calculate distance from a point to a plane.

Parameters
planePlane coefficients (nx, ny, nz, d) where n is the normal.
point3D point coordinates.
Returns
Signed distance from point to plane.

◆ force_orthogonal_planes()

auto ReUseX::geometry::force_orthogonal_planes ( EigenVectorContainer< double, 4 > & planes,
const double threshold = 0.1,
const Eigen::Matrix< double, 3, 1 > & up = Eigen::Matrix< double, 3, 1 >(0, 0, 1) ) -> EigenVectorContainer< double, 4 >

Force planes to be orthogonal to a reference direction.

Adjusts plane normals to be either parallel or perpendicular to the up vector.

Parameters
planesPlane coefficients to adjust.
thresholdAngular threshold for orthogonality. Default 0.1.
upReference up vector. Default (0, 0, 1).
Returns
Adjusted plane coefficients.

◆ make_pairs()

auto ReUseX::geometry::make_pairs ( EigenVectorContainer< double, 4 > & planes,
std::vector< IndicesPtr > & inliers,
EigenVectorContainer< double, 3 > & centroids,
const double threshold = 0.6,
const double new_plane_offset = 0.5 ) -> std::vector< std::pair< size_t, size_t > >

Create pairs of opposite parallel planes.

Finds pairs of planes with opposite normals within a distance threshold. Creates new planes for unpaired planes.

Parameters
planesPlane coefficients.
inliersIndices of points belonging to each plane.
centroidsPlane centroids.
thresholdMaximum distance threshold for pairing. Default 0.6.
new_plane_offsetOffset for creating new planes. Default 0.5.
Returns
Vector of plane index pairs.

◆ merge_planes()

auto ReUseX::geometry::merge_planes ( EigenVectorContainer< double, 4 > const & planes_,
std::vector< IndicesPtr > const & inliers_,
EigenVectorContainer< double, 3 > const & centroids_,
CloudConstPtr cloud,
const double angle_threshold = 0.1,
const double distance_threshold = 0.5,
const double min_overlap = 0.8 ) -> std::tuple< EigenVectorContainer< double, 4 >, std::vector< IndicesPtr >, EigenVectorContainer< double, 3 > >

Merge similar planes based on angle, distance, and overlap.

Parameters
planes_Input plane coefficients.
inliers_Inliers for each plane.
centroids_Plane centroids.
cloudPoint cloud.
angle_thresholdAngular similarity threshold. Default 0.1.
distance_thresholdDistance threshold for merging. Default 0.5.
min_overlapMinimum overlap ratio for merging. Default 0.8.
Returns
Tuple of (merged planes, merged inliers, merged centroids).

◆ mesh()

pcl::PolygonMeshPtr ReUseX::geometry::mesh ( CloudConstPtr cloud,
CloudNConstPtr normals,
EigenVectorContainer< double, 4 > & planes,
EigenVectorContainer< double, 3 > & centroids,
std::vector< IndicesPtr > & inliers,
CloudLConstPtr rooms,
MeshOptions const opt = MeshOptions{},
std::shared_ptr< ReUseX::visualize::Visualizer > viewer = nullptr )

Generate a mesh from point cloud and geometric primitives.

Parameters
cloudInput point cloud.
normalsPoint cloud normals.
planesDetected plane coefficients.
centroidsPlane centroids.
inliersIndices of points belonging to each plane.
roomsRoom labels for points.
optMesh generation options.
viewerOptional visualizer for debugging.
Returns
Generated polygon mesh.

Referenced by texture_mesh(), and texture_mesh_with_cloud().

◆ regularizePlanes()

template<typename Scalar, typename PointT>
auto ReUseX::geometry::regularizePlanes ( PlaneVector< Scalar > & planes,
typename pcl::PointCloud< PointT >::ConstPtr points,
std::vector< pcl::IndicesPtr > & inliers,
double angle_threshold = 25.0,
double distance_threshold = 0.01 )

Definition at line 81 of file regularization.hpp.

◆ segment_planes_impl()

auto ReUseX::geometry::segment_planes_impl ( CloudConstPtr cloud,
CloudNConstPtr normals,
const float angle_threshold,
const float plane_dist_threshold,
const int min_inliers,
const float radius,
const float interval_0,
const float interval_factor,
const bool visualize ) -> std::tuple< CloudLPtr, CloudLocPtr, CloudNPtr >

◆ segment_rooms_impl()

auto ReUseX::geometry::segment_rooms_impl ( CloudConstPtr cloud,
CloudNConstPtr normals,
CloudLConstPtr planes,
const float grid_size,
const float inflation,
const float expansion,
const float pruning_threshold,
const float convergence_threshold,
const int max_iter,
const bool visualize ) -> CloudLPtr

◆ separate_planes()

auto ReUseX::geometry::separate_planes ( const EigenVectorContainer< double, 4 > & planes,
const Eigen::Vector3d & up = Eigen::Vector3d(0, 0, 1),
const double epsilon = 0.1 ) -> std::tuple< std::vector< size_t >, std::vector< size_t > >

Separate planes into horizontal and vertical based on up vector.

Parameters
planesPlane coefficients.
upReference up vector. Default (0, 0, 1).
epsilonAngular epsilon for classification. Default 0.1.
Returns
Tuple of (horizontal indices, vertical indices).

◆ texture_mesh()

pcl::TextureMesh::Ptr ReUseX::geometry::texture_mesh ( pcl::PolygonMesh::Ptr mesh,
std::map< int, rtabmap::Transform > const & poses,
std::map< int, rtabmap::Signature > const & nodes )

References mesh().

◆ texture_mesh_with_cloud()

pcl::TextureMesh::Ptr ReUseX::geometry::texture_mesh_with_cloud ( pcl::PolygonMesh::Ptr mesh,
CloudConstPtr cloud )

References mesh().