Files
vectorcraft/crates/pathops/src/lib.rs
T
bflatastic ac85b529fe Add-ons: Artwork Cleanup — simplify keeping shape, health check, deep ungroup, rejoin
A built-in add-on under Object › Plug-ins › Artwork Cleanup:
- Simplify Anchors (Keep Shape) removes anchors while the outline stays
  within a tolerance, optionally keeping sharp corners.
- Document Health Check finds and fixes 16 kinds of problems in the
  selection or the document (stray points, duplicate and collinear
  anchors, tiny handles, nearly closed paths, needless groups, compound
  paths and clipping groups, unpainted and invisible objects, duplicate
  objects, art off every artboard, empty artboards…), with Show, Fix
  Selected and Fix All, each fix one undo step.
- Deep Ungroup and Rejoin Path Pieces.

The add-on lives in its own modules (pathops, engine and ui-egui
addons folders) and leaves the existing commands, tools and menus as
they were.
2026-10-30 13:11:20 +07:00

47 lines
2.0 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 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, SimplifiedPart, SimplifyOptions, add_anchor_points, auto_simplify_level, average, join,
remove_anchor, remove_redundant_points, simplify, simplify_level_tolerance, simplify_part, simplify_with, smooth, smooth_level, split_into_grid,
};
pub use offset::{Cap, Join, offset_path, outline_stroke, stroke_region};
pub use pathfinder::{FaceMerger, PathfinderOp, Region, Shape, merge_regions, pathfinder, pathfinder_with, region_at, regions};
pub use planar::{
BuilderArrangement, SHAPE_BUILDER_MAX_GAP, SHAPE_BUILDER_MAX_SEGMENTS, 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,
};
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,
}