I read 2 polydata, P1( a segment of human vertebrae, there is a space in center, just like a wire ring, and it is close surface) contain P2(a nail), means P2 is inside P1.
And I want to move the one inside P2, after moving P2, I need to check whether a part of P2 went outside P1, or hole of P2 still stay in P1.

What I am trying is to use VtkObbTree to simplify P2 and P1, than check point of P2 obbTree is all inside P1.
But i got all points is inside. Any Idea to make this function?

I know you say you have a closed surface but it’s always worth mentioning the possible usage of vtkCleanPolyData as disconnected triangles (for texturing or other use cases) are extremely common. vtkCleanPolyData will merge those overlapping/duplicated points.

There are a couple other rare degeneracies that aren’t handled by vtkCleanPolyData such as coplanar triangles and self intersections.

My other suggestion is to use vtkSelectEnclosedPoints which will produce a mask of intersected points, it also has an individual point test function (for the individual point test you must call Initialize first).

Lastly there is vtkDistancePolyDataFilter which gives signed distance from the points of one polygon to the surface of the other. The sign tells you if inside or outside.