Skip to content

Commit

Permalink
Update core and roofer to cgal60
Browse files Browse the repository at this point in the history
  • Loading branch information
ipadjen committed Oct 3, 2024
1 parent 05be3fd commit 7a2810c
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions src/Building.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ void Building::get_cityjson_info(nlohmann::json& b) const {

void Building::get_cityjson_semantics(nlohmann::json& g) const { // Temp for checking CGAL mesh properties
Face_property semantics;
bool foundProperty;
boost::tie(semantics, foundProperty) = m_mesh.property_map<face_descriptor, std::string>("f:semantics");
// auto semantics = m_mesh.property_map<face_descriptor, std::string>("f:semantics");
if (!foundProperty) throw city4cfd_error("Semantic property map not found!");
auto semanticsMap = m_mesh.property_map<face_descriptor, std::string>("f:semantics");
if (semanticsMap.has_value()) {
semantics = semanticsMap.value();
} else throw city4cfd_error("Semantic property map not found!");

std::unordered_map<std::string, int> surfaceId;
surfaceId["RoofSurface"] = 0; g["semantics"]["surfaces"][0]["type"] = "RoofSurface";
Expand Down
7 changes: 3 additions & 4 deletions src/PointCloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "Building.h"
#include "Quadtree/Quadtree.h"

#include <boost/locale.hpp>
#include <CGAL/Polygon_mesh_processing/remesh.h>
#include <CGAL/Polygon_mesh_processing/smooth_shape.h>
#include <CGAL/wlop_simplify_and_regularize_point_set.h>
Expand Down Expand Up @@ -241,7 +240,7 @@ void PointCloud::buffer_flat_edges(const PolyFeaturesPtr& avgFeatures,
typedef CGAL::Polygon_offset_builder_traits_2<EPICK> OffsetBuilderTraits;
typedef CGAL::Polygon_offset_builder_2<Ss, OffsetBuilderTraits, Polygon_2> OffsetBuilder;

typedef boost::shared_ptr<Polygon_2> ContourPtr;
typedef std::shared_ptr<Polygon_2> ContourPtr;
typedef std::vector<ContourPtr> ContourSequence;
// get info using the original point cloud
// std::vector<double> offsets{0.001, 0.2};
Expand All @@ -252,7 +251,7 @@ void PointCloud::buffer_flat_edges(const PolyFeaturesPtr& avgFeatures,
//for (auto& f: avgFeatures) { // MSVC doesn't like range loop with OMP
auto& poly = avgFeatures[i]->get_poly().outer_boundary();
// set the frame
boost::optional<double> margin = CGAL::compute_outer_frame_margin(poly.begin(), poly.end(), offsets.back());
auto margin = CGAL::compute_outer_frame_margin(poly.begin(), poly.end(), offsets.back());
CGAL::Bbox_2 bbox = CGAL::bbox_2(poly.begin(), poly.end());
// Compute the boundaries of the frame
double fxmin = bbox.xmin() - *margin;
Expand All @@ -271,7 +270,7 @@ void PointCloud::buffer_flat_edges(const PolyFeaturesPtr& avgFeatures,
poly.reverse_orientation();
ssb.enter_contour(poly.begin(), poly.end());
// Construct the skeleton
boost::shared_ptr<Ss> ss = ssb.construct_skeleton();
auto ss = ssb.construct_skeleton();
// Proceed only if the skeleton was correctly constructed.
if (ss) {
for (auto& offset: offsets) {
Expand Down
4 changes: 2 additions & 2 deletions src/Terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
Terrain::Terrain()
: TopoFeature(0), m_cdt(), m_surfaceLayersTerrain(),
m_constrainedPolys(), m_vertexFaceMap(), m_extraConstrainedEdges(),
m_searchTree(Config::get().searchtree_bucket_size) {}
m_searchTree() {}

Terrain::Terrain(int pid)
: TopoFeature(pid), m_cdt(), m_surfaceLayersTerrain(),
m_constrainedPolys(), m_vertexFaceMap(), m_extraConstrainedEdges(),
m_searchTree(Config::get().searchtree_bucket_size) {}
m_searchTree() {}

Terrain::~Terrain() = default;

Expand Down
12 changes: 6 additions & 6 deletions thirdparty/roofer/src/reconstruction/ArrangementBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ typedef CGAL::Arr_face_overlay_traits<Arrangement_2,

// An arrangement observer, used to receive notifications of face splits and
// to update the indices of the newly created faces.
class Face_index_observer : public CGAL::Arr_observer<Arrangement_2>
class Face_index_observer : public CGAL::Arr_observer<roofer::Arrangement_2>
{
private:
int n_faces; // The current number of faces.
Expand All @@ -91,8 +91,8 @@ class Face_index_observer : public CGAL::Arr_observer<Arrangement_2>
float elevation=0;
Plane plane;
public:
Face_index_observer (Arrangement_2& arr, bool is_footprint, size_t pid, float elevation, Plane plane) :
CGAL::Arr_observer<Arrangement_2> (arr),
Face_index_observer (roofer::Arrangement_2& arr, bool is_footprint, size_t pid, float elevation, Plane plane) :
CGAL::Arr_observer<roofer::Arrangement_2> (arr),
n_faces (0), in_footprint(is_footprint), plane_id(pid), elevation(elevation), plane(plane)
{
CGAL_precondition (arr.is_empty());
Expand All @@ -111,14 +111,14 @@ class Face_index_observer : public CGAL::Arr_observer<Arrangement_2>
n_faces++;
}
};
class Face_split_observer : public CGAL::Arr_observer<Arrangement_2>
class Face_split_observer : public CGAL::Arr_observer<roofer::Arrangement_2>
{
private:
int n_faces; // The current number of faces.
bool hole_mode=false;
public:
Face_split_observer (Arrangement_2& arr) :
CGAL::Arr_observer<Arrangement_2> (arr),
Face_split_observer (roofer::Arrangement_2& arr) :
CGAL::Arr_observer<roofer::Arrangement_2> (arr),
n_faces (0)
{
CGAL_precondition (arr.is_empty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace roofer::detection {
// arr_common_face(edge->source(), edge->target(), common_face);
auto result = CGAL::intersection(Segment_2(e_source, e_target), segment);
if (result) {
if (auto p = boost::get<Point_2>(&*result)) {
if (auto p = std::get_if<Point_2>(&*result)) {
// std::cout << "\tp " << *p << std::endl;
// std::cout << "\tp (geo) " << CGAL::to_double(p->x())+CGAL::to_double(geo_p.x()) << ", " << CGAL::to_double(p->y())+CGAL::to_double(geo_p.y()) << std::endl;
// check if point of intersection is practically at the same coordinates of one of the edge's end points
Expand Down
4 changes: 2 additions & 2 deletions thirdparty/roofer/src/reconstruction/ArrangementExtruder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ namespace roofer::detection {
auto l_a = EPECK::Line_3(EPECK::Point_3(p1.x(), p1.y(), h1a), EPECK::Point_3(p2.x(), p2.y(), h2a));
auto l_b = EPECK::Line_3(EPECK::Point_3(p1.x(), p1.y(), h1b), EPECK::Point_3(p2.x(), p2.y(), h2b));
auto result = CGAL::intersection(l_a, l_b);
auto px = boost::get<typename EPECK::Point_3>(&*result);
auto px = std::get_if<typename EPECK::Point_3>(&*result);

// TODO: check if distance from px to p1 and p2 is longer than snap_tolerance?

Expand Down Expand Up @@ -334,7 +334,7 @@ namespace roofer::detection {
auto l_a = EPECK::Line_3(EPECK::Point_3(p1.x(), p1.y(), h1a), EPECK::Point_3(p2.x(), p2.y(), h2a));
auto l_b = EPECK::Line_3(EPECK::Point_3(p1.x(), p1.y(), h1b), EPECK::Point_3(p2.x(), p2.y(), h2b));
auto result = CGAL::intersection(l_a, l_b);
auto px = boost::get<typename EPECK::Point_3>(&*result);
auto px = std::get_if<typename EPECK::Point_3>(&*result);

// TODO: check if distance from px to p1 and p2 is longer than snap_tolerance?

Expand Down
4 changes: 2 additions & 2 deletions thirdparty/roofer/src/reconstruction/ArrangementSnapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ namespace arragementsnapper {
auto obj = walk_pl.locate( Walk_pl::Arrangement_2::Point_2(p.x(), p.y()) );

// std::cout << "The point (" << p << ") is located ";
if (auto f = boost::get<Face_const_handle>(&obj)) { // located inside a face
if (auto f = std::get_if<Face_const_handle>(&obj)) { // located inside a face
// std::cout << "inside "
// << (((*f)->is_unbounded()) ? "the unbounded" : "a bounded")
// << " face." << std::endl;
Expand Down Expand Up @@ -476,7 +476,7 @@ namespace arragementsnapper {

auto obj = walk_pl.locate( Walk_pl::Arrangement_2::Point_2(p.x(), p.y()) );

if (auto f = boost::get<Face_const_handle>(&obj)) { // located inside a face
if (auto f = std::get_if<Face_const_handle>(&obj)) { // located inside a face
// arrFace->data() = (*f)->data();
canidate_faces[arr.non_const_handle(*f)] += cdt.triangle(fit).area();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ namespace linereg {
Segment_2 s(a_2d.target(), b_2d.source());
auto result = CGAL::intersection(l_a, l_b);
if (result) {
if (auto p = std::get<Point_2>(&*result)) {
if (auto p = std::get_if<Point_2>(&*result)) {
if (CGAL::squared_distance(*p, s) < snap_threshold) {
double z = -plane.a()/plane.c() * p->x() - plane.b()/plane.c()*p->y() - plane.d()/plane.c();
ring_pts.push_back( Point_3(p->x(), p->y(), z) );
Expand Down
3 changes: 2 additions & 1 deletion thirdparty/roofer/src/reconstruction/PlaneIntersector.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "PlaneIntersector.hpp"

#include <map>
#include <optional>

namespace roofer::detection {

Expand Down Expand Up @@ -72,7 +73,7 @@ namespace roofer::detection {
auto result = CGAL::intersection(plane_hi, plane_lo);
if (result) {
// bound the line to extend of one plane's inliers
if (auto l = boost::get<typename EPICK::Line_3>(&*result)) {
if (auto l = std::get_if<typename EPICK::Line_3>(&*result)) {
Point pmin_lo, pmax_lo;
Point pmin_hi, pmax_hi;
double dmin_lo, dmax_lo;
Expand Down

0 comments on commit 7a2810c

Please sign in to comment.