intersectionsWithSelf method

List<Intersection> intersectionsWithSelf({
  1. double curveIntersectionThreshold = 0.5,
  2. double minTValueDifference = 0.003,
})

Returns the List of intersections between this and itself.

See intersectionsWithCurve for information about the optional parameters.

Implementation

List<Intersection> intersectionsWithSelf(
    {double curveIntersectionThreshold = 0.5,
    double minTValueDifference = 0.003}) {
  final reducedSegments = simpleSlices();
  final results = <Intersection>[];

  for (var segmentIndex = 0;
      segmentIndex < reducedSegments.length - 2;
      segmentIndex++) {
    final left = reducedSegments.sublist(segmentIndex, segmentIndex + 1);
    final right = reducedSegments.sublist(segmentIndex + 2);
    final result = _locateIntersections(
        left, right, curveIntersectionThreshold, minTValueDifference);
    results.addAll(result);
  }

  return results;
}