mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-03 04:25:52 -05:00
When the planar map is skipped because the paths have too many pieces
(SHAPE_BUILDER_MAX_MAP_EDGES, added in 7a46d5ec56), too many segments
or exceed the sweep's work budget, Divide with open paths fell back to
the filled areas. It replaced the selection with the uncut shapes and
deleted the cutting paths without saying so. Live Paint built no faces:
Make reported the paths as too degenerate to paint, and with Gap
Detection a group could get its edges and no faces.
pathops now has try_pathfinder_with, try_live_paint and
try_live_paint_with_gaps, which return TooManyPieces in those cases
without sweeping the filled areas. Divide, Live Paint Make, Merge and
Gap Options use them and stop with an error that leaves the art
unchanged. The caps, and the fallbacks of pathfinder_with, live_paint,
live_paint_with_gaps and the Shape Builder, are unchanged.
When a Gap Options preview fails after one that found gaps, the dialog
no longer keeps drawing the earlier preview's gaps over the groups the
failure put back.
Docs: docs/mcp.md, the commands' params text and the Divide line in
docs/target-app-parity.md.
56 lines
2.5 KiB
Rust
56 lines
2.5 KiB
Rust
//! VectorCraft path operations: booleans (Pathfinder), shape builder regions, offset, outline stroke,
|
|
//! simplify and the other Object → Path commands.
|
|
//!
|
|
//! Booleans are curve-preserving: `linesweeper`'s robust sweep-line works directly on cubic
|
|
//! Béziers, and the pieces it splits curves into are refitted afterwards so results carry few
|
|
//! anchors. See the crate README for the API overview.
|
|
#![forbid(unsafe_code)]
|
|
|
|
pub mod addons;
|
|
mod boolean;
|
|
mod budget;
|
|
mod edit;
|
|
mod fit;
|
|
mod offset;
|
|
mod pathfinder;
|
|
mod planar;
|
|
mod sweep_axis;
|
|
mod thickness;
|
|
mod trap;
|
|
|
|
pub use boolean::{
|
|
BoolOp, DEFAULT_PRECISION, area, boolean, boolean_n, normalize, try_area, try_boolean, try_boolean_n, try_normalize, try_unite_all,
|
|
try_unite_all_with, unite_all, unite_all_with,
|
|
};
|
|
pub use edit::{
|
|
AverageAxis, SIMPLIFY_LEVEL, SMOOTH_AUTO_LEVEL, START_SNAP, SimplifiedPart, SimplifyOptions, add_anchor_points, auto_simplify_level, average,
|
|
join, remove_anchor, remove_anchors, remove_redundant_points, simplify, simplify_level_tolerance, simplify_part, simplify_with, smooth,
|
|
smooth_level, smooth_options, split_into_grid, start_nearest,
|
|
};
|
|
pub use fit::{fit_cubics, fit_cubics_through};
|
|
pub use offset::{Cap, Join, MAX_OFFSET_SEGMENT_PAIRS, offset_path, outline_stroke, stroke_region, try_offset_path};
|
|
pub use pathfinder::{
|
|
FaceMerger, PathfinderOp, Region, Shape, merge_regions, pathfinder, pathfinder_with, region_at, regions, regions_with, regions_within,
|
|
try_pathfinder_with,
|
|
};
|
|
pub use planar::{
|
|
Adjacency, BuilderArrangement, MapEdge, MapFace, MapOutline, SHAPE_BUILDER_MAX_GAP, SHAPE_BUILDER_MAX_MAP_EDGES, SHAPE_BUILDER_MAX_SEGMENTS,
|
|
TooManyPieces, adjacency, cut_out, encloses_area, find_gaps, has_open_path, interior_point, live_paint, live_paint_with_gaps, run_around,
|
|
shape_builder, shape_builder_with_gap, try_live_paint, try_live_paint_with_gaps,
|
|
};
|
|
pub use thickness::{MAX_DOCUMENT_THICKNESS_WORK, MAX_THICKNESS_PIECES, ThicknessBudget, thinner_than, thinner_than_within};
|
|
pub use trap::{TRAP_HEIGHT_WIDTH_RANGE, TRAP_MAX_WIDTH, TRAP_MIN_WIDTH, trap_band};
|
|
|
|
/// Errors from fallible operations.
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, thiserror::Error)]
|
|
pub enum PathOpsError {
|
|
#[error("input contains NaN or infinite coordinates")]
|
|
NonFinite,
|
|
#[error("input path could not be closed")]
|
|
OpenPath,
|
|
#[error("the shapes are too degenerate to combine")]
|
|
Degenerate,
|
|
#[error("the shapes cross themselves and each other too often to combine")]
|
|
TooComplex,
|
|
}
|