Page 1 of 1

Fit function: 2D polygon (facet)

Posted: Wed Mar 17, 2021 11:50 pm
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 ...

Re: Fit function: 2D polygon (facet)

Posted: Thu Mar 18, 2021 5:11 pm
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)

Re: Fit function: 2D polygon (facet)

Posted: Fri Mar 19, 2021 1:53 pm
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?

Re: Fit function: 2D polygon (facet)

Posted: Sat Mar 20, 2021 4:42 pm
by daniel
Ah, no. We only have the C++ one (but it actually uses different parts of CCCoreLib).

Re: Fit function: 2D polygon (facet)

Posted: Fri Mar 26, 2021 9:25 pm
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.

Re: Fit function: 2D polygon (facet)

Posted: Sun Jun 20, 2021 7:35 pm
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.

Re: Fit function: 2D polygon (facet)

Posted: Tue Jun 22, 2021 6:25 am
by daniel
I guess you are referring to the "Fit facet" function?
https://github.com/CloudCompare/CloudCo ... t.cpp#L138

Re: Fit function: 2D polygon (facet)

Posted: Wed Jun 23, 2021 1:59 pm
by HollowHeartNet
Yes that's what I need. Thank you, Sir!