# vtkFrustumSelector and poly-lines

**URL:** <https://discourse.vtk.org/t/vtkfrustumselector-and-poly-lines/5258>\
**Category:** Development\
**Created:** [February 25, 2021, 9:53pm UTC](https://discourse.vtk.org/t/vtkfrustumselector-and-poly-lines/5258 "2021-02-25T21:53:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aron\_Helser](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aron_helser/32/14_2.png) [@Aron\_Helser](https://discourse.vtk.org/u/Aron_Helser)\
**Post date:** [February 25, 2021, 9:53pm UTC](https://discourse.vtk.org/t/vtkfrustumselector-and-poly-lines/5258/1 "2021-02-25T21:53:58Z")

</div>

I’ve identified an unexpected behavior in frustum-selection, and wanted to ask whether others think it’s a bug or a feature.

We’re using a small 9x9 pixel frustum around the mouse click to select all poly-lines near the mouse. I’ve found that if a poly-line encloses the frustum but doesn’t intersect it, the poly-line is still identified as selected. Specifically, `vtkSelectionSource` in `FRUSTUM` mode will use `vtkFrustumSelector`, and that class extracts a list of edges from the polyline, but then calls `ComputeCellsInFrustumFunctor::FrustumClipPolygon` just like it would if the edges came from a polygon instead of a poly-line.

If we make sure the line is inside the frustum to mark it selected, it will change the behavior of frustum selection with poly-lines, but can anyone see a drawback to that?

---

<div class="post-metadata">

**Author:** ![Dave\_DeMarle](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dave_demarle/32/6_2.png) [@Dave\_DeMarle](https://discourse.vtk.org/u/Dave_DeMarle)\
**Post date:** [February 25, 2021, 11:19pm UTC](https://discourse.vtk.org/t/vtkfrustumselector-and-poly-lines/5258/2 "2021-02-25T23:19:01Z")

</div>

Seems like a bug. I remember (dimly) that the base algorithm correctly treats polygons that cover but does not intersect the frustum as inside. I also remember that for some of VTK’s odder cell types needed special handling. This seems like a case that we neglected to consider and add special case handling.

Think of the letter “O” with the selection inside - if you want to hit the O use use polygons.  
Think of the letter “C” with the selection inside - if you want to miss the C you should be able to use polylines.

---

<div class="post-metadata">

**Author:** ![Aron\_Helser](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aron_helser/32/14_2.png) [@Aron\_Helser](https://discourse.vtk.org/u/Aron_Helser)\
**Post date:** [March 13, 2021, 9:37pm UTC](https://discourse.vtk.org/t/vtkfrustumselector-and-poly-lines/5258/3 "2021-03-13T21:37:30Z")

</div>

A fix is submitted [https://gitlab.kitware.com/vtk/vtk/-/merge\_requests/7746](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/7746)
