[vtkusers] Put a marker on a keypoint

Polly Pui polly_sukting at hotmail.com
Wed Apr 25 00:57:46 EDT 2018


Hi,

I would like to label the keypoint which is closest to the 0, 0, 0 with a marker or label.

How can I SetColor to the extracted point?


Below is my code:

// Find the k closest points to (0,0,0)
unsigned int k = 1;
double testPoint[3] = { 0.0, 0.0, 0.0 };
vtkSmartPointer<vtkIdList> result =
vtkSmartPointer<vtkIdList>::New();
pointTree->FindClosestNPoints(k, testPoint, result);
for (vtkIdType i = 0; i < k; i++)
{
vtkIdType point_ind = result->GetId(i);
double p[3];
point->GetPoint(point_ind, p);
std::cout << "Closest point " << i << ": Point "
<< point_ind << ": (" << p[0] << ", " << p[1] << ", " << p[2] << ")" << std::endl;
}


Thank you so much!


Regards,

Polly
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180425/bdc82d41/attachment.html>


More information about the vtkusers mailing list