Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygonal Surface Reconstruction (polyfit) : result faces orientation ? #7096

Closed
esgn opened this issue Nov 29, 2022 · 4 comments · Fixed by #7655
Closed

Polygonal Surface Reconstruction (polyfit) : result faces orientation ? #7096

esgn opened this issue Nov 29, 2022 · 4 comments · Fixed by #7655

Comments

@esgn
Copy link

esgn commented Nov 29, 2022

Issue Details

I've slightly adapted the polygonal surface reconstruction without planes example to pass ransac and polyfit parameters. The code used is here.

I've been using the following ply files containing points with normals dsm_as_point_cloud_with_walls.zip as input. (This file is produced by combining digital surface model and building footprint that's why the roof goes inside the building 😉)

The result I'm getting has incorrectly oriented faces.

image

I managed to fix the faces orientation errors by using the following snippet (I'm not an expert in CGAL so this might not be the optimal solution to do so)

    // Cleanup and fix obtained mesh (holes, orientation, ...)
    std::vector<Point> _points;
    std::vector<std::vector<std::size_t>> _polygons;
    // mesh will be the correctly oriented model
    Surface_mesh mesh;
    // model is the result of Polygonal Surface Reconstruction
    PMP::polygon_mesh_to_polygon_soup(model, _points, _polygons);
    PMP::repair_polygon_soup(_points, _polygons);
    PMP::orient_polygon_soup(_points, _polygons);
    PMP::polygon_soup_to_polygon_mesh(_points, _polygons, mesh);
    PMP::triangulate_faces(mesh);
    if (CGAL::is_closed(mesh))
    {
        std::cout << "The obtained mesh is closed" << std::endl;
        PMP::orient_to_bound_a_volume(mesh);
    }

The full source code with the face orientation fix is available here. Here is the mesh obtained whose faces are now correctly oriented.

image

My questions

  • Is there something wrong in my dataset or in my understanding of polyfit + ransac ?
  • If not, should a fix be introduced in polygonal surface reconstruction so that the result models are correctly oriented ?

Thanks in advance for any help

Environment

  • Ubuntu 20.04
  • Compiler: g++ 9.4.0
  • Release or debug mode: Release
  • Specific flags used (if any): built with scip (SCIP_INCLUDE_DIR, SCIP_DIR)
  • CGAL version: 5.5.1
  • Boost version: 1.80.0
  • Other libraries versions if used (Eigen, TBB, etc.):
    • cmake: 3.24.2
    • gmp: 6.2.1
    • mpfr: 4.1.1
    • eigen: 3.4.0
    • glpk: 5.0
    • ipopt: 3.14.10
    • hmetis: 1.5
    • criterion: 2.4.1
    • scip: 8.0.2
@soesau
Copy link
Member

soesau commented Nov 29, 2022

Hi,

I can reproduce the problem. Thank you for pointing it out.
It should certainly be fixed within the method itself. I will have a look at it.

@yywd6
Copy link

yywd6 commented May 9, 2023

Hello, excuse me, I have now come across a running rebuild aspect, can you try to give me some solution #7433

@esgn
Copy link
Author

esgn commented May 9, 2023

Hello, excuse me, I have now come across a running rebuild aspect, can you try to give me some solution #7433

Your issue doesn't seem to be related to the issue I described here.

@yywd6
Copy link

yywd6 commented May 9, 2023

Hello, excuse me, I have now come across a running rebuild aspect, can you try to give me some solution #7433

Your issue doesn't seem to be related to the issue I described here.

Yes very sorry to bother you, I tried a lot of methods and still didn't solve this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants