the picker doesn’t seem to pick anything though… maybe using vtkPropPicker
(?), this is the way i would do it in vedo, in case you’re interested:
import numpy as np
from vedo import Points, Text2D, Plotter
def func(evt):
if not evt.actor:
return
pt = evt.picked3d
ids = evt.actor.closest_point(pt, radius=1.0, return_point_id=True)
selpts = Points(points1[ids]).pickable(False).c("red5").ps(12)
selpts.name = "nearpoints"
d = selpts.hausdorff_distance(vpoints2)
txt.text(f"n = {len(ids)}, d = {d}")
plt.remove("nearpoints").add(selpts)
# vpoints1 = Points("fused_cloud_normal.ply").ps(10)
# points1 = vpoints1.points()
points1 = np.random.randn(1000,3) + [0,0,0]
points2 = np.random.randn(1000,3) + [7,0,0]
vpoints1 = Points(points1).ps(10)
vpoints2 = Points(points2).ps(10).pickable(False).c("blue2")
txt = Text2D("Hover mouse", font="Calco")
plt = Plotter()
plt.add_callback("hover", func)
plt.show(vpoints1, vpoints2, txt, axes=1).close()