@RIL wrote:
For some reason the Point3dList suddenly seems very slow.
I’m prototyping two versions of a component, one working directly on a mesh and it’s Vertices list, and the other working on a pointlist from the input (same points from the same mesh). I mainly use the function mesh.ClosestPoint(pt) and Point3dList.ClosestIndex(pt) respectively, but the Point3dList method is extremely slow compared to the mesh ditto.
Profiling info shows that the mesh doesn’t even show up on the radar while the Point3dList spends 500+ms doing exactly the same job. (Important: I’m not reloading the pointlist each time, I hold a cached version which reloads only if the lits changes, which it never does after first read)
Fig 1. The upper component works on a pointlist and the lower directly on the mesh.
The code that differs is minimal:
private bool SomeMethod(Mesh mesh, Point3d from_pt, ...) { hit_point = mesh.ClosestPoint(from_pt); // ... var pt = mesh.ClosestPoint(some_pt);
End the Point3dList version:
private bool SomeMethod(ref Point3dList pointcloud, Point3d from_pt... ) { var ix = pointcloud.ClosestIndex(from_pt); hit_point = pointcloud[ix]; // ... ix = pointcloud.ClosestIndex(some_pt); var pt = pointcloud[ix];
The number of points is about 224.000, but why is Point3dList.ClosestIndex() so much slower than the mesh ditto?
// Rolf
Posts: 5
Participants: 3