Skip to content

efficient way to Graphic3_ArrayofPoints() AddVertex population #1288

Open
@andysfd

Description

@andysfd

Hello, is there currently a more efficent way in pythonocc to populate the pc element rather than calling AddVertex(gp_Pnt(x,y,z)) in a foor loop?

I need to load lidar pointclouds of ~50.000.000 points and are stuck with a slow loop. On my laptop its currently taking 5-7 minutes.
I am not that familiar with this kind of optimization, any help is really welcome!

pc = Graphic3d_ArrayOfPoints(n_points, True)
for idx in range(n_points):
    x, y, z = points[idx]
    r, g, b = colors[idx]
    color = Quantity_Color(r, g, b, Quantity_TOC_RGB)
    pc.AddVertex(gp_Pnt(x, y, z), color)

I already did some research and came across the following topic: #1000
However this solution was more focused on populating meshes. The other solution the user came up with was a cython optimization which i would use as a last resort.

Is there any other smart way to make this class useful also for large (or nowadays rather "normal") sized pound clouds.

Thank you for providing this library and the support!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions