diff --git a/ROADMAP.md b/ROADMAP.md index b2ebdb0545..6c61f42423 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -149,6 +149,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap - 2026-11-01: Randomize Opacity joins the Arrange Tools add-on (Object › Plug-ins › Arrange Tools): each selected object gets its own opacity at random between a minimum and a maximum percent, with a seed that repeats the result, as one undo step (`addon.arrange.randomizeOpacity`, #4925). - 2026-11-01: Sort Objects joins the Arrange Tools add-on (Object › Plug-ins › Arrange Tools): the selected objects are sorted by width, height, area, position, opacity or stacking order (small to large, large to small or at random) and take another of those in that order, trading their values or stepping them evenly, as one undo step (`addon.arrange.sort`, #4917). - 2026-11-15: Tangent Circle joins the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): the circles that touch two selected paths or compound paths at a set radius, or three of them (up to eight for three circles), touching each outline without crossing it; circles, rotated ellipses and other paths alike. A dialog that previews every circle or one picked by number, the current paint, one undo step (`addon.pathtools.tangentCircle`). A VectorCraft addition: headline numbers unchanged. +- 2026-11-17: Add Bounding Rectangle and Add Bounding Circle join the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): a live rectangle on the selection's geometric bounding box, or the smallest live circle that holds its outlines, around the whole selection or around each object, with an optional offset, the current paint and one undo step (`addon.pathtools.boundingRectangle`, `addon.pathtools.boundingCircle`, #6966). A VectorCraft addition: headline numbers unchanged. - 2026-11-01: New Symbols from Layers joins the Document Tools add-on (Object › Plug-ins › Document Tools): one symbol of each top-level layer's art (the layers highlighted in the Layers panel when two or more are, else every layer), named after the layer, made as New Symbol makes one; Convert Layers to Symbols also puts an instance of each in place of its layer's art. Empty layers are skipped and reported; one undo step. A VectorCraft addition: headline numbers unchanged. - 2026-11-01: Document Tools, a built-in add-on (Object › Plug-ins › Document Tools), starts with Save a Timestamped Copy: a copy of the document named `_YYYY-MM-DD_HH-MM` (UTC; `-2`, `-3`… when that name is taken) goes next to it, or into a folder picked for a document never saved, written as File › Save a Copy writes it, so the document keeps its path, title and modified state. Off on the web, which has no clock. A VectorCraft addition: headline numbers unchanged. - 2026-11-01: Divide into Dashes joins the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): the selected paths, or only their direct-selected segments, are cut into separate open paths of a dash length measured along the curve, with an optional gap (left empty, or kept as pieces), each keeping the path's appearance; Fit to Corners and Ends stretches or squeezes the lengths so every run starts and ends on a dash. A dialog with Preview, one undo step, at most 100000 pieces. A VectorCraft addition: headline numbers unchanged. diff --git a/crates/engine/src/cmd/addons/pathtools.rs b/crates/engine/src/cmd/addons/pathtools.rs index 1c730e02b4..41894d5d09 100644 --- a/crates/engine/src/cmd/addons/pathtools.rs +++ b/crates/engine/src/cmd/addons/pathtools.rs @@ -3,11 +3,12 @@ //! anchor edits, Split / Add Points at Crossings, Slide Anchor Along Path, the Corner Tool's corners //! ([`corners`]), the Parametric Shape Tool's shapes ([`shape`]), the Shared Edge Merge Tool's //! merges with Keep Shared Points Together ([`shared_edge`]), Divide into Dashes, Expand Dashes -//! into Paths, Trim at Crossings ([`trim`]), Common Tangents ([`tangents`]) and Tangent Circle -//! ([`tangent_circle`]). +//! into Paths, Trim at Crossings ([`trim`]), Common Tangents ([`tangents`]), Tangent Circle +//! ([`tangent_circle`]) and Add Bounding Rectangle and Add Bounding Circle ([`bounding`]). //! Its tools, panels and submenu (Object › Plug-ins › Path Precision Tools) are the tools crate's //! and the UI's. +mod bounding; mod corners; #[cfg(test)] mod effect_tests; @@ -185,6 +186,7 @@ pub fn specs() -> Vec { v.extend(trim::specs()); v.extend(tangent_circle::specs()); v.extend(tangents::specs()); + v.extend(bounding::specs()); v } diff --git a/crates/engine/src/cmd/addons/pathtools/bounding.rs b/crates/engine/src/cmd/addons/pathtools/bounding.rs new file mode 100644 index 0000000000..78290e8ea0 --- /dev/null +++ b/crates/engine/src/cmd/addons/pathtools/bounding.rs @@ -0,0 +1,253 @@ +//! Add Bounding Rectangle and Add Bounding Circle: a live rectangle on the selection's geometric +//! bounding box, or the smallest live circle around its outlines. The circle is the geometry crate's +//! ([`enclosing_circle`](vectorcraft_geom::shapes::enclosing_circle)). + +use serde_json::{Value, json}; +use vectorcraft_doc::{Document, LiveShape, Node, NodeId, NodeKind, SymbolBoxes}; +use vectorcraft_geom::{Affine, CubicBez, FillRule, ParamCurve, PathSeg, Point, Rect, shapes}; + +use super::super::super::edit::selected_roots; +use super::super::super::{CommandSpec, bad, check_switches, cmd, has_selection, number_or, switch_or}; +use crate::{Result, Session}; + +#[cfg(test)] +mod tests; + +/// Add Bounding Rectangle's command. +pub(crate) const RECTANGLE: &str = "addon.pathtools.boundingRectangle"; +/// Add Bounding Circle's command. +pub(crate) const CIRCLE: &str = "addon.pathtools.boundingCircle"; + +/// How far a curve may stray from the points the circle is fitted to, in points. The circle's +/// radius grows by as much, so it holds the curves themselves. +const FLATNESS: f64 = 0.01; + +pub(super) fn specs() -> Vec { + vec![ + cmd!( + "addon.pathtools.boundingRectangle", + "Add Bounding Rectangle", + ["Object", "Plug-ins", "Path Precision Tools"], + None, + "{each?: bool (default false: one rectangle around the whole selection; true: one around each selected object), offset?: pt (0 or more; default 0: added on every side)} draw a live rectangle on the geometric bounding box of the selected objects (strokes and effects left out), with the current paint, on top of the current layer or of the isolated group, as other new art; the rectangles are selected; one undo step. An object whose box has no width or no height (a straight horizontal or vertical line) gets no rectangle unless `offset` is more than 0, nor does an object with no bounds (an empty group); with `each` the result's `skipped` counts them, and it is an error when no rectangle is left → {id: the first rectangle, ids, skipped?}", + has_selection, + bounding_rectangle + ), + cmd!( + "addon.pathtools.boundingCircle", + "Add Bounding Circle", + ["Object", "Plug-ins", "Path Precision Tools"], + None, + "{each?: bool (default false: one circle around the whole selection; true: one around each selected object), offset?: pt (0 or more; default 0: added to the radius)} draw the smallest live circle that holds the outlines of the selected objects (paths and compound paths by their curves, clip groups by their clipping paths, images by their corners, type and other objects by the corners of their bounding box; strokes and effects left out), with the radius 0.01 pt larger so it holds the curves themselves, with the current paint, on top of the current layer or of the isolated group, as other new art; the circles are selected; one undo step. An object at a single point gets no circle unless `offset` is more than 0, nor does an object with no outline (an empty group); with `each` the result's `skipped` counts them, and it is an error when no circle is left → {id: the first circle, ids, skipped?}", + has_selection, + bounding_circle + ), + ] +} + +/// The shape a command draws. +#[derive(Clone, Copy, PartialEq)] +enum Kind { + Rectangle, + Circle, +} + +fn bounding_rectangle(s: &mut Session, p: &Value) -> Result { + add(s, p, Kind::Rectangle) +} + +fn bounding_circle(s: &mut Session, p: &Value) -> Result { + add(s, p, Kind::Circle) +} + +fn add(s: &mut Session, p: &Value, kind: Kind) -> Result { + let (c, label) = match kind { + Kind::Rectangle => (RECTANGLE, "Add Bounding Rectangle"), + Kind::Circle => (CIRCLE, "Add Bounding Circle"), + }; + check_switches(p, &["each"], c)?; + let each = switch_or(p, "each", false, c)?; + let offset = number_or(p, "offset", 0.0, c)?; + if !(offset.is_finite() && offset >= 0.0) { + return Err(bad(c, "`offset` must be 0 or more")); + } + let roots = selected_roots(s)?; + let d = &s.doc()?.doc; + let symbols = d.symbol_boxes(); + let groups: Vec> = if each { roots.iter().map(|id| vec![*id]).collect() } else { vec![roots] }; + let mut made: Vec = vec![]; + // Objects that get no shape: no outline, or a shape with no size. + let mut skipped = 0; + for ids in &groups { + match shape_around(d, &symbols, ids, kind, offset) { + Some(live) => made.push(live), + None => skipped += 1, + } + } + if made.is_empty() { + return Err(bad(c, "nothing to enclose")); + } + let parent = s.doc()?.target_parent()?; + let look = s.new_art_look(s.paint.fill.clone(), s.paint.stroke.clone(), s.paint.stroke_width); + let ids = s.edit(label, |d, sel| { + let mut ids = vec![]; + for live in made { + let kind = NodeKind::Path { path: live.to_path(), rule: FillRule::NonZero, live: Some(Box::new(live)), clipping: false, guide: false }; + let mut n = Node::new(d.alloc_id(), kind); + look.apply(d, &mut n); + ids.push(n.id); + d.insert(parent, usize::MAX, n)?; + } + sel.set(ids.iter().copied()); + Ok(ids) + })?; + let first = ids.first().map_or(0, |id| id.0); + let mut out = json!({ "id": first, "ids": ids.iter().map(|i| i.0).collect::>() }); + if skipped > 0 { + out["skipped"] = json!(skipped); + } + Ok(out) +} + +/// The live rectangle or circle around `ids`, grown by `offset`; `None` when they have no bounds +/// or the shape would have no width or no height. +fn shape_around(d: &Document, symbols: &SymbolBoxes, ids: &[NodeId], kind: Kind, offset: f64) -> Option { + match kind { + Kind::Rectangle => { + let r = d.bounds_of_with(ids, false, symbols)?.inflate(offset, offset); + if !r.is_finite() || r.width() <= 0.0 || r.height() <= 0.0 { + return None; + } + Some(LiveShape::Rectangle { + w: r.width(), + h: r.height(), + radii: [0.0; 4], + kinds: Default::default(), + radii_relative: false, + xf: Affine::translate(r.origin().to_vec2()), + }) + } + Kind::Circle => { + let mut gathered = Gathered::new(); + for n in ids.iter().filter_map(|id| d.node(*id)) { + outline_points(n, symbols, &mut gathered, 0); + gathered.compact(); + } + let (center, radius) = shapes::enclosing_circle(&gathered.points)?; + if radius + offset <= 0.0 { + return None; + } + let r = radius + FLATNESS + offset; + let b = Rect::new(center.x - r, center.y - r, center.x + r, center.y + r); + if !b.is_finite() { + return None; + } + Some(LiveShape::Ellipse { w: b.width(), h: b.height(), pie: (0.0, 360.0), xf: Affine::translate(b.origin().to_vec2()) }) + } + } +} + +/// Adds to `out` points on the outline of `n`, as its geometric bounds measure it: the points of +/// its paths ([`curve_points`]); the clipping path of a clip group or of a sublayer that clips its +/// contents; the shown contents of a sublayer; the corners of an image; and the corners of the +/// geometric bounding box of anything else. A group or layer `depth` levels below the selected +/// object that is nested deeper than a document holds ([`vectorcraft_doc::MAX_DEPTH`]) counts by +/// the corners of its geometric bounding box. +fn outline_points(n: &Node, symbols: &SymbolBoxes, out: &mut Gathered, depth: usize) { + let nests = matches!(n.kind, NodeKind::Group { .. } | NodeKind::Layer { .. } | NodeKind::Compound { .. }); + if nests && depth >= vectorcraft_doc::MAX_DEPTH { + out.points.extend(n.geometric_bounds_with(symbols).map(corners).into_iter().flatten()); + return; + } + match &n.kind { + NodeKind::Path { path, .. } => { + // The anchors count too, so a path of one anchor, which has no segments, is held. + out.points.extend(path.subpaths.iter().flat_map(|sp| sp.anchors.iter().map(|a| a.p))); + for seg in path.to_bezpath().segments() { + match seg { + PathSeg::Line(l) => out.points.extend([l.p0, l.p1]), + _ => curve_points(seg.to_cubic(), 0, &mut out.points), + } + out.compact(); + } + } + NodeKind::Group { children, clip: true } | NodeKind::Layer { children, clip: true, .. } => { + if let Some(c) = children.first() { + outline_points(c, symbols, out, depth + 1); + } + } + NodeKind::Layer { .. } | NodeKind::Group { .. } | NodeKind::Compound { .. } => { + let layer = matches!(n.kind, NodeKind::Layer { .. }); + for c in n.editing_children().iter().filter(|c| c.visible || !layer) { + outline_points(c, symbols, out, depth + 1); + out.compact(); + } + } + NodeKind::Image(im) => { + let r = Rect::new(0.0, 0.0, im.width as f64, im.height as f64); + out.points.extend(corners(r).map(|p| im.xf * p)); + } + _ => out.points.extend(n.geometric_bounds_with(symbols).map(corners).into_iter().flatten()), + } +} + +/// Adds to `out` points whose convex hull, grown by [`FLATNESS`], holds the curve `c`: the ends of +/// pieces whose control points lie within [`FLATNESS`] of their chord, and the control points of +/// pieces still curved after [`MAX_SPLITS`] halvings, which hold their piece. A curve with a point +/// that is not finite adds nothing. +fn curve_points(c: CubicBez, depth: u32, out: &mut Vec) { + if ![c.p0, c.p1, c.p2, c.p3].iter().all(|p| p.is_finite()) { + return; + } + let flat = [c.p1, c.p2].iter().all(|p| distance_to_segment(*p, c.p0, c.p3) <= FLATNESS); + if flat { + out.extend([c.p0, c.p3]); + } else if depth >= MAX_SPLITS { + out.extend([c.p0, c.p1, c.p2, c.p3]); + } else { + let (a, b) = c.subdivide(); + curve_points(a, depth + 1, out); + curve_points(b, depth + 1, out); + } +} + +/// How many points [`outline_points`] gathers before it keeps only the corners of their convex hull. +const COMPACT_AT: usize = 1 << 16; + +/// Points gathered for a circle, kept down to the corners of their convex hull whenever they grow +/// past `limit`: only the hull decides the circle, so this bounds the memory a large selection of +/// curves takes. +struct Gathered { + points: Vec, + limit: usize, +} + +impl Gathered { + fn new() -> Self { + Self { points: vec![], limit: COMPACT_AT } + } + + /// Keeps only the hull's corners once there are more than `limit` points; the next time waits + /// until there are twice as many as the hull has, so each point is sorted a few times at most. + fn compact(&mut self) { + if self.points.len() > self.limit { + self.points = shapes::convex_hull(std::mem::take(&mut self.points)); + self.limit = (self.points.len() * 2).max(COMPACT_AT); + } + } +} + +/// How many times [`curve_points`] halves a curve at most: up to 1,024 pieces. +const MAX_SPLITS: u32 = 10; + +/// The distance from `p` to the segment from `a` to `b`. +fn distance_to_segment(p: Point, a: Point, b: Point) -> f64 { + let ab = b - a; + let len2 = ab.hypot2(); + let t = if len2 > 0.0 { ((p - a).dot(ab) / len2).clamp(0.0, 1.0) } else { 0.0 }; + (p - (a + ab * t)).hypot() +} + +fn corners(r: Rect) -> [Point; 4] { + [Point::new(r.x0, r.y0), Point::new(r.x1, r.y0), Point::new(r.x1, r.y1), Point::new(r.x0, r.y1)] +} diff --git a/crates/engine/src/cmd/addons/pathtools/bounding/tests.rs b/crates/engine/src/cmd/addons/pathtools/bounding/tests.rs new file mode 100644 index 0000000000..602919a100 --- /dev/null +++ b/crates/engine/src/cmd/addons/pathtools/bounding/tests.rs @@ -0,0 +1,363 @@ +//! Add Bounding Rectangle and Add Bounding Circle: the box and the smallest circle, the current +//! paint and placement on top of the current layer or the isolated group, `each` and `skipped`, +//! shapes of no size, clip groups and clipping sublayers, huge curves, and the errors that leave +//! the document as it was. + +use serde_json::{Value, json}; +use vectorcraft_doc::{LiveShape, Node, NodeId, NodeKind}; +use vectorcraft_geom::{Point, Rect, Vec2, shapes}; + +use super::{CIRCLE, COMPACT_AT, Gathered, RECTANGLE}; +use crate::Session; + +fn session() -> Session { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap(); + s +} + +fn node(s: &Session, id: NodeId) -> Node { + s.doc().unwrap().doc.node(id).unwrap().clone() +} + +fn id_of(v: &Value) -> NodeId { + NodeId(v["id"].as_u64().unwrap()) +} + +fn ids_of(v: &Value) -> Vec { + v["ids"].as_array().unwrap().iter().map(|i| NodeId(i.as_u64().unwrap())).collect() +} + +fn rect(s: &mut Session, x: f64, y: f64, w: f64, h: f64) -> NodeId { + id_of(&s.execute("shape.rectangle", &json!({"x": x, "y": y, "width": w, "height": h})).unwrap()) +} + +fn undo_len(s: &Session) -> usize { + s.doc().unwrap().history.undo.len() +} + +fn object_count(s: &Session) -> usize { + let mut n = 0; + s.doc().unwrap().doc.walk(|_| n += 1); + n +} + +/// Whether two rectangles agree to within `tol` on every edge. +fn rect_near(b: Rect, want: Rect, tol: f64) -> bool { + [(b.x0, want.x0), (b.y0, want.y0), (b.x1, want.x1), (b.y1, want.y1)].iter().all(|(a, w)| (a - w).abs() < tol) +} + +/// The live shape of `id`. +fn live(s: &Session, id: NodeId) -> LiveShape { + match &node(s, id).kind { + NodeKind::Path { live: Some(live), .. } => live.as_ref().clone(), + other => panic!("not a live shape: {other:?}"), + } +} + +/// The geometric bounds of `id`. +fn bounds(s: &Session, id: NodeId) -> Rect { + s.doc().unwrap().doc.bounds_of(&[id], false).unwrap() +} + +/// The last child of `parent`, the top of its stacking order. +fn top_of(s: &Session, parent: NodeId) -> NodeId { + node(s, parent).children().unwrap().last().unwrap().id +} + +/// Runs `command` with `p` and checks that it fails and leaves the document as it was. +fn refused(s: &mut Session, command: &str, p: Value) -> String { + let (undo, objects) = (undo_len(s), object_count(s)); + let e = s.execute(command, &p).unwrap_err().to_string(); + assert_eq!((undo_len(s), object_count(s)), (undo, objects), "{p} changed the document"); + e +} + +/// A live rectangle on the selection's geometric bounding box, strokes left out, with the current +/// paint, on top of the current layer, selected; one undo removes it. +#[test] +fn a_bounding_rectangle_is_the_geometric_box_on_top_of_the_layer() { + let mut s = session(); + s.execute("stroke.set", &json!({"weight": 10})).unwrap(); + let a = rect(&mut s, 10.0, 20.0, 30.0, 40.0); + let b = id_of(&s.execute("shape.ellipse", &json!({"x": 100, "y": 50, "width": 60, "height": 80})).unwrap()); + assert_eq!(node(&s, a).appearance.stroke_width(), 10.0, "the strokes reach past the geometric box"); + s.execute("select.none", &json!({})).unwrap(); + s.execute("paint.setFill", &json!({"color": "#ff0000"})).unwrap(); + s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap(); + let (before, undo) = (object_count(&s), undo_len(&s)); + let out = s.execute(RECTANGLE, &json!({})).unwrap(); + let id = id_of(&out); + assert_eq!(ids_of(&out), vec![id]); + assert!(out.get("skipped").is_none(), "{out}"); + assert!(matches!(live(&s, id), LiveShape::Rectangle { .. })); + assert!(rect_near(bounds(&s, id), Rect::new(10.0, 20.0, 160.0, 130.0), 1e-9), "{:?}", bounds(&s, id)); + let layer = s.doc().unwrap().current_layer().unwrap(); + assert_eq!(top_of(&s, layer), id); + assert_eq!(s.doc().unwrap().selection.objects, vec![id]); + assert_eq!(undo_len(&s), undo + 1); + assert_eq!(object_count(&s), before + 1); + // The current paint, as a shape drawn now gets it. + let reference = rect(&mut s, 300.0, 300.0, 5.0, 5.0); + let (n, r) = (node(&s, id), node(&s, reference)); + assert_eq!((n.appearance.fill_paint(), n.appearance.stroke_paint()), (r.appearance.fill_paint(), r.appearance.stroke_paint())); + assert_eq!(n.appearance.stroke_width(), r.appearance.stroke_width()); + s.execute("edit.undo", &json!({})).unwrap(); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(object_count(&s), before); +} + +/// A bounding circle around a right triangle stands on its hypotenuse; around a circle it is that +/// circle, grown by at most the flattening allowance; `offset` grows the radius, and a rectangle's +/// sides, by that much. +#[test] +fn a_bounding_circle_is_the_smallest_circle_around_the_outlines() { + let mut s = session(); + let tri = + id_of(&s.execute("path.create", &json!({"anchors": [{"x": 0, "y": 0}, {"x": 80, "y": 0}, {"x": 0, "y": 60}], "closed": true})).unwrap()); + s.execute("select.set", &json!({"ids": [tri.0]})).unwrap(); + let c = id_of(&s.execute(CIRCLE, &json!({})).unwrap()); + match live(&s, c) { + LiveShape::Ellipse { w, h, pie, .. } => { + assert!((w - 100.02).abs() < 1e-9 && (h - 100.02).abs() < 1e-9 && pie == (0.0, 360.0), "{w} {h}"); + } + other => panic!("not a circle: {other:?}"), + } + assert!(rect_near(bounds(&s, c), Rect::new(-10.01, -20.01, 90.01, 80.01), 1e-9), "{:?}", bounds(&s, c)); + + // A circle of radius 50 and a dot inside it: the bounding circle is the circle itself. + let round = id_of(&s.execute("shape.ellipse", &json!({"x": 200, "y": 200, "width": 100, "height": 100})).unwrap()); + let dot = rect(&mut s, 240.0, 240.0, 2.0, 2.0); + s.execute("select.set", &json!({"ids": [round.0, dot.0]})).unwrap(); + let c = id_of(&s.execute(CIRCLE, &json!({"offset": 5})).unwrap()); + let got = bounds(&s, c); + let want = Rect::new(195.0, 195.0, 305.0, 305.0); + assert!(rect_near(got, want, 0.03), "{got:?}"); + assert!(got.x0 <= want.x0 + 1e-9 && got.x1 >= want.x1 - 1e-9 && got.y0 <= want.y0 + 1e-9 && got.y1 >= want.y1 - 1e-9, "{got:?}"); + + s.execute("select.set", &json!({"ids": [tri.0]})).unwrap(); + let r = id_of(&s.execute(RECTANGLE, &json!({"offset": 4})).unwrap()); + assert!(rect_near(bounds(&s, r), Rect::new(-4.0, -4.0, 84.0, 64.0), 1e-9)); +} + +/// A shape with no size is not drawn: a straight horizontal line gets no rectangle and a path of +/// one anchor no circle, unless `offset` gives them room; with `each` they are counted in +/// `skipped`, and alone they are an error. +#[test] +fn shapes_of_no_size_are_skipped_unless_offset_gives_them_room() { + let mut s = session(); + let line = id_of(&s.execute("path.create", &json!({"anchors": [{"x": 10, "y": 50}, {"x": 90, "y": 50}]})).unwrap()); + let lone = id_of(&s.execute("path.create", &json!({"anchors": [{"x": 50, "y": 70}]})).unwrap()); + let box_ = rect(&mut s, 200.0, 200.0, 10.0, 10.0); + s.execute("select.set", &json!({"ids": [line.0]})).unwrap(); + assert!(refused(&mut s, RECTANGLE, json!({})).contains("nothing to enclose")); + let r = id_of(&s.execute(RECTANGLE, &json!({"offset": 2})).unwrap()); + assert!(rect_near(bounds(&s, r), Rect::new(8.0, 48.0, 92.0, 52.0), 1e-9), "{:?}", bounds(&s, r)); + // The line has length, so its circle has size. + s.execute("select.set", &json!({"ids": [line.0]})).unwrap(); + let c = id_of(&s.execute(CIRCLE, &json!({})).unwrap()); + assert!(rect_near(bounds(&s, c), Rect::new(9.99, 9.99, 90.01, 90.01), 1e-9), "{:?}", bounds(&s, c)); + + s.execute("select.set", &json!({"ids": [lone.0]})).unwrap(); + assert!(refused(&mut s, CIRCLE, json!({})).contains("nothing to enclose")); + let c = id_of(&s.execute(CIRCLE, &json!({"offset": 3})).unwrap()); + assert!(rect_near(bounds(&s, c), Rect::new(46.99, 66.99, 53.01, 73.01), 1e-9), "{:?}", bounds(&s, c)); + + s.execute("select.set", &json!({"ids": [line.0, lone.0, box_.0]})).unwrap(); + let out = s.execute(RECTANGLE, &json!({"each": true})).unwrap(); + assert_eq!((ids_of(&out).len(), out["skipped"].as_u64()), (1, Some(2)), "{out}"); + assert!(rect_near(bounds(&s, id_of(&out)), Rect::new(200.0, 200.0, 210.0, 210.0), 1e-9)); + s.execute("select.set", &json!({"ids": [line.0, lone.0, box_.0]})).unwrap(); + let out = s.execute(CIRCLE, &json!({"each": true})).unwrap(); + assert_eq!((ids_of(&out).len(), out["skipped"].as_u64()), (2, Some(1)), "{out}"); +} + +/// With `each`, every selected object gets a shape of its own, all in one undo step, on top of the +/// layer in the selection's stacking order, and the new shapes are selected. +#[test] +fn each_draws_one_shape_around_each_object() { + let mut s = session(); + let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0); + let b = rect(&mut s, 100.0, 0.0, 20.0, 30.0); + s.execute("select.set", &json!({"ids": [b.0, a.0]})).unwrap(); + let undo = undo_len(&s); + let out = s.execute(RECTANGLE, &json!({"each": true})).unwrap(); + let ids = ids_of(&out); + assert_eq!(ids.len(), 2); + assert!(rect_near(bounds(&s, ids[0]), Rect::new(0.0, 0.0, 10.0, 10.0), 1e-9)); + assert!(rect_near(bounds(&s, ids[1]), Rect::new(100.0, 0.0, 120.0, 30.0), 1e-9)); + let layer = s.doc().unwrap().current_layer().unwrap(); + let order: Vec = node(&s, layer).children().unwrap().iter().map(|n| n.id).collect(); + assert_eq!(order, vec![a, b, ids[0], ids[1]]); + assert_eq!(s.doc().unwrap().selection.objects.len(), 2); + assert_eq!(undo_len(&s), undo + 1); +} + +/// An object with no outline (an empty group) gets no shape and the result counts it; with only +/// such objects selected the command draws nothing. +#[test] +fn each_counts_the_objects_without_an_outline() { + let mut s = session(); + let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0); + let empty = s + .edit("Group", |d, _| { + let id = d.alloc_id(); + d.insert(d.default_layer(), 0, Node::group(id, vec![]))?; + Ok(id) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [a.0, empty.0]})).unwrap(); + let out = s.execute(CIRCLE, &json!({"each": true})).unwrap(); + assert_eq!((ids_of(&out).len(), out["skipped"].as_u64()), (1, Some(1)), "{out}"); + s.execute("select.set", &json!({"ids": [a.0, empty.0]})).unwrap(); + let out = s.execute(CIRCLE, &json!({})).unwrap(); + assert!(out.get("skipped").is_none(), "{out}"); + s.execute("select.set", &json!({"ids": [empty.0]})).unwrap(); + assert!(refused(&mut s, RECTANGLE, json!({"each": true})).contains("nothing to enclose")); +} + +/// Curves over a hundred thousand points across are held by their circle: every point along the +/// curves is inside the circle, whose radius is the 0.01 pt allowance larger than the circle around +/// the flattened points. The farthest point of the lopsided arc lies between two flattened points, +/// about 0.001 pt outside the circle around them, so it needs that allowance. +#[test] +fn the_circle_holds_huge_curves() { + let mut s = session(); + let d = "M 0 0 C 0 -90000 120000 -90000 120000 0 C 60000 40000 30000 70000 0 0 Z"; + let blob = id_of(&s.execute("path.create", &json!({"d": d})).unwrap()); + let arc = id_of(&s.execute("path.create", &json!({"d": "M 0 0 C 20 400 380 500 400 0"})).unwrap()); + for big in [blob, arc] { + s.execute("select.set", &json!({"ids": [big.0]})).unwrap(); + let c = id_of(&s.execute(CIRCLE, &json!({})).unwrap()); + let LiveShape::Ellipse { w, xf, .. } = live(&s, c) else { panic!("not a circle") }; + let (center, r) = (xf * Point::new(w / 2.0, w / 2.0), w / 2.0); + let path = node(&s, big).path_data().unwrap().to_bezpath(); + let mut farthest: f64 = 0.0; + for seg in path.segments() { + for i in 0..=4000 { + let p = vectorcraft_geom::ParamCurve::eval(&seg, f64::from(i) / 4000.0); + farthest = farthest.max(p.distance(center)); + } + } + assert!(farthest <= r + 1e-6, "a point {farthest} from the center is outside the circle of radius {r}"); + } +} + +/// Clip groups count by their clipping paths; for art inside one, the shape goes on top of the +/// current layer, never into the clip group. +#[test] +fn clip_groups_count_by_their_clipping_paths() { + let mut s = session(); + let art = rect(&mut s, 0.0, 0.0, 100.0, 100.0); + let clip = id_of(&s.execute("shape.ellipse", &json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()); + s.execute("select.set", &json!({"ids": [art.0, clip.0]})).unwrap(); + let group = id_of(&s.execute("object.clippingMask.make", &json!({})).unwrap()); + s.execute("select.set", &json!({"ids": [group.0]})).unwrap(); + let id = id_of(&s.execute(CIRCLE, &json!({})).unwrap()); + let b = bounds(&s, id); + assert!((b.width() / 2.0 - 25.01).abs() < 0.03 && b.center().distance(Point::new(35.0, 35.0)) < 0.03, "{b:?}"); + let layer = s.doc().unwrap().current_layer().unwrap(); + assert_eq!(s.doc().unwrap().doc.parent_of(id), Some(layer)); + s.execute("select.set", &json!({"ids": [clip.0]})).unwrap(); + let id = id_of(&s.execute(RECTANGLE, &json!({})).unwrap()); + assert_eq!(s.doc().unwrap().doc.parent_of(id), Some(layer)); + assert!(rect_near(bounds(&s, id), Rect::new(10.0, 10.0, 60.0, 60.0), 1e-6)); +} + +/// A sublayer that clips its contents counts by its clipping path, and the hidden objects of a +/// sublayer are left out. +#[test] +fn sublayers_count_by_their_clipping_path_and_shown_art() { + let mut s = session(); + let top = s.doc().unwrap().current_layer().unwrap(); + let sub = id_of(&s.execute("layer.newSublayer", &json!({"parent": top.0})).unwrap()); + s.execute("layer.setCurrent", &json!({"id": sub.0})).unwrap(); + let art = rect(&mut s, 0.0, 0.0, 100.0, 100.0); + let hidden = rect(&mut s, 300.0, 300.0, 10.0, 10.0); + assert_eq!(s.doc().unwrap().doc.parent_of(art), Some(sub), "the art is in the sublayer"); + s.execute("select.set", &json!({"ids": [hidden.0]})).unwrap(); + s.execute("object.hide", &json!({})).unwrap(); + let d = &s.doc().unwrap().doc; + let (sub_node, symbols) = (d.node(sub).unwrap().clone(), d.symbol_boxes()); + let mut g = Gathered::new(); + super::outline_points(&sub_node, &symbols, &mut g, 0); + let (center, r) = shapes::enclosing_circle(&g.points).unwrap(); + assert!(center.distance(Point::new(50.0, 50.0)) < 1e-9 && (r - 50.0 * 2f64.sqrt()).abs() < 1e-9, "{center:?} {r}"); + + // The top object of the sublayer becomes its clipping path. + s.execute("select.none", &json!({})).unwrap(); + let clip = rect(&mut s, 20.0, 20.0, 10.0, 10.0); + assert_eq!(s.doc().unwrap().doc.parent_of(clip), Some(sub)); + s.execute("select.none", &json!({})).unwrap(); + assert!(s.execute("layer.clippingMask.toggle", &json!({"id": sub.0})).unwrap()["clip"].as_bool().unwrap()); + let d = &s.doc().unwrap().doc; + let sub_node = d.node(sub).unwrap().clone(); + let mut g = Gathered::new(); + super::outline_points(&sub_node, &d.symbol_boxes(), &mut g, 0); + let (center, r) = shapes::enclosing_circle(&g.points).unwrap(); + assert!(center.distance(Point::new(25.0, 25.0)) < 1e-9 && (r - 5.0 * 2f64.sqrt()).abs() < 1e-9, "{center:?} {r}"); +} + +/// In an isolated group the shape goes on top of the group's art; in an isolated compound path it +/// goes beside the compound path, never into it. +#[test] +fn shapes_go_into_an_isolated_group_but_not_an_isolated_compound_path() { + let mut s = session(); + let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0); + let b = rect(&mut s, 20.0, 0.0, 10.0, 10.0); + s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap(); + let group = id_of(&s.execute("object.group", &json!({})).unwrap()); + s.execute("object.isolate", &json!({"id": group.0})).unwrap(); + s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap(); + let id = id_of(&s.execute(RECTANGLE, &json!({})).unwrap()); + assert_eq!(s.doc().unwrap().doc.parent_of(id), Some(group)); + assert_eq!(top_of(&s, group), id); + s.execute("object.exitIsolation", &json!({})).unwrap(); + + let c = rect(&mut s, 100.0, 100.0, 10.0, 10.0); + let e = rect(&mut s, 120.0, 100.0, 10.0, 10.0); + s.execute("select.set", &json!({"ids": [c.0, e.0]})).unwrap(); + let compound = id_of(&s.execute("object.compoundPath.make", &json!({})).unwrap()); + s.execute("object.isolate", &json!({"id": compound.0})).unwrap(); + let members: Vec = node(&s, compound).children().unwrap().iter().map(|n| n.id.0).collect(); + s.execute("select.set", &json!({"ids": members})).unwrap(); + let id = id_of(&s.execute(CIRCLE, &json!({})).unwrap()); + let d = &s.doc().unwrap().doc; + assert_ne!(d.parent_of(id), Some(compound), "the circle does not join the compound path"); + assert_eq!(d.parent_of(id), d.parent_of(compound)); + assert_eq!(node(&s, compound).children().unwrap().len(), 2); +} + +/// An offset or each that is not one the commands take is an error, and nothing is drawn; with +/// nothing selected the commands are not available. +#[test] +fn bad_params_and_an_empty_selection_draw_nothing() { + let mut s = session(); + assert!(s.execute(RECTANGLE, &json!({})).is_err(), "nothing selected"); + assert!(s.execute(CIRCLE, &json!({})).is_err(), "nothing selected"); + let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0); + s.execute("select.set", &json!({"ids": [a.0]})).unwrap(); + for command in [RECTANGLE, CIRCLE] { + for p in [json!({"offset": -1}), json!({"offset": "5"}), json!({"each": "yes"})] { + refused(&mut s, command, p); + } + assert!(refused(&mut s, command, json!({"offset": -1})).contains("`offset` must be 0 or more")); + } +} + +/// Many points keep only their hull's corners, and the circle around them is the one around all +/// of the points. +#[test] +fn gathered_points_keep_their_hull_and_circle() { + let mut g = Gathered::new(); + let c = Point::new(500.0, 300.0); + for i in 0..200_000 { + let angle = f64::from(i) * 0.618; + let r = if i % 1000 == 0 { 250.0 } else { f64::from(i % 200) }; + g.points.push(c + Vec2::from_angle(angle) * r); + g.compact(); + } + assert!(g.points.len() <= COMPACT_AT + 1, "{} points kept", g.points.len()); + let (center, radius) = shapes::enclosing_circle(&g.points).unwrap(); + assert!(center.distance(c) < 1e-6 && (radius - 250.0).abs() < 1e-6, "{center:?} {radius}"); +} diff --git a/crates/engine/src/cmd/plugin_call/reviewed.rs b/crates/engine/src/cmd/plugin_call/reviewed.rs index 12cf0740f0..11a59a9177 100644 --- a/crates/engine/src/cmd/plugin_call/reviewed.rs +++ b/crates/engine/src/cmd/plugin_call/reviewed.rs @@ -46,6 +46,8 @@ pub(super) const ALLOWED: &[&str] = &[ "addon.packaging.setRole", "addon.packaging.setRoleSwatch", "addon.pathtools.addPoints", + "addon.pathtools.boundingCircle", + "addon.pathtools.boundingRectangle", "addon.pathtools.close", "addon.pathtools.commonTangents", "addon.pathtools.corner", diff --git a/crates/geom/src/shapes.rs b/crates/geom/src/shapes.rs index 76b9b71798..941ee239e3 100644 --- a/crates/geom/src/shapes.rs +++ b/crates/geom/src/shapes.rs @@ -355,6 +355,93 @@ pub fn circle_through(a: Point, b: Point, c: Point) -> Option<(Point, f64)> { (center.is_finite() && radius.is_finite()).then_some((center, radius)) } +/// The smallest circle that holds every one of `points`: its center and radius. Points that are +/// not finite are skipped; `None` when no finite point is left. One point gives a circle of +/// radius 0 around it. +pub fn enclosing_circle(points: &[Point]) -> Option<(Point, f64)> { + let mut hull = convex_hull(points.iter().copied().filter(|p| p.is_finite()).collect()); + // A fixed shuffle keeps the expected work linear for any order of the points, and the same + // points always give the same circle. + let mut seed: u64 = 0x9E37_79B9_7F4A_7C15; + for i in (1..hull.len()).rev() { + seed ^= seed << 13; + seed ^= seed >> 7; + seed ^= seed << 17; + hull.swap(i, (seed % (i as u64 + 1)) as usize); + } + // The work is done relative to one of the points, so the rounding allowance in `holds` scales + // with the size of the points' spread, not with their distance from the origin. + let origin = *hull.first()?; + for p in &mut hull { + *p = (*p - origin).to_point(); + } + let first = Point::ORIGIN; + let holds = |(c, r): (Point, f64), p: Point| (p - c).hypot() <= r + 1e-12 * (r + c.to_vec2().hypot()); + let diameter = |a: Point, b: Point| (a.midpoint(b), (b - a).hypot() / 2.0); + let mut circle = (first, 0.0); + for (i, &pi) in hull.iter().enumerate().skip(1) { + if holds(circle, pi) { + continue; + } + circle = (pi, 0.0); + for (j, &pj) in hull.iter().enumerate().take(i) { + if holds(circle, pj) { + continue; + } + circle = diameter(pi, pj); + for &pk in &hull[..j] { + if holds(circle, pk) { + continue; + } + circle = circle_through(pi, pj, pk).unwrap_or_else(|| { + // Three points on one line: the circle on the two farthest apart. + let pairs = [(pi, pj), (pj, pk), (pk, pi)]; + let far = pairs.into_iter().fold((pi, pj), |a, b| if (b.1 - b.0).hypot2() > (a.1 - a.0).hypot2() { b } else { a }); + diameter(far.0, far.1) + }); + } + } + } + // The radius reaches the farthest point exactly, whatever rounding the steps above left. + let center = circle.0; + let radius = hull.iter().map(|p| (*p - center).hypot()).fold(0.0, f64::max); + let center = center + origin.to_vec2(); + (center.is_finite() && radius.is_finite()).then_some((center, radius)) +} + +/// The corners of the convex hull of `points`, counter-clockwise in a y-up frame, without points +/// on its edges. Fewer than three points, or points on one line, give their ends. Points that are +/// not finite are left out. +pub fn convex_hull(mut points: Vec) -> Vec { + points.retain(|p| p.is_finite()); + points.sort_by(|a, b| a.x.total_cmp(&b.x).then(a.y.total_cmp(&b.y))); + points.dedup(); + if points.len() < 3 { + return points; + } + // Andrew's monotone chain: the lower chain left to right, then the upper chain right to left. + let mut hull: Vec = Vec::with_capacity(points.len() + 1); + chain(&mut hull, points.iter().copied()); + chain(&mut hull, points.iter().rev().copied()); + hull +} + +/// Adds to `hull` the chain of `points` that turns left at every corner, without its last point, +/// which starts the next chain. +fn chain(hull: &mut Vec, points: impl Iterator) { + let start = hull.len(); + for p in points { + while let [.., o, a] = hull[start..] { + if (a - o).cross(p - o) > 0.0 { + break; + } + hull.pop(); + } + hull.push(p); + } + hull.pop(); +} + /// Regular polygon with `sides` (≥ 3), first vertex straight up from the centre. pub fn polygon(center: Point, radius: f64, sides: u32, rotation_deg: f64) -> PathData { let n = sides.max(3); @@ -770,6 +857,54 @@ mod tests { assert_eq!(circle_through(a, b, Point::new(0.0, 1e-12)), None); } + /// The smallest circle around a set of points: two points far apart are its diameter and the + /// points between them change nothing; an acute triangle's corners lie on it; a right triangle + /// is held by the circle on its hypotenuse; and points on one line give the circle on the two + /// ends. + #[test] + fn the_enclosing_circle_is_the_smallest_that_holds_every_point() { + let near = |(c, r): (Point, f64), want: Point, wr: f64| c.distance(want) < 1e-9 && (r - wr).abs() < 1e-9; + let pts = [Point::new(0.0, 0.0), Point::new(10.0, 0.0), Point::new(5.0, 1.0), Point::new(4.0, -2.0)]; + let got = enclosing_circle(&pts).unwrap(); + assert!(near(got, Point::new(5.0, 0.0), 5.0), "{got:?}"); + // An equilateral triangle of side 6: radius 6 / √3, center at its centroid. + let h = 27.0_f64.sqrt(); + let tri = [Point::new(0.0, 0.0), Point::new(6.0, 0.0), Point::new(3.0, h), Point::new(3.0, 1.0)]; + let got = enclosing_circle(&tri).unwrap(); + assert!(near(got, Point::new(3.0, h / 3.0), 6.0 / 3.0_f64.sqrt()), "{got:?}"); + let right = [Point::new(0.0, 0.0), Point::new(8.0, 0.0), Point::new(0.0, 6.0)]; + assert!(near(enclosing_circle(&right).unwrap(), Point::new(4.0, 3.0), 5.0)); + let line: Vec = (0..20).map(|i| Point::new(f64::from(i), 2.0 * f64::from(i))).collect(); + let got = enclosing_circle(&line).unwrap(); + assert!(near(got, Point::new(9.5, 19.0), Point::new(19.0, 38.0).distance(Point::ORIGIN) / 2.0), "{got:?}"); + } + + /// Many points on a circle, in any order and far from the origin, give that circle; every + /// point is held. One point gives a circle of radius 0, and no finite point gives none. + #[test] + fn the_enclosing_circle_holds_every_point_in_any_order() { + let c = Point::new(4.0e5, -3.0e5); + let mut pts: Vec = (0..997).map(|i| c + Vec2::from_angle(f64::from(i) * 0.37) * 120.0).collect(); + pts.extend((0..500).map(|i| c + Vec2::from_angle(f64::from(i)) * (f64::from(i % 97) + 1.0))); + for order in 0..3 { + if order == 1 { + pts.reverse(); + } else if order == 2 { + pts.sort_by(|a, b| a.x.total_cmp(&b.x)); + } + let (center, r) = enclosing_circle(&pts).unwrap(); + assert!(center.distance(c) < 1e-6 && (r - 120.0).abs() < 1e-6, "{center:?} {r}"); + assert!(pts.iter().all(|p| p.distance(center) <= r + 1e-9), "a point is outside"); + } + // Small art far from the origin keeps its smallest circle. + let far = [Point::new(1.0e12, 5.0), Point::new(1.0e12 + 1.0, 5.0)]; + assert_eq!(enclosing_circle(&far), Some((Point::new(1.0e12 + 0.5, 5.0), 0.5))); + let one = Point::new(3.0, 4.0); + assert_eq!(enclosing_circle(&[one, one, Point::new(f64::NAN, 1.0)]), Some((one, 0.0))); + assert_eq!(enclosing_circle(&[]), None); + assert_eq!(enclosing_circle(&[Point::new(f64::INFINITY, 0.0)]), None); + } + #[test] fn rect_is_4_corners_clockwise() { let p = rectangle(Rect::new(0.0, 0.0, 100.0, 50.0)); diff --git a/crates/ui-egui/src/addons/pathtools.rs b/crates/ui-egui/src/addons/pathtools.rs index 011af4b171..34877b0c9e 100644 --- a/crates/ui-egui/src/addons/pathtools.rs +++ b/crates/ui-egui/src/addons/pathtools.rs @@ -1,6 +1,6 @@ //! Path Precision Tools in the interface: its submenu (Object › Plug-ins › Path Precision Tools), //! which selects its tools, opens its panels and runs Split / Add Points at Crossings, Set Corners… ([`set_corners`]), Divide into -//! Dashes ([`dashes`]), Expand Dashes into Paths, Convert to Parametric Shape and Tangent Circle… ([`tangent_circle`]); the Anchor Inspector panel (the selected +//! Dashes ([`dashes`]), Expand Dashes into Paths, Convert to Parametric Shape, Tangent Circle… ([`tangent_circle`]), Add Bounding Rectangle and Add Bounding Circle; the Anchor Inspector panel (the selected //! anchor's position and handles as numbers, the add-on's anchor edits, the Corner Tool's values, //! [`corner`], and the Shared Edge Merge Tool's, [`shared_edge`]); the Parametric Shape panel //! ([`shape`]); and its tools' options dialog (a double-click on the tool). Everything acts through `addon.pathtools.*` and @@ -77,6 +77,8 @@ pub fn menu() -> Vec { Item::Cmd("Convert to Parametric Shape", "addon.pathtools.shape.convert", json!({})), Item::Cmd("Tangent Circle…", tangent_circle::COMMAND, Value::Null), Item::Cmd("Common Tangents…", COMMON_TANGENTS, json!({ "tangents": "all", "centerline": false })), + Item::Cmd("Add Bounding Rectangle", "addon.pathtools.boundingRectangle", json!({})), + Item::Cmd("Add Bounding Circle", "addon.pathtools.boundingCircle", json!({})), ] } diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 3d3811c403..2ea888cea1 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -7009,6 +7009,9 @@ breakText Glyphs Глифи @msg `circle` is past the last circle found ({found}) `circle` е след последната намерена окръжност ({found}) @msg object {value} is not a path or compound path обект {value} не е път или съставен път @msg these shapes are too small to measure тези форми са твърде малки, за да бъдат измерени +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Добавяне на ограничаващ правоъгълник + Add Bounding Circle Добавяне на ограничаваща окръжност # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Инструменти за документи Save a Timestamped Copy Запазване на копие с дата и час diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index b053827273..a16ab4746f 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -7058,6 +7058,9 @@ shape Open Otvoren @msg `circle` is past the last circle found ({found}) `circle` je iza posljednje pronađene kružnice ({found}) @msg object {value} is not a path or compound path objekat {value} nije putanja ni složena putanja @msg these shapes are too small to measure ovi oblici su premali za mjerenje +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Dodaj granični pravougaonik + Add Bounding Circle Dodaj granični krug # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Alati za dokument Save a Timestamped Copy Sačuvaj kopiju s datumom i vremenom diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 126ae03109..0561c39c61 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -7779,6 +7779,11 @@ breakText Glyphs Glifs @msg `circle` is past the last circle found ({found}) `circle` passa de l’últim cercle trobat ({found}) @msg object {value} is not a path or compound path l’objecte {value} no és un camí ni un camí compost @msg these shapes are too small to measure aquestes formes són massa petites per mesurar-les +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Afegeix un rectangle delimitador + Add Bounding Circle Afegeix un cercle delimitador +@msg nothing to enclose no hi ha res per envoltar +@msg `offset` must be 0 or more `offset` ha de ser 0 o més # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Eines del document Save a Timestamped Copy Desa una còpia amb data i hora diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 086b9b2f90..9be23abef8 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -7764,6 +7764,11 @@ breakText Glyphs Glyfy @msg `circle` is past the last circle found ({found}) `circle` je za poslední nalezenou kružnicí ({found}) @msg object {value} is not a path or compound path objekt {value} není cesta ani složená cesta @msg these shapes are too small to measure tyto tvary jsou příliš malé na měření +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Přidat ohraničující obdélník + Add Bounding Circle Přidat ohraničující kružnici +@msg nothing to enclose není co ohraničit +@msg `offset` must be 0 or more `offset` musí být 0 nebo více # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Nástroje dokumentu Save a Timestamped Copy Uložit kopii s datem a časem diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index eb7fa71fdc..8d9afe8019 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -9823,6 +9823,11 @@ breakText Glyphs Glyffer @msg `circle` is past the last circle found ({found}) `circle` ligger efter den sidste fundne cirkel ({found}) @msg object {value} is not a path or compound path objekt {value} er ikke en sti eller sammensat sti @msg these shapes are too small to measure disse figurer er for små til at blive målt +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Tilføj afgrænsende rektangel + Add Bounding Circle Tilføj afgrænsende cirkel +@msg nothing to enclose intet at omslutte +@msg `offset` must be 0 or more `offset` skal være 0 eller mere # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Dokumentværktøjer Save a Timestamped Copy Gem en kopi med dato og klokkeslæt diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 84c9ca0788..c77c4a27d9 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -7359,6 +7359,11 @@ breakText Glyphs Glyphen @msg `circle` is past the last circle found ({found}) `circle` liegt hinter dem letzten gefundenen Kreis ({found}) @msg object {value} is not a path or compound path Objekt {value} ist kein Pfad oder zusammengesetzter Pfad @msg these shapes are too small to measure diese Formen sind zu klein zum Messen +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Begrenzungsrechteck hinzufügen + Add Bounding Circle Begrenzungskreis hinzufügen +@msg nothing to enclose nichts zu umschließen +@msg `offset` must be 0 or more `offset` muss 0 oder größer sein # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Dokumentwerkzeuge Save a Timestamped Copy Kopie mit Zeitstempel speichern diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 74b1a19dec..5baf8c7594 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -7752,6 +7752,11 @@ breakText Glyphs Γλύφοι @msg `circle` is past the last circle found ({found}) το `circle` είναι μετά τον τελευταίο κύκλο που βρέθηκε ({found}) @msg object {value} is not a path or compound path το αντικείμενο {value} δεν είναι διαδρομή ή σύνθετη διαδρομή @msg these shapes are too small to measure αυτά τα σχήματα είναι πολύ μικρά για να μετρηθούν +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Προσθήκη ορθογωνίου οριοθέτησης + Add Bounding Circle Προσθήκη κύκλου οριοθέτησης +@msg nothing to enclose δεν υπάρχει τίποτα για περίκλειση +@msg `offset` must be 0 or more το `offset` πρέπει να είναι 0 ή μεγαλύτερο # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Εργαλεία εγγράφου Save a Timestamped Copy Αποθήκευση αντιγράφου με ημερομηνία και ώρα diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index f0244278fd..ddb5653a8f 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -7740,6 +7740,11 @@ breakText Glyphs Glifos @msg `circle` is past the last circle found ({found}) `circle` pasa del último círculo encontrado ({found}) @msg object {value} is not a path or compound path el objeto {value} no es un trazado ni un trazado compuesto @msg these shapes are too small to measure estas formas son demasiado pequeñas para medirlas +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Agregar rectángulo delimitador + Add Bounding Circle Agregar círculo delimitador +@msg nothing to enclose no hay nada que rodear +@msg `offset` must be 0 or more `offset` debe ser 0 o más # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Herramientas de documento Save a Timestamped Copy Guardar una copia con fecha y hora diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 66ac99ffb1..1b84fdb7a6 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -7828,6 +7828,11 @@ breakText Glyphs Merkit @msg `circle` is past the last circle found ({found}) `circle` on viimeisen löydetyn ympyrän jälkeen ({found}) @msg object {value} is not a path or compound path objekti {value} ei ole polku eikä yhdistelmäpolku @msg these shapes are too small to measure nämä muodot ovat liian pieniä mitattaviksi +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Lisää rajaava suorakulmio + Add Bounding Circle Lisää rajaava ympyrä +@msg nothing to enclose ei ympäröitävää +@msg `offset` must be 0 or more `offset` on oltava 0 tai enemmän # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Asiakirjatyökalut Save a Timestamped Copy Tallenna kopio aikaleimalla diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index b551e3cbe2..c176334b22 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -7759,6 +7759,11 @@ breakText Glyphs Glyphes @msg `circle` is past the last circle found ({found}) `circle` dépasse le dernier cercle trouvé ({found}) @msg object {value} is not a path or compound path l’objet {value} n’est ni un tracé ni un tracé transparent @msg these shapes are too small to measure ces formes sont trop petites pour être mesurées +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Ajouter un rectangle englobant + Add Bounding Circle Ajouter un cercle englobant +@msg nothing to enclose rien à entourer +@msg `offset` must be 0 or more `offset` doit être supérieur ou égal à 0 # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Outils de document Save a Timestamped Copy Enregistrer une copie horodatée diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 9f6ce6b664..3715bbf14e 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -3066,6 +3066,9 @@ @msg One path lies inside the other, so they have no common tangents એક પાથ બીજાની અંદર છે, તેથી તેમની કોઈ સામાન્ય સ્પર્શરેખા નથી @msg The paths overlap, so they have no internal tangents પાથ એકબીજા પર ચઢેલા છે, તેથી તેમની કોઈ આંતરિક સ્પર્શરેખા નથી @msg One path lies inside the other, so they have no internal tangents એક પાથ બીજાની અંદર છે, તેથી તેમની કોઈ આંતરિક સ્પર્શરેખા નથી +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle બાઉન્ડિંગ લંબચોરસ ઉમેરો + Add Bounding Circle બાઉન્ડિંગ વર્તુળ ઉમેરો Remove Guide ગાઇડ દૂર કરો Remove Item આઇટમ દૂર કરો Remove JavaScript File JavaScript ફાઇલ દૂર કરો diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 3e144d045a..7557909098 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -8401,6 +8401,11 @@ liquify-list-end {0}, {1} {0} और {1} @msg One path lies inside the other, so they have no common tangents एक पाथ दूसरे के अंदर है, इसलिए उनकी कोई उभयनिष्ठ स्पर्शरेखा नहीं है @msg The paths overlap, so they have no internal tangents पाथ एक-दूसरे पर चढ़े हुए हैं, इसलिए उनकी कोई आंतरिक स्पर्शरेखा नहीं है @msg One path lies inside the other, so they have no internal tangents एक पाथ दूसरे के अंदर है, इसलिए उनकी कोई आंतरिक स्पर्शरेखा नहीं है +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle बाउंडिंग आयत जोड़ें + Add Bounding Circle बाउंडिंग वृत्त जोड़ें +@msg nothing to enclose घेरने के लिए कुछ नहीं +@msg `offset` must be 0 or more `offset` 0 या उससे अधिक होना चाहिए @msg select plain rectangles, ellipses or regular polygons to convert बदलने के लिए सादे आयत, अंडाकार या नियमित बहुभुजों सिलेक्ट करें @msg Select point type पॉइंट टाइप सिलेक्ट करें @msg select two or three paths or compound paths दो या तीन पाथ या यौगिक पाथ सिलेक्ट करें diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 977b6062b6..2a582802b9 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -7749,6 +7749,11 @@ breakText Glyphs Glifák @msg `circle` is past the last circle found ({found}) a `circle` az utolsó talált kör után van ({found}) @msg object {value} is not a path or compound path a(z) {value} objektum nem útvonal és nem összetett útvonal @msg these shapes are too small to measure ezek az alakzatok túl kicsik a méréshez +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Befoglaló téglalap hozzáadása + Add Bounding Circle Befoglaló kör hozzáadása +@msg nothing to enclose nincs mit körülvenni +@msg `offset` must be 0 or more `offset`: 0 vagy nagyobb érték kell # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Dokumentumeszközök Save a Timestamped Copy Másolat mentése időbélyeggel diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 97280c99bc..b1fa8f0d3f 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -7026,6 +7026,9 @@ breakText Glyphs Glif @msg `circle` is past the last circle found ({found}) `circle` melewati lingkaran terakhir yang ditemukan ({found}) @msg object {value} is not a path or compound path objek {value} bukan jalur atau jalur gabungan @msg these shapes are too small to measure bentuk ini terlalu kecil untuk diukur +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Tambahkan persegi panjang pembatas + Add Bounding Circle Tambahkan lingkaran pembatas # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Alat dokumen Save a Timestamped Copy Simpan salinan bercap waktu diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 9465b6aca8..38f0682df2 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -7397,6 +7397,11 @@ breakText Glyphs Glifi @msg `circle` is past the last circle found ({found}) `circle` va oltre l’ultimo cerchio trovato ({found}) @msg object {value} is not a path or compound path l’oggetto {value} non è un tracciato né un tracciato composto @msg these shapes are too small to measure queste forme sono troppo piccole per essere misurate +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Aggiungi rettangolo di delimitazione + Add Bounding Circle Aggiungi cerchio di delimitazione +@msg nothing to enclose niente da racchiudere +@msg `offset` must be 0 or more `offset` deve essere 0 o maggiore # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Strumenti documento Save a Timestamped Copy Salva una copia con data e ora diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 91c85b9e27..2ea2217c37 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -9280,6 +9280,11 @@ breakText Glyphs 字形 @msg `circle` is past the last circle found ({found}) `circle` が見つかった最後の円を超えています({found}) @msg object {value} is not a path or compound path オブジェクト {value} はパスでも複合パスでもありません @msg these shapes are too small to measure これらのシェイプは小さすぎて測定できません +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle 外接長方形を追加 + Add Bounding Circle 外接円を追加 +@msg nothing to enclose 囲むものがありません +@msg `offset` must be 0 or more `offset` には 0 以上を指定してください # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools ドキュメントツール Save a Timestamped Copy 日時付きのコピーを保存 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 6fa08c2bd6..cfa8ae9215 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -9975,6 +9975,11 @@ breakText Glyphs გლიფები @msg `circle` is past the last circle found ({found}) `circle` ბოლო ნაპოვნი წრის შემდეგაა ({found}) @msg object {value} is not a path or compound path ობიექტი {value} არ არის ტრაექტორია ან შედგენილი ტრაექტორია @msg these shapes are too small to measure ეს ფიგურები ზედმეტად პატარაა გასაზომად +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle შემომსაზღვრელი მართკუთხედის დამატება + Add Bounding Circle შემომსაზღვრელი წრეწირის დამატება +@msg nothing to enclose შემოსაზღვრელი არაფერია +@msg `offset` must be 0 or more `offset` უნდა იყოს 0 ან მეტი # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools დოკუმენტის ხელსაწყოები Save a Timestamped Copy ასლის შენახვა თარიღითა და დროით diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index b0182a55e1..da2b280b6b 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -7361,6 +7361,11 @@ breakText Glyphs 글리프 @msg `circle` is past the last circle found ({found}) `circle`이(가) 찾은 마지막 원을 넘었습니다({found}) @msg object {value} is not a path or compound path 오브젝트 {value}은(는) 패스나 컴파운드 패스가 아닙니다 @msg these shapes are too small to measure 이 모양들은 너무 작아서 측정할 수 없습니다 +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle 경계 사각형 추가 + Add Bounding Circle 경계 원 추가 +@msg nothing to enclose 둘러쌀 항목이 없습니다 +@msg `offset` must be 0 or more `offset`은(는) 0 이상이어야 합니다 # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools 문서 도구 Save a Timestamped Copy 날짜와 시간이 붙은 사본 저장 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index ab8455de30..06462734ad 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -9655,6 +9655,11 @@ breakText Glyphs Glyphs @msg `circle` is past the last circle found ({found}) `circle` ligt voorbij de laatst gevonden cirkel ({found}) @msg object {value} is not a path or compound path object {value} is geen pad of samengesteld pad @msg these shapes are too small to measure deze vormen zijn te klein om te meten +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Begrenzingsrechthoek toevoegen + Add Bounding Circle Begrenzingscirkel toevoegen +@msg nothing to enclose niets om te omsluiten +@msg `offset` must be 0 or more `offset` moet 0 of meer zijn # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Documentgereedschappen Save a Timestamped Copy Een kopie met tijdstempel opslaan diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 9713139beb..23b371932f 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -7627,6 +7627,11 @@ breakText Glyphs Glify @msg `circle` is past the last circle found ({found}) `circle` wykracza poza ostatni znaleziony okrąg ({found}) @msg object {value} is not a path or compound path obiekt {value} nie jest ścieżką ani ścieżką złożoną @msg these shapes are too small to measure te kształty są za małe, aby je zmierzyć +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Dodaj prostokąt otaczający + Add Bounding Circle Dodaj okrąg otaczający +@msg nothing to enclose nie ma czego otoczyć +@msg `offset` must be 0 or more `offset` musi wynosić 0 lub więcej # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Narzędzia dokumentu Save a Timestamped Copy Zapisz kopię z datą i godziną diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 847946c680..de1ddb14d5 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -7791,6 +7791,11 @@ breakText Glyphs Glifos @msg `circle` is past the last circle found ({found}) `circle` passa do último círculo encontrado ({found}) @msg object {value} is not a path or compound path o objeto {value} não é um caminho nem um caminho composto @msg these shapes are too small to measure estas formas são pequenas demais para medir +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Adicionar Retângulo Delimitador + Add Bounding Circle Adicionar Círculo Delimitador +@msg nothing to enclose nada para envolver +@msg `offset` must be 0 or more `offset` deve ser 0 ou mais # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Ferramentas de Documento Save a Timestamped Copy Salvar uma Cópia com Data e Hora diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 4ff987ee2b..364e3d8bf7 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -7754,6 +7754,11 @@ breakText Glyphs Глифы @msg `circle` is past the last circle found ({found}) `circle` больше числа найденных окружностей ({found}) @msg object {value} is not a path or compound path объект {value} не является контуром или составным контуром @msg these shapes are too small to measure эти фигуры слишком малы для измерения +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Добавить описанный прямоугольник + Add Bounding Circle Добавить описанную окружность +@msg nothing to enclose нечего окружать +@msg `offset` must be 0 or more `offset` должно быть 0 или больше # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Инструменты документа Save a Timestamped Copy Сохранить копию с датой и временем diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index ca3e9260cb..ce4561425a 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -7798,6 +7798,11 @@ breakText Glyphs Glyfer @msg `circle` is past the last circle found ({found}) `circle` ligger efter den sista funna cirkeln ({found}) @msg object {value} is not a path or compound path objekt {value} är inte en bana eller sammansatt bana @msg these shapes are too small to measure formerna är för små för att mätas +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Lägg till omslutande rektangel + Add Bounding Circle Lägg till omslutande cirkel +@msg nothing to enclose inget att omsluta +@msg `offset` must be 0 or more `offset` måste vara 0 eller mer # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Dokumentverktyg Save a Timestamped Copy Spara en kopia med tidsstämpel diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 9e67a2571a..f6e9f82f25 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -9653,6 +9653,11 @@ breakText Glyphs Glifler @msg `circle` is past the last circle found ({found}) `circle` bulunan son dairenin ötesinde ({found}) @msg object {value} is not a path or compound path {value} nesnesi bir yol veya bileşik yol değil @msg these shapes are too small to measure bu şekiller ölçülemeyecek kadar küçük +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Çevreleyen Dikdörtgen Ekle + Add Bounding Circle Çevreleyen Daire Ekle +@msg nothing to enclose çevrelenecek hiçbir şey yok +@msg `offset` must be 0 or more `offset` 0 veya daha büyük olmalıdır # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Belge Araçları Save a Timestamped Copy Zaman Damgalı Bir Kopya Kaydet diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 60bc172495..a0c25093b3 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -7379,6 +7379,11 @@ breakText Glyphs Гліфи @msg `circle` is past the last circle found ({found}) `circle` більше за кількість знайдених кіл ({found}) @msg object {value} is not a path or compound path об’єкт {value} не є контуром чи складеним контуром @msg these shapes are too small to measure ці фігури замалі для вимірювання +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Додати описаний прямокутник + Add Bounding Circle Додати описане коло +@msg nothing to enclose нічого обводити +@msg `offset` must be 0 or more `offset` має бути 0 або більше # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Інструменти документа Save a Timestamped Copy Зберегти копію з датою і часом diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 293551aeb8..4e5a3527b8 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -7415,6 +7415,11 @@ breakText Glyphs Glyph @msg `circle` is past the last circle found ({found}) `circle` vượt quá đường tròn cuối cùng tìm được ({found}) @msg object {value} is not a path or compound path đối tượng {value} không phải đường dẫn hay đường dẫn phức hợp @msg these shapes are too small to measure các hình này quá nhỏ để đo +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle Thêm hình chữ nhật bao quanh + Add Bounding Circle Thêm hình tròn bao quanh +@msg nothing to enclose không có gì để bao quanh +@msg `offset` must be 0 or more `offset` phải từ 0 trở lên # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Công cụ tài liệu Save a Timestamped Copy Lưu bản sao có ngày giờ diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 6ac837bf96..7f7d96c755 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -7609,6 +7609,11 @@ breakText Glyphs 字形 @msg `circle` is past the last circle found ({found}) `circle` 超出了找到的最后一个圆({found}) @msg object {value} is not a path or compound path 对象 {value} 不是路径或复合路径 @msg these shapes are too small to measure 这些形状太小,无法测量 +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle 添加外接矩形 + Add Bounding Circle 添加外接圆 +@msg nothing to enclose 没有可包围的内容 +@msg `offset` must be 0 or more `offset` 必须大于或等于 0 # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools 文档工具 Save a Timestamped Copy 保存带时间戳的副本 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index fa65e7cd45..ffbf0c607f 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -7420,6 +7420,11 @@ breakText Glyphs 字符 @msg `circle` is past the last circle found ({found}) `circle` 超出了找到的最後一個圓({found}) @msg object {value} is not a path or compound path 物件 {value} 不是路徑或複合路徑 @msg these shapes are too small to measure 這些形狀太小,無法測量 +# Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. + Add Bounding Rectangle 新增外接矩形 + Add Bounding Circle 新增外接圓形 +@msg nothing to enclose 沒有可包圍的內容 +@msg `offset` must be 0 or more `offset` 必須大於或等於 0 # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools 文件工具 Save a Timestamped Copy 儲存附時間戳記的拷貝 diff --git a/docs/mcp.md b/docs/mcp.md index 11c3165efa..aadd3aa81a 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -13098,6 +13098,30 @@ Commands: the kind asked for, nothing changes, and the result's `warning` says why. Common Tangents… opens a dialog (Tangents, Centerline) with Preview. → `{ids, external, internal, centerline, warning?}` (`centerline`: the centerline's id, or null). +- `addon.pathtools.boundingRectangle {each?, offset?}` draws a live rectangle on the geometric bounding box of the + selected objects, strokes and effects left out (Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle, + #6966). `addon.pathtools.boundingCircle {each?, offset?}` draws the smallest live circle that holds the outlines of + the selected objects (Add Bounding Circle). The circle reads paths and compound paths by their curves, clip groups + and sublayers that clip their contents by their clipping paths, other sublayers by their shown objects, images by + their corners, and type and other objects by the corners of their bounding box. It splits each curve into pieces + until every piece's control points lie within 0.01 pt of its chord, fits the circle to the ends of the pieces, and + makes the radius 0.01 pt larger, so the circle holds the curves themselves. A curve is split into 1,024 pieces at + most; a piece that still bends more counts by its control points, which can make the circle slightly larger than the + smallest one. `offset` (0 or more, default 0) adds space: a rectangle grows by `offset` on each side and a circle's + radius grows by `offset`. `each: true` draws one shape around each selected object instead of one around the whole + selection. + + Each shape gets the current paint and goes on top of the current layer, or of the isolated group, as other new art + does; inside an isolated compound path it goes beside the compound path and does not join it. The new shapes are + selected, and one undo removes them all. An object with no outline (an empty group) gets no shape, and neither does + a shape with no size: the rectangle around a straight horizontal or vertical line, or the circle around a single + point, unless `offset` is more than 0. With `each`, the result's `skipped` counts those objects. It is an error, with + the document unchanged, when no shape is left to draw and when `offset` is below 0. → `{id: the first shape, ids, + skipped?}` + + ```json + {"name":"run_command","arguments":{"command":"addon.pathtools.boundingCircle","params":{"offset":2}}} + ``` A parametric shape is an ordinary path. It keeps its numbers, with a fingerprint of the outline they drew, in one entry of its object data (`vc-pathtools-shape`, as `document.node` lists `attrs.data`), which SVG export leaves out; diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 1a4de32fa2..76af9c2a79 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2694,6 +2694,10 @@ A VectorCraft addition, not a feature of the reference app, so no area score mov A VectorCraft addition, so no area score moves. Object › Plug-ins › Path Precision Tools › Tangent Circle… (`addon.pathtools.tangentCircle`) draws the circles that touch two selected paths or compound paths at a set radius, or that touch three of them; for three circles these are the solutions of the [problem of Apollonius](https://en.wikipedia.org/wiki/Problem_of_Apollonius), up to eight. The rest is VectorCraft's own: a circle touches a shape when it meets the outline without crossing it (the whole outline outside the circle or inside it), so it is tangent at a smooth point and passes through a corner or an open end; circles, ellipses at any angle and other closed or open paths all take part, a compound path's members as one outline. Circles are solved in closed form, each answer then moved onto the drawn Bézier outlines; other shapes are searched on a grid and refined with Newton's method on the curves, and with three shapes circles up to 64 times the diagonal of the box around the shapes' anchors and handles are found. The circles are listed by radius, then top to bottom, then left to right; the dialog previews every circle found, or one picked by number, and OK draws them with the current paint as one undo step. No circle, more than 64 (shapes touched along a whole curve) and more than 2000 segments are errors. Tests: `tangent_circle::tests` in `vectorcraft-pathops` (three circles: two known circles and eight distinct ones in a steady order; two circles and a radius; the search against the closed form; rotated and skewed ellipses against an independent solve of every combination; two circles close together; squares; a compound path moved far off and scaled; open paths and the errors), `cmd::addons::pathtools::tangent_circle::tests` in `vectorcraft-engine`, `tangent_circle_previews_picks_one_cancels_and_runs_on_ok` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Path Precision Tools add-on. +## Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle (2026-11-17) + +A VectorCraft addition, so no area score moves. Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle (`addon.pathtools.boundingRectangle`) draws a live rectangle on the selection's geometric bounding box, and Add Bounding Circle (`addon.pathtools.boundingCircle`) draws the [smallest enclosing circle](https://en.wikipedia.org/wiki/Smallest-circle_problem) of the selected outlines, with curves flattened to within 0.01 pt and the radius 0.01 pt larger, so the circle holds the curves. Both take `each` (one shape per object) and `offset`, use the current paint, go on top of the current layer or the isolated group, and are one undo step; shapes with no size are skipped (#6966). Tests: `shapes::tests` in `vectorcraft-geom` (`enclosing`) and `cmd::addons::pathtools::bounding::tests` in `vectorcraft-engine`. Commands: `docs/mcp.md` › Path Precision Tools add-on. + ## Path Precision Tools add-on: Expand Dashes into Paths (2026-11-01) A VectorCraft addition, not a feature of the reference app, so no area score moves. Object › Plug-ins › Path Precision Tools › Expand Dashes into Paths turns the dashed stroke of each selected path and compound path into separate open paths, one per dash, for cutters and plotters that need the centre lines rather than Outline Stroke's filled outlines. The dashes are laid out by the renderer's own dash code, so they match what the canvas draws: the dash pattern, its offset and Align Dashes to Corners and Path Ends, a dash running on through the start of a closed path, a dash all the way round staying closed, and under a round or projecting cap each dot (a dash of no length) as a path on its point. Each dash keeps the path's appearance with the top stroke's dashes and arrowheads off; the path's fills stay on it, below its dashes; a compound path's dashes are plain paths. One undo step; the dashes are selected; at most 100000 (more, or a pattern too fine to draw, is refused). Tests: `expand_dashes_*` in `cmd::addons::pathtools::tests` in `vectorcraft-engine` (the stroke kept with dashes off, the offset, one undo step, the fill kept below, dashes centred on corners when aligned, dots under round and butt caps, compound paths, refusals and the piece cap), `the_plugins_submenu_selects_the_tools_and_opens_the_anchor_inspector` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Path Precision Tools add-on. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 8ddaf7c662..526557c2c4 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -501,6 +501,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Trim at Crossings Tool (also in the Scissors tool's group in both shipped toolbars, after the Knife, and listed there in the All Tools drawer; a toolbar edited before keeps its saved layout until Reset Toolbar; no shortcut until one is set in Edit › Keyboard Shortcuts › Tools; the Knife's cursor, drawn as a knife with the blade's point on the hotspot) removes stretches of paths between the places where they are crossed, on any editable path, selected or not: a click removes the stretch under the pointer, a drag removes every stretch its rectangle touches, and an Alt-drag removes every stretch its freehand line crosses; one undo step each; Escape during a drag removes nothing; hovering shows in red the stretch a click would remove, and a drag that reaches few paths shows what its release would remove | done | `addon.pathtools.trim` (in `crates/engine/src/cmd/addons/pathtools/trim.rs`), `crates/tools/src/addons/trim.rs` and their tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Expand Dashes into Paths turns each selected path's dashed stroke into separate open paths, one per dash, laid out as the stroke draws them (pattern, offset, Align Dashes to Corners and Path Ends), each keeping the stroke with the dashes off; one undo step | done | #4922; `addon.pathtools.expandDashes` (in `crates/engine/src/cmd/addons/pathtools.rs`, using the renderer's dash layout) and its tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Tangent Circle… draws the circles that touch two selected paths or compound paths at a radius, or three of them, each touching the outlines without crossing them; Radius (two shapes), a Circle menu (All or one by number) and Preview; one undo step | done | `addon.pathtools.tangentCircle` (in `crates/engine/src/cmd/addons/pathtools/tangent_circle.rs`, geometry in `crates/pathops/src/addons/pathtools/tangent_circle.rs`) and its tests; a VectorCraft addition, so it is not scored | +| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle and Add Bounding Circle draw a live rectangle on the selection's geometric bounding box, or the smallest live circle that holds its outlines, around the whole selection or each object, with an optional offset; one undo step | done | `addon.pathtools.boundingRectangle` and `addon.pathtools.boundingCircle` (in `crates/engine/src/cmd/addons/pathtools/bounding.rs`, the circle in `crates/geom/src/shapes.rs`, `enclosing_circle`) and their tests; a VectorCraft addition, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Effect › Path Effects lists its live effects (Dashes to Geometry, Add Anchors, Extend Path, Close Path, Smooth Anchors, Retract Handles, Reverse Direction, Simplify Anchors, Split at Anchors), each with the effect dialog's live Preview except Reverse Direction, which has no options, and listed in the Appearance panel like any effect | done | `addon.path.*`, `crates/effects/src/addons/path.rs`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its four tools (Anchor Eraser Brush, Extend Path, Measure & Inspect, Parametric Shape), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and the Parametric Shape panel (kind, count, W/H, rotation, the kind's own values and corner radius of the selected parametric shape, or of the tool's next one), and runs Add Points at / Split at Crossings and Convert to Parametric Shape; the Parametric Shape Tool draws ten re-editable kinds from the centre (↑/↓ and ←/→ change their numbers while dragging) and edits a selected one with handles; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs`, `crates/ui-egui/src/addons/pathtools/shape.rs` and their tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its six tools (Anchor Eraser Brush, Extend Path, Measure & Inspect, Parametric Shape, Corner Tool, Slide Anchor Along Path), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and the Parametric Shape panel (kind, count, W/H, rotation, the kind's own values and corner radius of the selected parametric shape, or of the tool's next one), and runs Add Points at / Split at Crossings and Convert to Parametric Shape; the Parametric Shape Tool draws ten re-editable kinds from the centre (↑/↓ and ←/→ change their numbers while dragging) and edits a selected one with handles; the Corner Tool cuts editable corners on any path (hover shows the anchor, a click uses its radius and kind, a drag sizes the corner, Shift whole values; a corner's marker selects it and loads its values, drags to resize, to 0 or double-clicked removes it; never past what fits; Alt-marquee cuts every anchor inside) with a Corners section in the Anchor Inspector (radius, kind, selected count, Apply to Selected Anchors); Slide Anchor Along Path drags an anchor along its curve with the segments beside it refitted, Shift snapping where the tangent is a multiple of 45°; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs`, `crates/ui-egui/src/addons/pathtools/` and their tests; not a feature of the reference app, so it is not scored |