Skip to content

Conversation

@abey79
Copy link
Owner

@abey79 abey79 commented Jan 4, 2026

This PR adds support for joining to paths, and path merging optimisation to layers. This is only the low-level machinery. It is not exposed yet to either the CLI or whiskers.

Constants

  • EPSILON: f64 = 1e-10 — point coincidence threshold

PathDataTrait

  • is_closed(&self) -> bool — checks if start ≈ end

PathTrait

  • join(&mut self, other: &Self, epsilon: f64) — append path, merge at coincident endpoints
  • split(self) -> Vec<Self> — split compound paths at MoveTo boundaries

PathMetadata

  • merge(&mut self, other: &PathMetadata) — merge metadata (first wins)

LayerTrait

  • join_paths(&mut self, tolerance: f64, flip: bool) — join adjacent paths
  • explode(&mut self) — split all compound paths into subpaths

Free Functions (vsvg::optimization)

  • sort_paths<P, D>(paths: &mut Vec<P>, flip: bool)
  • sort_paths_with_builder<P, D>(paths: &mut Vec<P>, builder: IndexBuilder)
  • join_paths<P, D>(paths: &mut Vec<P>, tolerance: f64, flip: bool)

Changed

  • LayerTrait::sort/sort_with_builder now delegate to free functions

This is part 1 of 4 in a stack made with GitButler:

@abey79 abey79 added vsvg Relates to vsvg feature New feature labels Jan 4, 2026
@abey79 abey79 changed the title Add path joining and merge optimisation Add low-level implementation for path joining and merging optimization Jan 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature vsvg Relates to vsvg

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants