# How to judge whether a point in a model node (3d model)

**URL:** <https://discourse.slicer.org/t/how-to-judge-whether-a-point-in-a-model-node-3d-model/24427>\
**Category:** Development\
**Tags:** 3d-model\
**Created:** [July 21, 2022, 8:05am UTC](https://discourse.slicer.org/t/how-to-judge-whether-a-point-in-a-model-node-3d-model/24427 "2022-07-21T08:05:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![1023185654](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/1023185654/32/15829_2.png) [@1023185654](https://discourse.slicer.org/u/1023185654)\
**Post date:** [July 21, 2022, 8:05am UTC](https://discourse.slicer.org/t/how-to-judge-whether-a-point-in-a-model-node-3d-model/24427/1 "2022-07-21T08:05:32Z")

</div>

hello everyone, i suppose to judge whether a point inside or outside with 3D model, how i can do this? i tried to use vtk.vtkSelectEnclosedPoints() but it dosent work

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 21, 2022, 9:36am UTC](https://discourse.slicer.org/t/how-to-judge-whether-a-point-in-a-model-node-3d-model/24427/2 "2022-07-21T09:36:33Z")

</div>

You can use `vtkImplicitPolyDataDistance` to get distance of a point from a surface. If the distance is negative then the point is inside the mesh. You can find a complete example in the [script repository](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#measure-distance-of-points-from-surface).

For very large or complex or slightly invalid meshes `vtkImplicitPolyDataDistance` may be slow or unreliable. In this case you may consider converting the model to a labelmap volume node (using Segmentation module). This conversion is not trivial and may give slightly different result at the boundary (due to finite resolution of the image volume), but checking if a position is inside a volume is very quick and guaranteed to always succeed.

---

<div class="post-metadata">

**Author:** ![1023185654](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/1023185654/32/15829_2.png) [@1023185654](https://discourse.slicer.org/u/1023185654)\
**Post date:** [July 21, 2022, 9:41am UTC](https://discourse.slicer.org/t/how-to-judge-whether-a-point-in-a-model-node-3d-model/24427/3 "2022-07-21T09:41:59Z")

</div>

i got it, thanks for reply
