Introduce IntoBezPaths trait#191
Open
abey79 wants to merge 2 commits into
Open
Conversation
This was referenced Feb 21, 2026
6213a0d to
e0dc93b
Compare
69fbf67 to
a0db2dd
Compare
e0dc93b to
9c008d2
Compare
a0db2dd to
10d677b
Compare
9c008d2 to
002a849
Compare
10d677b to
69f7d5c
Compare
002a849 to
31300b2
Compare
69f7d5c to
2819fe4
Compare
31300b2 to
77f7fdb
Compare
2819fe4 to
54fd21d
Compare
77f7fdb to
e77e60e
Compare
54fd21d to
feb5528
Compare
e77e60e to
60b6bfd
Compare
feb5528 to
895ddc1
Compare
60b6bfd to
fbb909a
Compare
895ddc1 to
6cb4ede
Compare
fbb909a to
e473904
Compare
lint lint lint
6cb4ede to
bd25ac5
Compare
e473904 to
2358c23
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Introduces the
IntoBezPathsTolerance/IntoBezPathstraits and dedicated implementations for multi-geometry types, laying the groundwork for correct multi-polygon hatching in #188.Problem
When a
geo::MultiPolygon(e.g. from boolean operations) is converted to a singleBezPath, all rings are flattened together and structural boundaries between polygons are lost. The hatching code then uses the heuristic "first subpath = exterior, rest = holes", which misinterprets the second polygon's exterior as a hole in the first.Solution
This PR adds the new trait infrastructure. The next PR (#188) wires it into
Draw::add_path.IntoBezPathsToleranceandIntoBezPaths(plural), which returnVec<BezPath>— one per structural unit.IntoBezPathTolerance(singular) automatically getsIntoBezPathsTolerancereturning a one-elementVec, so all existing single-geometry types (kurbo shapes,geo::Polygon, etc.) work unchanged.MultiPolygon,MultiLineString,MultiPoint,GeometryCollection,Geometry) that return oneBezPathper constituent, preserving structural boundaries. The oldIntoBezPathToleranceimpls for these types are removed (they now get it via the blanket from their dedicatedIntoBezPathsToleranceimpl).MultiPolygonyields multiple bezpaths and single types yield one.Files changed
crates/vsvg/src/path/into_bezpath.rsIntoBezPathsToleranceimpls (replacing oldIntoBezPathToleranceimpls), testscrates/vsvg/src/path/mod.rsThis is part 5 of 6 in a stack made with GitButler:
IntoBezPathstrait #191 👈PathandFlattenedPath#186.buffer()toPathandFlattenedPath#184