svg_path/encounters

Combined continuous-overlap and isolated point-intersection queries.

This module composes the existing svg_path/overlaps and svg_path/intersections results without changing their payload types.

Types

Continuous overlaps and point intersections reported for one query.

pub type Encounters(overlap, intersection) {
  Encounters(
    overlaps: List(overlap),
    intersections: List(intersection),
  )
}

Constructors

  • Encounters(
      overlaps: List(overlap),
      intersections: List(intersection),
    )

Values

pub fn filter_fully_overlap_explained_subpath_intersection_parameters(
  encounters: Encounters(
    overlaps.SubpathOverlap,
    svg_path.SubpathIntersection,
  ),
  left_subpath: svg_path.Subpath,
  right_subpath: svg_path.Subpath,
  tolerance: Float,
) -> Result(
  Encounters(
    overlaps.SubpathOverlap,
    svg_path.SubpathIntersection,
  ),
  svg_path.Error,
)

Remove intersection parameters explained entirely by the continuous overlaps in an existing subpath encounter result.

This is an optional derived view. The ordinary subpath encounter functions return their complete, unfiltered point-intersection results. A parameter is removed only when it is complementary, after arc-length clamping by tolerance, to every parameter on the opposite side. Both sides are filtered against the original parameter lists.

pub fn path(
  left: svg_path.Path,
  right: svg_path.Path,
) -> Result(
  Encounters(overlaps.PathOverlap, svg_path.PathIntersection),
  svg_path.Error,
)

Return overlap intervals and point intersections between two paths.

pub fn path_with(
  left: svg_path.Path,
  right: svg_path.Path,
  options options: intersections.IntersectionOptions,
) -> Result(
  Encounters(overlaps.PathOverlap, svg_path.PathIntersection),
  svg_path.Error,
)

Return path encounters using explicit intersection options.

pub fn segment(
  left: svg_path.Segment,
  right: svg_path.Segment,
) -> Result(
  Encounters(
    overlaps.SegmentOverlap,
    svg_path.SegmentIntersection,
  ),
  svg_path.Error,
)

Return overlap intervals and point intersections between two segments.

Results from the underlying operations are returned unchanged. When the existing point solver reports OverlappingSegments for a pair already classified as overlapping, it supplied no point-intersection list, so this result contains the detected overlaps and an empty intersection list.

pub fn segment_subpath(
  segment: svg_path.Segment,
  subpath: svg_path.Subpath,
) -> Result(
  Encounters(
    overlaps.SegmentSubpathOverlap,
    #(svg_path.Point, Float, List(svg_path.SubpathParameter)),
  ),
  svg_path.Error,
)

Return overlap intervals and point intersections between a standalone segment and a subpath.

pub fn segment_subpath_with(
  segment: svg_path.Segment,
  subpath: svg_path.Subpath,
  options options: intersections.IntersectionOptions,
) -> Result(
  Encounters(
    overlaps.SegmentSubpathOverlap,
    #(svg_path.Point, Float, List(svg_path.SubpathParameter)),
  ),
  svg_path.Error,
)

Return segment-subpath encounters using explicit intersection options.

pub fn segment_with(
  left: svg_path.Segment,
  right: svg_path.Segment,
  options options: intersections.IntersectionOptions,
) -> Result(
  Encounters(
    overlaps.SegmentOverlap,
    svg_path.SegmentIntersection,
  ),
  svg_path.Error,
)

Return segment encounters using explicit intersection options.

options.tolerance is also passed unchanged to overlap detection.

pub fn subpath(
  left: svg_path.Subpath,
  right: svg_path.Subpath,
) -> Result(
  Encounters(
    overlaps.SubpathOverlap,
    svg_path.SubpathIntersection,
  ),
  svg_path.Error,
)

Return overlap intervals and point intersections between two subpaths.

Point intersections are collected from every constituent segment pair. Overlap-boundary intersections are retained; use filter_fully_overlap_explained_subpath_intersection_parameters to derive a filtered view.

pub fn subpath_with(
  left: svg_path.Subpath,
  right: svg_path.Subpath,
  options options: intersections.IntersectionOptions,
) -> Result(
  Encounters(
    overlaps.SubpathOverlap,
    svg_path.SubpathIntersection,
  ),
  svg_path.Error,
)

Return subpath encounters using explicit intersection options.

options.tolerance is passed unchanged to overlap detection.

Search Document