Fit function: 2D polygon (facet)

Feel free to ask any question here
Post Reply
HollowHeartNet
Posts: 7
Joined: Wed Mar 17, 2021 11:39 pm

Fit function: 2D polygon (facet)

Post by HollowHeartNet »

Dear community,

First of all, I would like to thank all the developers for this great open source software. You are doing a great job!

Now to my question:
The fit function "2D polygon" is an useful tool to create a surface for plane point clouds and to export the mesh file.
It really reminds me of the alphashape algorithm. Therefore, I would like to know what is behind this function "2D polygon", as I could not find a comparable function for Python. Alphashape unfortunately does not give the same results and certainly not for 3D. I would like to find a way to use a function with equal results in Python (if possible).

Thank you in advance!

HollowHeartNet
No cost too great ...
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Fit function: 2D polygon (facet)

Post by daniel »

Well, it's fairly simple:
- we fit a plane on the cloud
- we project the 3D points on this plane
- we compute the 2D (concave) contour of the projected 2D points, as well as the 2D Delaunay mesh
- we back project the contour polyline and the Delaunay mesh to their '2.5D' equivalents (simply by replacing the 2D projected points by the 3D original ones)
Daniel, CloudCompare admin
HollowHeartNet
Posts: 7
Joined: Wed Mar 17, 2021 11:39 pm

Re: Fit function: 2D polygon (facet)

Post by HollowHeartNet »

Dear Daniel,

Thank you for the answer. Unfortunately, I'm not that talented when it comes to programming. Do you know if there is a comparable code / script for this function in Python or in another language that I can follow?
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Fit function: 2D polygon (facet)

Post by daniel »

Ah, no. We only have the C++ one (but it actually uses different parts of CCCoreLib).
Daniel, CloudCompare admin
HollowHeartNet
Posts: 7
Joined: Wed Mar 17, 2021 11:39 pm

Re: Fit function: 2D polygon (facet)

Post by HollowHeartNet »

Does anybody know how to automate the 2D polygon fit process of a point cloud using python subprocess of CC or anything else?

The whole process I would like to automate consists of three steps:

1.) import point cloud from hard disk
2.) use 2D polygon fit function
3.) export generated mesh in OBJ format

I would appreciate any help.
HollowHeartNet
Posts: 7
Joined: Wed Mar 17, 2021 11:39 pm

Re: Fit function: 2D polygon (facet)

Post by HollowHeartNet »

daniel wrote: Sat Mar 20, 2021 4:42 pm Ah, no. We only have the C++ one (but it actually uses different parts of CCCoreLib).
Can you please provide me the C++ implementation of the function "2D polygon"?
Thank you.
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Fit function: 2D polygon (facet)

Post by daniel »

I guess you are referring to the "Fit facet" function?
https://github.com/CloudCompare/CloudCo ... t.cpp#L138
Daniel, CloudCompare admin
HollowHeartNet
Posts: 7
Joined: Wed Mar 17, 2021 11:39 pm

Re: Fit function: 2D polygon (facet)

Post by HollowHeartNet »

Yes that's what I need. Thank you, Sir!
Post Reply