All files / tools/src/utilities/math/polyline containsPoints.ts

0% Statements 0/6
0% Branches 0/2
0% Functions 0/1
0% Lines 0/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23                                             
import type { Types } from '@cornerstonejs/core';
import containsPoint from './containsPoint';
 
/**
 * Checks if a polyline contains a set of points.
 *
 * @param polyline - Polyline points (2D)
 * @param points - 2D points to verify
 * @returns True if all points are inside the polyline or false otherwise
 */
export default function containsPoints(
  polyline: Types.Point2[],
  points: Types.Point2[]
): boolean {
  for (let i = 0, numPoint = points.length; i < numPoint; i++) {
    if (!containsPoint(polyline, points[i])) {
      return false;
    }
  }
 
  return true;
}