svg_path/overlaps

Continuous coincident intervals between path segments.

Types

One non-zero-length overlap interval between the same ordered pair of segments. The left parameters and points follow the left segment’s traversal. The right parameters retain the corresponding traversal direction and may therefore decrease.

pub type SegmentOverlap {
  SegmentOverlap(
    left_from: Float,
    left_to: Float,
    right_from: Float,
    right_to: Float,
    start: svg_path.Point,
    end: svg_path.Point,
  )
}

Constructors

The result of combining two overlap intervals for the same ordered segment pair.

pub type SegmentOverlapMerge {
  Disjoint
  Merged(SegmentOverlap)
  Contradiction
}

Constructors

One continuous overlap between two subpath traversals. Its endpoints retain an address on both subpaths.

pub type SubpathOverlap {
  SubpathOverlap(
    start: svg_path.Point,
    end: svg_path.Point,
    left_from: svg_path.SubpathParameter,
    left_to: svg_path.SubpathParameter,
    right_from: svg_path.SubpathParameter,
    right_to: svg_path.SubpathParameter,
  )
}

Constructors

Values

pub fn canonicalize_segment_overlap(
  overlap: SegmentOverlap,
) -> SegmentOverlap

Orient an overlap by increasing parameter on the left segment.

Reorientation swaps both right parameters as well as the geometric endpoints, preserving the correspondence between the two traversals.

pub fn merge_segment_overlap_list(
  overlaps: List(SegmentOverlap),
  tolerance tolerance: Float,
) -> Result(List(SegmentOverlap), Nil)

Merge every compatible overlap interval for one ordered segment pair.

Disjoint intervals remain separate. Any contradictory pair rejects the collection.

pub fn merge_segment_overlaps(
  first: SegmentOverlap,
  second: SegmentOverlap,
  tolerance tolerance: Float,
) -> SegmentOverlapMerge

Combine two overlap intervals belonging to the same ordered segment pair.

Canonical inputs have increasing left parameters, non-zero spans on both segments, and endpoints ordered by the left segment. Intervals merge when they overlap or touch consistently in both parameter spaces. A mismatch between the two parameter spaces or their traversal directions is a contradiction.

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

Find overlap intervals using the shared five-sample policy.

pub fn segment_overlap_exceeds_minimum_span(
  overlap: SegmentOverlap,
  minimum_span minimum_span: Float,
) -> Bool

Whether an overlap has a strictly larger parameter span than minimum_span on both segments.

pub fn segment_overlaps_by_endpoint_projection_with(
  left: svg_path.Segment,
  right: svg_path.Segment,
  tolerance tolerance: Float,
  samples samples: Int,
) -> Result(List(SegmentOverlap), svg_path.Error)

Find sampled overlap intervals proposed by endpoint projections.

This algorithm assumes non-degenerate segments and that every overlap boundary is an endpoint of at least one input segment.

pub fn segment_with(
  left: svg_path.Segment,
  right: svg_path.Segment,
  tolerance tolerance: Float,
) -> Result(List(SegmentOverlap), svg_path.Error)
pub fn subpath(
  left: svg_path.Subpath,
  right: svg_path.Subpath,
) -> Result(List(SubpathOverlap), svg_path.Error)
pub fn subpath_with(
  left: svg_path.Subpath,
  right: svg_path.Subpath,
  tolerance tolerance: Float,
) -> Result(List(SubpathOverlap), svg_path.Error)
Search Document