ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
create_windows.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6
7#include "reusex/geometry/BuildingComponent.hpp"
8#include "reusex/types.hpp"
9
10#include <Eigen/Core>
11#include <pcl/PolygonMesh.h>
12
13#include <cstdint>
14#include <functional>
15#include <map>
16#include <string>
17#include <vector>
18
19namespace reusex::geometry {
20
27 Eigen::Vector4d plane;
28 Eigen::Vector3d centroid;
29 Eigen::Vector3d normal;
30
35 std::vector<std::vector<Eigen::Vector3d>> boundary_loops;
36
37 std::vector<int> face_indices;
38};
39
42
49inline constexpr float kWallVerticalityGateOff = 1.0f;
50
68
71 std::vector<BuildingComponent> components;
72 std::vector<int> unmatched_instances;
73};
74
87std::vector<WallCandidate>
88extract_wall_candidates(const pcl::PolygonMesh &mesh,
89 float normal_z_threshold = kWallVerticalityGateOff,
90 float coplanarity_angle_deg = 10.0f);
91
96using ResolveInstanceGuidFn = std::function<std::string(uint32_t)>;
97
112 const std::map<uint32_t, uint32_t> &instance_to_semantic,
113 const pcl::PolygonMesh &mesh,
114 const std::vector<uint32_t> &window_semantic_labels,
115 const CreateWindowsOptions &options = {},
116 const ResolveInstanceGuidFn &resolve_instance_guid = {});
117
118} // namespace reusex::geometry
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{})
Generate a mesh from point cloud and geometric primitives.
CreateWindowsResult create_windows(CloudConstPtr cloud, CloudLConstPtr instance_labels, const std::map< uint32_t, uint32_t > &instance_to_semantic, const pcl::PolygonMesh &mesh, const std::vector< uint32_t > &window_semantic_labels, const CreateWindowsOptions &options={}, const ResolveInstanceGuidFn &resolve_instance_guid={})
Create window BuildingComponents from instance-labeled points and wall geometry.
std::function< std::string(uint32_t)> ResolveInstanceGuidFn
Resolves the stable GUID of an instance from its integer label id.
constexpr float kWallVerticalityGateOff
Verticality-gate threshold at which the gate is off (#326).
WindowBoundaryMode
How to compute the window boundary polygon.
std::vector< WallCandidate > extract_wall_candidates(const pcl::PolygonMesh &mesh, float normal_z_threshold=kWallVerticalityGateOff, float coplanarity_angle_deg=10.0f)
Extract planar wall candidates from a triangle mesh.
typename CloudL::ConstPtr CloudLConstPtr
typename Cloud::ConstPtr CloudConstPtr
Configuration for the create_windows pipeline.
float coplanarity_angle_deg
Max angle deviation within wall component.
float alpha
ConcaveHull alpha for polyline mode.
float wall_normal_z_threshold
Verticality gate on wall candidates: a coplanar mesh region is kept only when |normal....
float wall_offset
Offset along outward wall normal (meters).
bool include_internal
Include windows inside mesh volume (default: false).
std::vector< BuildingComponent > components
std::vector< int > unmatched_instances
Instance IDs with no wall found.
A connected component of coplanar mesh faces that may host a window.
std::vector< std::vector< Eigen::Vector3d > > boundary_loops
Boundary loops ordered by half-edge traversal (outer loop first, then holes) Each loop is a sequence ...
std::vector< int > face_indices
Mesh face indices in this component.
Eigen::Vector3d normal
Unit outward normal of the component.
Eigen::Vector3d centroid
Area-weighted centroid of component faces.
Eigen::Vector4d plane
Hessian normal form [a,b,c,d]: ax+by+cz+d=0.