Skip to main content

CorePlotting::Selection

CorePlotting::Selection

Classes

Name
struct CorePlotting::Selection::PolygonSelectionResult
Result of a polygon selection query.

Functions

Name
PolygonSelectionResult selectPointsInPolygon(std::span< glm::vec2 const > polygon_vertices, std::span< float const > x_values, std::span< float const > y_values)
Find all points that lie inside a polygon.

Functions Documentation

function selectPointsInPolygon

PolygonSelectionResult selectPointsInPolygon(
    std::span< glm::vec2 const > polygon_vertices,
    std::span< float const > x_values,
    std::span< float const > y_values
)

Find all points that lie inside a polygon.

Parameters:

  • polygon_vertices Vertices of the selection polygon (at least 3)
  • x_values X coordinates of the candidate points
  • y_values Y coordinates of the candidate points (same length as x_values)

Return: PolygonSelectionResult containing indices of points inside the polygon

Precondition:

  • polygon_vertices.size() >= 3
  • x_values.size() == y_values.size()

Uses the ray-casting (even-odd) algorithm for point-in-polygon containment. Points exactly on the polygon boundary may or may not be included (consistent with the standard ray-casting behavior).


Updated on 2026-11-13 at 20:25:42 +0000