mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-26 10:47:11 -06:00
- Parity: Object › Path › Remove Anchor Points now runs the new command (`path.removeAnchors`,
the menu's feature name) instead of `path.deleteAnchors`, which deleted the anchors with their
segments and opened closed paths; that stays the Delete key's command ("Delete Anchor Points",
off the menu). No second "Smart" item.
- Geometry: the refit moves to `vectorcraft_pathops::remove_anchor` on the existing least-squares
fitter (fixed end tangents, a golden-section search for where the curve passes the removed
point) instead of a ~1,000-candidate grid search in geom (about 4 ms per anchor, now well under
0.1 ms). Two straight sides stay one straight side (a rectangle loses a corner and becomes a
triangle), as Illustrator does; non-finite input leaves the handles alone.
- The Delete Anchor Point tool (`path.removeAnchor`) uses the same function, replacing its
heuristic handle stretch; the explicit id/anchor and `fit` params of the new command are dropped
as duplicates of it. The command is enabled by direct-selected anchors (`has_anchors`), not a
UI override.
- The Control bar shows an icon button (the Delete Anchor Point icon, tooltip "Remove Anchor
Points") instead of a 204 pt text button; the labels reuse the translated "Remove Anchor
Points"; zh-hant gains "Delete Anchor Points". The Pen test that pinned Alt-click as plain Pen
(Illustrator's Alt over an anchor is Convert Anchor Point) is dropped.
- Tests for the refit, closed paths, straight sides and bad input; docs/mcp.md and ROADMAP.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.3 KiB
Rust
35 lines
1.3 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)]
|
|
|
|
mod boolean;
|
|
mod edit;
|
|
mod fit;
|
|
mod offset;
|
|
mod pathfinder;
|
|
mod planar;
|
|
|
|
pub use boolean::{BoolOp, DEFAULT_PRECISION, area, boolean, boolean_n, normalize, try_boolean, try_normalize, unite_all};
|
|
pub use edit::{
|
|
AverageAxis, SimplifyOptions, add_anchor_points, average, join, remove_anchor, remove_redundant_points, simplify, simplify_with, smooth,
|
|
split_into_grid,
|
|
};
|
|
pub use offset::{Cap, Join, offset_path, outline_stroke, stroke_region};
|
|
pub use pathfinder::{PathfinderOp, Region, Shape, merge_regions, pathfinder, region_at, regions};
|
|
pub use planar::{interior_point, live_paint};
|
|
|
|
/// 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,
|
|
}
|