How to get first and last contact point between a vtkMRMLMarkupsCurveNode and a model?

I have a bone model crossed by a curveNove. Any of the control points in curveNode are in model surface but I want to get them.

I´ve used vtk.vtkOBBTree() with IntersectWithLine for lines but I can´t find something similar for curves.

Thanks in advance!

You may investigate vtkSelectEnclosedPoints and/or vtkExtractEnclosedPoints to get all points from the curve that are inside your bone segment.

You must convert the segment to polydata, and get the curve as polydata also (GetCurveWorld()) as inputs to the mentioned classes. With vtkExtractEnclosedPoints, the first and last points of the output are what you are expecting. You might want to add more points to the curve’s polydata using vtkPolyDataPointSampler.

This approach is valid in the simple case you are exposing: a simple curve, a simple segment, one entry and one exit. If the curve zigzags through the segment, this doesn’t hold.

entry_exit_locations

1 Like