Pointcloud Library
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Pointcloud Library
Was looking at the cmake file came across the pointcloud library. I was wondering where in FreeCAD is it being used? I was thinking I could build the library and test the features that implement it.
Re: Pointcloud Library
In the "points" workbench...topcyde wrote:came across the pointcloud library. I was wondering where in FreeCAD is it being used?
You have to compile FreeCAD with support for PCL if you want to use it. There was a problem with it on my Kubuntu 14.04 64bit system, which stopped FreeCAD from compiling. Currently PCL support is added automatically if PCL is found on your system at compile time....which means I had to remove PCL from my system to be able to compile FreeCAD again.
Peter has offered a fix, see his post on the "Pull Request" forum. One of the fixes he has introduced is an option to compile PCL or not, so that you can still compile FreeCAD without PCL even if PCL is on your system.
I would recommend that you wait until this important improvement has been pushed into master.
Jim
Re: Pointcloud Library
PCL is also used in the Reverse Engineering module. There is a Python command to triangulate a mesh from a point cloud.
Re: Pointcloud Library
I will keep an eye out for it.jmaustpc wrote:I would recommend that you wait until this important improvement has been pushed into master.
Well that seems handy. Can you throw me a bone to what table that command is? I'd like to look at that. I hope there's one that will make a nurb off a point loud too. That, I could really use.wmayer wrote:PCL is also used in the Reverse Engineering module. There is a Python command to triangulate a mesh from a point cloud.
Re: Pointcloud Library
What you need is a point cloud, e.g. an .asc file. If you don't have one you can create one from an existing mesh.
Here is a code snippet:
You will see that the new mesh may contain many triangles with wrong orientation. Run the "Harmonize normals" command to fix this. But for very complex meshes this still may fail.
Here is a code snippet:
Code: Select all
# the vertices of a given mesh
mp=App.ActiveDocument.ActiveObject.Mesh.Points
# create a point cloud of it and show it
import Points
pp=Points.Points()
pp.addPoints([i.Vector for i in mp])
Points.show(pp)
# triangulate the point cloud to get a mesh and show it
import ReverseEngineering as Reen
m2=Reen.triangulate(pp)
Mesh.show(m2)
Re: Pointcloud Library
Thanks for the code example that always helps me understand what I'm looking at. I really appreciate it.wmayer wrote:What you need is a point cloud, e.g. an .asc file. If you don't have one you can create one from an existing mesh.
Reading from the http://pointclouds.org/documentation/tu ... format.php documentation it talks about pcd file format. Does it make a difference whether it is .asc or .pcd for effeciency? Reading the format descriptions they look pretty identical except I don't see wher the pcd description allows intensity as a field. However, I don't see where asc notes handling moment invariants.
Re: Pointcloud Library
Hello everyone, this is my first post.
I am an architect and I am working with PCL to do some segmentation on point cloud of buildings. I took various tutorials of the PCL documentation and I modified them to create some script to segmenting, filtering and downsampling clouds. I am wondering how much difficult could be implementing them on FreeCAD considering that I am not very expert with c++. Then I have also a question on the capability of FreeCAD to show point cloud. I did some tests and the visualization of 6 millions of points is quite smooth until you go over the cloud with the pointer.
I am an architect and I am working with PCL to do some segmentation on point cloud of buildings. I took various tutorials of the PCL documentation and I modified them to create some script to segmenting, filtering and downsampling clouds. I am wondering how much difficult could be implementing them on FreeCAD considering that I am not very expert with c++. Then I have also a question on the capability of FreeCAD to show point cloud. I did some tests and the visualization of 6 millions of points is quite smooth until you go over the cloud with the pointer.
Re: Pointcloud Library
It is just a matter of integrating the algorithms. The hard part is already done by pcl and for FreeCAD we have to allow to access the pcl algorithms from Python and for the GUI people offer menus and dialogs.I am wondering how much difficult could be implementing them on FreeCAD considering that I am not very expert with c++.
When moving the mouse cursor over the point cloud then for every little movement a raypick action is applied on the scene graph. Internally this uses every single point to check which point is closest to the ray and inside a certain search radius. So, imagine for 6 millions of points and doing this for every little movement will be quite time consuming.I did some tests and the visualization of 6 millions of points is quite smooth until you go over the cloud with the pointer.
For mass data we can think of adding a SoPickStyle node and setting it to unpickable and only enable picking when it's really needed.
Re: Pointcloud Library
Werner, out of pure interest, is it possible to use a custom picking algorithm for a document object? I could imagine that PCL has some advanced fast picking algorithm included which would be faster than the generic coin one. I thought about this earlyer with the new and fast OCC picking algorithm, but was unsure if this is possible in FreeCAD.When moving the mouse cursor over the point cloud then for every little movement a raypick action is applied on the scene graph. Internally this uses every single point to check which point is closest to the ray and inside a certain search radius. So, imagine for 6 millions of points and doing this for every little movement will be quite time consuming.
Re: Pointcloud Library
When moving the mouse or pressing a button an SoHandleEventAction traverses the scene graph. Inside SoFCUnifiedSelection::handleEvent we then invoke its getPickedPoint or getPickedPointList. Internally these methods use the SoRayPickAction class which does all the picking stuff. So, there is no chance to implement our own pick action class and use that.
However, all shape nodes inherit from SoNode and this class has the virtual method rayPick which then of course can be re-implemented in sub-classes.
But depending on the shape type you have to be careful which methods else you need to re-implement. In Inventor Mentor or Toolmaker you should find additional information about this.
However, all shape nodes inherit from SoNode and this class has the virtual method rayPick which then of course can be re-implemented in sub-classes.
But depending on the shape type you have to be careful which methods else you need to re-implement. In Inventor Mentor or Toolmaker you should find additional information about this.