Add low-level implementation for path joining and merging optimization #183
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thresholdPathDataTraitis_closed(&self) -> bool— checks if start ≈ endPathTraitjoin(&mut self, other: &Self, epsilon: f64)— append path, merge at coincident endpointssplit(self) -> Vec<Self>— split compound paths atMoveToboundariesPathMetadatamerge(&mut self, other: &PathMetadata)— merge metadata (first wins)LayerTraitjoin_paths(&mut self, tolerance: f64, flip: bool)— join adjacent pathsexplode(&mut self)— split all compound paths into subpathsFree 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_buildernow delegate to free functionsThis is part 1 of 4 in a stack made with GitButler:
PathandFlattenedPath#186.buffer()toPathandFlattenedPath#184