# Intersection between markups closed curve node on the plane and a line

**URL:** <https://discourse.slicer.org/t/intersection-between-markups-closed-curve-node-on-the-plane-and-a-line/11281>\
**Category:** Development\
**Tags:** markups\
**Created:** [April 24, 2020, 6:53am UTC](https://discourse.slicer.org/t/intersection-between-markups-closed-curve-node-on-the-plane-and-a-line/11281 "2020-04-24T06:53:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://discourse.slicer.org/u/Mik)\
**Post date:** [April 24, 2020, 6:53am UTC](https://discourse.slicer.org/t/intersection-between-markups-closed-curve-node-on-the-plane-and-a-line/11281/1 "2020-04-24T06:53:42Z")

</div>

Dear all,

There is a vtkMRMLMarkupsCurveNode on a plane and a line on the same plane (e.g. x=10.0 mm). I want to find a intersection point (or points) between the curve and the line.

It could be done manually (crude and inefficient). May be there is a solution in Slicer or VTK of such problem?

 ![ClosedCureveNode_Plane_Modified](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/0/e063674ab68a82d36a4d6e87f9a69fbc5efbb503.jpeg)

---

<div class="post-metadata">

**Author:** ![timeanddoctor](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/timeanddoctor/32/5839_2.png) [@timeanddoctor](https://discourse.slicer.org/u/timeanddoctor)\
**Post date:** [April 24, 2020, 10:38am UTC](https://discourse.slicer.org/t/intersection-between-markups-closed-curve-node-on-the-plane-and-a-line/11281/2 "2020-04-24T10:38:04Z")

</div>

Did you created the plane through this line(green)? If yes you can convert it to an array and get this points.

---

<div class="post-metadata">

**Author:** ![timeanddoctor](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/timeanddoctor/32/5839_2.png) [@timeanddoctor](https://discourse.slicer.org/u/timeanddoctor)\
**Post date:** [April 24, 2020, 10:50am UTC](https://discourse.slicer.org/t/intersection-between-markups-closed-curve-node-on-the-plane-and-a-line/11281/3 "2020-04-24T10:50:27Z")

</div>

Maybe the simple way is creating two fidusions based the two intersection points in the 3d view

---

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://discourse.slicer.org/u/Mik)\
**Post date:** [April 24, 2020, 11:09am UTC](https://discourse.slicer.org/t/intersection-between-markups-closed-curve-node-on-the-plane-and-a-line/11281/4 "2020-04-24T11:09:12Z")

</div>

The green line is just an example. Initial data is a curve node (isocenter is an origin) and a line equation.

I will try to use [vtkIntersectionPolyDataFilter](https://vtk.org/doc/nightly/html/classvtkIntersectionPolyDataFilter.html).

1. Convert curve to polygon.
2. Convert line to vtkPlane.
3. Get first output from IntersectionPolyDataFilter and check for intersection points.

---

<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:** [April 24, 2020, 1:12pm UTC](https://discourse.slicer.org/t/intersection-between-markups-closed-curve-node-on-the-plane-and-a-line/11281/5 "2020-04-24T13:12:29Z")

</div>

VTK locators can compute all intersection points of a polydata with a line extremely fast, for example [vtkCellLocator::IntersectWithLine](https://vtk.org/doc/nightly/html/classvtkCellLocator.html#a027818794762a37868a3dccc53ad6e81). You can get the curve as polydata by calling [GetCurveWorld](http://apidocs.slicer.org/master/classvtkMRMLMarkupsNode.html#af52fa681f15f117c5e003d63a88c2e9a) method of the curve node.
