Reading a point cloud

What is the process to read a point cloud in opencascade.

I found out I could use the AIS_pointcloud class to process point clouds but I dont see any method that could help me read a file in it. 

Daniel Neander's picture

You have to create a Graphic3d_ArrayOfPoints from the file yourself. The create a point cloud from that array.

Vishesh Chanana's picture

I actually have a .pcd file. Do I need to use the Graphic3d_ArrayOfPoints. Isn't there a direct way of converting the pcd file into an AIS_pointcloud type?

Daniel Neander's picture

I would say to use Graphic3d_ArrayOfPoints.

Looking at the pcd file docs, the points under "DATA" is the point cloud, so you should be able to create a Graphic3d_ArrayOfPoints from that.

There is a great example in ViewerTest_ObjectCommands.cxx that demonstrates Graphic3d_ArrayOfPoints use with AIS_PointCloud.

Hope that helps.

Vishesh Chanana's picture

So, After converting it into an AIS_PointCloud, is it possible to convert this into a TopoDS_Shape?

Daniel Neander's picture

Absolutely

Handle(AIS_Shape) AISshape = Handle(AIS_Shape)::DownCast(AISpointcloud);

Then AIS_Shape has a method to get the TopoDS_Shape
I recommend you reading the documentation as it explains all of this

Guido van Hilst not specified's picture

Maybe I am wrong,  but I dont think you can just create a TopoDS_Shape from loose points with AIS_PointCloud?

I think AIS_PointCloud is for visualization of bunch of points. (It is not derived from AIS_Shape?)

If you want to create TopoDS_Shapes from a bunch of unrelated points you need a surface-construction-algorithm?