Path Precision Tools: Tangent Circle draws the circles that touch two or three shapes

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. A circle touches a shape when it meets the outline without
crossing it, with the whole outline outside the circle or inside it: at
a smooth point it is tangent there, and at a corner or an open end it
passes through that point. Circles, ellipses at any angle and other
closed or open paths all work; the members of a compound path count as
one outline.

When every shape is a circle, the circles are found in closed form (up
to eight for three circles, the problem of Apollonius) and then moved
onto the drawn Bézier circles, which differ from true circles by up to
0.0273% of the radius. Other shapes are searched on a grid, and the
centers left are refined with Newton's method on the curves. 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 takes the radius (with two shapes; 36 pt to start)
and previews every circle found or one picked by number; OK draws them
with the current paint as one undo step, selected. No circle, more than
64 circles (shapes touched along a whole curve, such as two concentric
circles), shapes at one point or too small for the radius, more than
2000 segments and a search past its limits are errors that leave the
document unchanged.

The Tangent Circle and Circle: rows are in every catalog, and the
command's messages in the catalogs that translate messages.

Docs: docs/mcp.md (Path Precision Tools add-on),
docs/target-app-parity.md, docs/ui-parity.md and ROADMAP.
This commit is contained in:
dotCooCoo committed 2026-11-15 16:37:17 -08:00
1 parent 5bd8acfce9
commit 4ad75291cb
46 files changed
+2254 -6

No files matched your search

+1
View File
@@ -141,6 +141,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap
- 2026-11-01: Expand Dashes into Paths joins the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): each selected path's dashed stroke becomes separate open paths, one per dash, laid out exactly as the stroke draws them (pattern, offset, Align Dashes to Corners and Path Ends), each keeping the stroke with the dashes off, so the gaps are real gaps for cutters and plotters, as one undo step (`addon.pathtools.expandDashes`, #4922).
- 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-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 `<name>_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.
+3 -1
View File
@@ -3,7 +3,7 @@
//! 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 and Trim at Crossings ([`trim`]).
//! into Paths, Trim at Crossings ([`trim`]) and Tangent Circle ([`tangent_circle`]).
//! Its tools, panels and submenu (Object › Plug-ins › Path Precision Tools) are the tools crate's
//! and the UI's.
@@ -12,6 +12,7 @@ mod corners;
mod effect_tests;
mod shape;
mod shared_edge;
mod tangent_circle;
#[cfg(test)]
mod tests;
mod trim;
@@ -180,6 +181,7 @@ pub fn specs() -> Vec<CommandSpec> {
v.extend(corners::specs());
v.extend(shared_edge::specs());
v.extend(trim::specs());
v.extend(tangent_circle::specs());
v
}
@@ -0,0 +1,130 @@
//! Tangent Circle: draw the circles that touch two paths or compound paths at a given radius, or
//! that touch three of them. The geometry is the pathops crate's
//! ([`tangent_circles`](vectorcraft_pathops::addons::pathtools::tangent_circles)).
use std::collections::HashSet;
use serde_json::{Value, json};
use vectorcraft_doc::{Document, LiveShape, Node, NodeId, NodeKind};
use vectorcraft_geom::{Affine, FillRule, PathData};
use vectorcraft_pathops::addons::pathtools::{self as pt, TangentCircleError};
use super::super::super::{CommandSpec, bad, checked_ids_or_selection, checked_ids_param, cmd, has_selection, index_opt, number_or};
use crate::{Result, Session};
#[cfg(test)]
mod tests;
/// The command.
pub(crate) const COMMAND: &str = "addon.pathtools.tangentCircle";
/// The undo step's name.
const LABEL: &str = "Tangent Circle";
/// The radius the command takes with two shapes (pt).
const RADIUS: std::ops::RangeInclusive<f64> = 0.01..=1e6;
pub(super) fn specs() -> Vec<CommandSpec> {
vec![cmd!(
"addon.pathtools.tangentCircle",
"Tangent Circle",
["Object", "Plug-ins", "Path Precision Tools"],
None,
"{ids?: [id…] (two or three paths or compound paths; default: the selection), radius?: pt 0.01..1000000 (needed with two shapes; three shapes set the radius themselves and take none), circle?: 0..64 (0: every circle found; n: only the nth, the circles listed by radius, then top to bottom, then left to right)} draw the circles that touch two shapes and have the radius, or that touch three shapes. A circle touches a shape when it meets the shape's outline without crossing it, the whole outline lying outside the circle or inside it: it is tangent to the outline at a smooth point and passes through a corner or an open end; the members of a compound path count as one outline. With three shapes, circles up to 64 times the diagonal of the box around the shapes' anchors and handles are found. Each circle is a new ellipse with the current paint on top of the current layer, or of the isolated group (inside an isolated compound path they join it); the circles are selected; one undo step. Locked and hidden shapes given by `ids` are read and left as they are. No circle is an error, and so are more than 64 (shapes touched along a whole curve, such as two concentric circles), an object named twice, shapes at one point or too small for the radius, and more than 2000 segments in all; the document is then unchanged → {ids, found (how many circles touch the shapes)}",
has_selection,
tangent_circle
)]
}
/// The paths of path or compound path `id`: itself, or its members.
fn paths_of(d: &Document, id: NodeId) -> Result<Vec<&PathData>> {
let value = id.0;
let n = d.node(id).ok_or_else(|| bad(COMMAND, format!("no such object id {value}")))?;
match &n.kind {
NodeKind::Path { path, .. } => Ok(vec![path]),
NodeKind::Compound { children, .. } => Ok(children.iter().filter_map(|c| c.path_data()).collect()),
_ => Err(bad(COMMAND, format!("object {value} is not a path or compound path"))),
}
}
/// The outlines of `ids`, each path's or compound path's subpaths together; counted before they
/// are copied.
fn outlines(d: &Document, ids: &[NodeId]) -> Result<Vec<PathData>> {
let parts = ids.iter().map(|id| paths_of(d, *id)).collect::<Result<Vec<_>>>()?;
let segments: usize = parts.iter().flatten().map(|p| pt::tangent_circle_segments(p)).sum();
if segments > pt::MAX_TANGENT_CIRCLE_SEGMENTS {
return Err(bad(COMMAND, TOO_COMPLEX));
}
Ok(parts.iter().map(|paths| PathData::new(paths.iter().flat_map(|p| p.subpaths.iter().cloned()).collect())).collect())
}
const TOO_COMPLEX: &str = "the shapes are too complex: at most 2000 segments in all";
fn tangent_circle(s: &mut Session, p: &Value) -> Result<Value> {
// A repeated id is refused before the ids inside another given one are dropped.
if p.get("ids").is_some_and(|v| !v.is_null()) {
let mut seen = HashSet::new();
if checked_ids_param(s, p, "ids", COMMAND)?.iter().any(|id| !seen.insert(*id)) {
return Err(bad(COMMAND, "`ids` names an object twice"));
}
}
let ids = checked_ids_or_selection(s, p, COMMAND)?;
let d = &s.doc()?.doc;
if !(2..=3).contains(&ids.len()) {
return Err(bad(COMMAND, "select two or three paths or compound paths"));
}
let outlines = outlines(d, &ids)?;
if outlines.iter().any(|o| o.subpaths.iter().all(|sp| sp.anchors.is_empty())) {
return Err(bad(COMMAND, "a shape has no outline"));
}
let given_radius = p.get("radius").is_some_and(|v| !v.is_null());
let radius = number_or(p, "radius", 0.0, COMMAND)?;
let radius = match (ids.len(), given_radius) {
(2, true) if RADIUS.contains(&radius) => Some(radius),
(2, true) => return Err(bad(COMMAND, "`radius` must be from 0.01 to 1000000 pt")),
(2, false) => return Err(bad(COMMAND, "two shapes need a `radius`")),
(_, true) => return Err(bad(COMMAND, "three shapes set the radius themselves: leave `radius` out")),
(_, false) => None,
};
let pick = index_opt(p, "circle", COMMAND)?.unwrap_or(0);
if pick > pt::MAX_TANGENT_CIRCLES {
return Err(bad(COMMAND, "`circle` must be from 0 to 64"));
}
let refs: Vec<&PathData> = outlines.iter().collect();
let found = pt::tangent_circles(&refs, radius).map_err(|e| match e {
// Every outline has points (checked above): all at one place, or too small for the radius.
TangentCircleError::BadInput => bad(COMMAND, "these shapes are too small to measure"),
// The segments were counted above: the search itself went past its limits.
TangentCircleError::TooComplex => bad(COMMAND, "these shapes take too long to search"),
TangentCircleError::TooMany => bad(COMMAND, "more than 64 circles touch these shapes: they may touch along a whole curve"),
})?;
if found.is_empty() {
return Err(bad(COMMAND, "no circle touches these shapes"));
}
let chosen: Vec<pt::Circle> = match pick {
0 => found.clone(),
n => match found.get(n - 1) {
Some(c) => vec![*c],
None => {
let found = found.len();
return Err(bad(COMMAND, format!("`circle` is past the last circle found ({found})")));
}
},
};
// Path art: inside an isolated compound path, the circles join it and take its appearance.
let parent = s.doc()?.target_parent_for_path()?;
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 c in &chosen {
let (r, at) = (c.radius, c.center);
let live = LiveShape::Ellipse { w: 2.0 * r, h: 2.0 * r, pie: (0.0, 360.0), xf: Affine::translate((at.x - r, at.y - r)) };
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)
})?;
Ok(json!({ "ids": ids.iter().map(|i| i.0).collect::<Vec<_>>(), "found": found.len() }))
}
@@ -0,0 +1,192 @@
//! Tangent Circle: circles drawn for two shapes and a radius or three shapes, one undo step, the
//! current paint, compound paths, one circle picked, and the errors that leave the document as it was.
use serde_json::{Value, json};
use vectorcraft_doc::{LiveShape, NodeId, NodeKind};
use vectorcraft_geom::Point;
use super::COMMAND;
use crate::Session;
fn session() -> Session {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 400, "height": 300})).unwrap();
s
}
fn ellipse(s: &mut Session, x: f64, y: f64, w: f64, h: f64, rotation: f64) -> u64 {
let id = s.execute("shape.ellipse", &json!({"x": x, "y": y, "width": w, "height": h, "rotation": rotation})).unwrap()["id"].as_u64().unwrap();
s.execute("select.none", &json!({})).unwrap();
id
}
fn circle(s: &mut Session, cx: f64, cy: f64, r: f64) -> u64 {
ellipse(s, cx - r, cy - r, 2.0 * r, 2.0 * r, 0.0)
}
fn undo_steps(s: &Session) -> usize {
s.doc().unwrap().history.undo.len()
}
fn count(s: &Session) -> usize {
s.doc().unwrap().doc.layers[0].children().unwrap().len()
}
/// The circle path `id` is: (center, radius) from its live ellipse.
fn drawn(s: &Session, id: &Value) -> (Point, f64) {
let n = s.doc().unwrap().doc.node(NodeId(id.as_u64().unwrap())).unwrap();
let NodeKind::Path { live: Some(live), .. } = &n.kind else { panic!("not a live shape") };
let LiveShape::Ellipse { w, h, xf, .. } = live.as_ref() else { panic!("not an ellipse") };
assert!((w - h).abs() < 1e-9);
(*xf * Point::new(w / 2.0, h / 2.0), w / 2.0)
}
fn refused(s: &mut Session, p: Value) -> String {
let (steps, objects) = (undo_steps(s), count(s));
let e = s.execute(COMMAND, &p).unwrap_err().to_string();
assert_eq!((undo_steps(s), count(s)), (steps, objects), "{p} changed the document");
e
}
#[test]
fn two_circles_and_a_radius_draw_every_circle_as_one_step() {
let mut s = session();
let a = circle(&mut s, 100.0, 100.0, 10.0);
let b = circle(&mut s, 130.0, 100.0, 10.0);
s.execute("paint.setFill", &json!({"color": "#12ab34"})).unwrap();
let steps = undo_steps(&s);
let r = s.execute(COMMAND, &json!({"ids": [a, b], "radius": 20})).unwrap();
assert_eq!(r["found"], 6);
let ids = r["ids"].as_array().unwrap().clone();
assert_eq!(ids.len(), 6);
assert_eq!(undo_steps(&s), steps + 1);
assert_eq!(count(&s), 8);
let st = s.doc().unwrap();
assert_eq!(st.selection.objects.len(), 6);
let fill = st.doc.node(NodeId(ids[0].as_u64().unwrap())).unwrap().appearance.fill_paint();
assert_eq!(fill, s.paint.fill);
// Outside both: 30 from each center, at x = 115.
let h = (900.0f64 - 225.0).sqrt();
let centers: Vec<(Point, f64)> = ids.iter().map(|id| drawn(&s, id)).collect();
for want in [Point::new(115.0, 100.0 - h), Point::new(115.0, 100.0 + h)] {
// Within the Bézier circles' own error (0.0273% of the radius) of the ideal answer.
assert!(centers.iter().any(|(c, r)| (*c - want).hypot() < 0.02 && (r - 20.0).abs() < 1e-9), "{centers:?}");
}
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(count(&s), 2);
}
#[test]
fn three_circles_and_one_picked() {
let mut s = session();
let ids = [circle(&mut s, 100.0, 100.0, 10.0), circle(&mut s, 180.0, 100.0, 10.0), circle(&mut s, 100.0, 160.0, 10.0)];
s.execute("select.set", &json!({"ids": ids})).unwrap();
// The selection: all eight, smallest first; the first is the one outside all three, about the
// circumcenter (140, 130), 50 from each center.
let r = s.execute(COMMAND, &json!({"circle": 1})).unwrap();
assert_eq!(r["found"], 8);
let one = r["ids"].as_array().unwrap();
assert_eq!(one.len(), 1);
let (c, radius) = drawn(&s, &one[0]);
assert!((c - Point::new(140.0, 130.0)).hypot() < 0.05 && (radius - 40.0).abs() < 0.05, "{c:?} {radius}");
s.execute("edit.undo", &json!({})).unwrap();
s.execute("select.set", &json!({"ids": ids})).unwrap();
assert_eq!(s.execute(COMMAND, &json!({})).unwrap()["ids"].as_array().unwrap().len(), 8);
assert!(refused(&mut s, json!({"ids": ids, "circle": 9})).contains("past the last circle found (8)"));
}
#[test]
fn compound_rotated_and_locked_shapes() {
let mut s = session();
// A ring as a compound path, and an ellipse turned 30° inside its hole.
let outer = circle(&mut s, 200.0, 150.0, 80.0);
let inner = circle(&mut s, 200.0, 150.0, 60.0);
s.execute("select.set", &json!({"ids": [outer, inner]})).unwrap();
let ring = s.execute("object.compoundPath.make", &json!({})).unwrap()["id"].as_u64().unwrap();
let oval = ellipse(&mut s, 180.0, 140.0, 40.0, 20.0, 30.0);
s.execute("select.set", &json!({"ids": [oval]})).unwrap();
s.execute("object.lock", &json!({})).unwrap();
s.execute("select.set", &json!({"ids": [ring]})).unwrap();
s.execute("object.hide", &json!({})).unwrap();
let r = s.execute(COMMAND, &json!({"ids": [ring, oval], "radius": 22})).unwrap();
let ids = r["ids"].as_array().unwrap();
// In the hole, 38 from the center, and 22 from the oval (reaching 42 along its long axis and
// 32 along its short one): two by each end of the oval.
assert_eq!(ids.len(), 4, "{r}");
for id in ids {
let (c, radius) = drawn(&s, id);
assert!(((c - Point::new(200.0, 150.0)).hypot() - (60.0 - radius)).abs() < 0.05, "{c:?}");
}
// The locked oval and the hidden ring were read and left as they were.
let d = &s.doc().unwrap().doc;
assert!(d.node(NodeId(oval)).unwrap().locked);
assert!(!d.node(NodeId(ring)).unwrap().visible);
}
#[test]
fn circles_go_into_an_isolated_group() {
let mut s = session();
let a = circle(&mut s, 100.0, 100.0, 10.0);
let b = circle(&mut s, 130.0, 100.0, 10.0);
s.execute("select.set", &json!({"ids": [a, b]})).unwrap();
let group = s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap();
s.execute("object.isolate", &json!({"id": group})).unwrap();
let r = s.execute(COMMAND, &json!({"ids": [a, b], "radius": 5})).unwrap();
let id = NodeId(r["ids"][0].as_u64().unwrap());
let d = &s.doc().unwrap().doc;
assert_eq!(d.parent_of(id), Some(NodeId(group)));
// On top of the group's art.
assert_eq!(d.node(NodeId(group)).unwrap().children().unwrap().last().map(|n| n.id), Some(id));
}
#[test]
fn circles_join_an_isolated_compound_path() {
let mut s = session();
let a = circle(&mut s, 100.0, 100.0, 10.0);
let b = circle(&mut s, 130.0, 100.0, 10.0);
s.execute("select.set", &json!({"ids": [a, b]})).unwrap();
let compound = s.execute("object.compoundPath.make", &json!({})).unwrap()["id"].as_u64().unwrap();
s.execute("object.isolate", &json!({"id": compound})).unwrap();
let members: Vec<u64> = s.doc().unwrap().doc.node(NodeId(compound)).unwrap().children().unwrap().iter().map(|c| c.id.0).collect();
let r = s.execute(COMMAND, &json!({"ids": members, "radius": 5})).unwrap();
let id = NodeId(r["ids"][0].as_u64().unwrap());
assert_eq!(s.doc().unwrap().doc.parent_of(id), Some(NodeId(compound)));
// A compound path and one of its own members are taken as the compound path alone: one shape.
let e = refused(&mut s, json!({"ids": [compound, members[0]], "radius": 5}));
assert!(e.contains("two or three"), "{e}");
// A repeated member is refused even though the compound path holds it.
let other = circle(&mut s, 300.0, 100.0, 10.0);
let e = refused(&mut s, json!({"ids": [compound, members[0], members[0], other], "radius": 5}));
assert!(e.contains("twice"), "{e}");
}
#[test]
fn errors_leave_the_document_unchanged() {
let mut s = session();
let a = circle(&mut s, 50.0, 50.0, 10.0);
let b = circle(&mut s, 250.0, 50.0, 10.0);
let c = circle(&mut s, 150.0, 200.0, 10.0);
assert!(refused(&mut s, json!({"ids": [a, b], "radius": 5})).contains("no circle touches"));
assert!(refused(&mut s, json!({"ids": [a, b]})).contains("need a `radius`"));
assert!(refused(&mut s, json!({"ids": [a, b, c], "radius": 5})).contains("leave `radius` out"));
assert!(refused(&mut s, json!({"ids": [a, b], "radius": 0})).contains("0.01"));
assert!(refused(&mut s, json!({"ids": [a, b], "radius": "5 mm"})).contains("must be a number"));
assert!(refused(&mut s, json!({"ids": [a], "radius": 5})).contains("two or three"));
assert!(refused(&mut s, json!({"ids": [a, a], "radius": 5})).contains("twice"));
let e = refused(&mut s, json!({"ids": [a, a as f64], "radius": 5}));
assert!(e.contains("not a non-negative integer"), "{e}");
// Two lone anchors at one place.
let dot = |s: &mut Session| s.execute("path.create", &json!({"anchors": [{"x": 5, "y": 5}]})).unwrap()["id"].as_u64().unwrap();
let (p, q) = (dot(&mut s), dot(&mut s));
assert!(refused(&mut s, json!({"ids": [p, q], "radius": 5})).contains("too small to measure"));
assert!(refused(&mut s, json!({"ids": [a, b], "radius": 200, "circle": 65})).contains("from 0 to 64"));
assert!(refused(&mut s, json!({"ids": [a, b], "radius": 200, "circle": -1})).contains("whole number"));
let t = s.execute("text.create", &json!({"x": 10, "y": 280, "text": "Hi"})).unwrap()["id"].as_u64().unwrap();
assert!(refused(&mut s, json!({"ids": [a, t], "radius": 5})).contains("not a path"));
let anchors: Vec<Value> = (0..2002).map(|i| json!({"x": i as f64 * 0.1, "y": 250.0 + (i % 2) as f64})).collect();
let zigzag = s.execute("path.create", &json!({"anchors": anchors})).unwrap()["id"].as_u64().unwrap();
assert!(refused(&mut s, json!({"ids": [a, zigzag], "radius": 5})).contains("at most 2000 segments"));
// Concentric circles touched all the way round.
let inner = circle(&mut s, 50.0, 50.0, 40.0);
assert!(refused(&mut s, json!({"ids": [a, inner], "radius": 15})).contains("whole curve"));
}
@@ -60,6 +60,7 @@ pub(super) const ALLOWED: &[&str] = &[
"addon.pathtools.shape.set",
"addon.pathtools.slideAnchor",
"addon.pathtools.smooth",
"addon.pathtools.tangentCircle",
"addon.pathtools.trim",
"addon.pen.append",
"addon.pen.close",
+7
View File
@@ -963,6 +963,13 @@ fn structured_junk() {
("addon.pathtools.trim", json!({"points": [[0, 0], [1e7, 1e7], [-1e7, 5], [0, 0]]})),
("addon.pathtools.trim", json!({"points": [[0, 0], [1, "y"], null]})),
("addon.pathtools.trim", json!({"at": [50, 50], "tolerance": 100})),
// Path Precision Tools: Tangent Circle.
("addon.pathtools.tangentCircle", json!({"ids": [2, 3], "radius": 1e6, "circle": u64::MAX})),
("addon.pathtools.tangentCircle", json!({"ids": [2, 3, 4], "radius": f64::MIN_POSITIVE, "circle": -1})),
("addon.pathtools.tangentCircle", json!({"ids": [2, 2], "radius": "1 mm"})),
("addon.pathtools.tangentCircle", json!({"ids": [2, 3], "radius": 0.01, "circle": 64})),
("addon.pathtools.tangentCircle", json!({"ids": [2, 3, 4]})),
("addon.pathtools.tangentCircle", json!({"ids": "x", "radius": f64::NAN, "circle": 1.5})),
// Arrange Tools add-on.
("addon.arrange.grid", json!({"columns": u64::MAX, "gapX": 1e6, "gapY": -1e6, "centerOnArtboard": true})),
("addon.arrange.grid", json!({"layout": "row", "gapX": f64::MAX, "columns": -1})),
+4 -1
View File
@@ -4,7 +4,8 @@
//! tool shows over a path, open paths lengthened or shortened at an end ([`extend`]), the places
//! where paths cross ([`crossings`]), the stretches between them ([`spans`]), anchors slid along
//! their path ([`slide`]), touching edges merged ([`shared_edge`]), paths divided into dashes
//! ([`divide_dashes`]) and the Parametric Shape Tool's shapes ([`shapes`]).
//! ([`divide_dashes`]), the Parametric Shape Tool's shapes ([`shapes`]) and the circles that touch
//! two or three shapes ([`tangent_circles`]).
mod crossings;
mod dashes;
@@ -12,6 +13,7 @@ mod extend;
pub mod shapes;
mod shared_edge;
mod slide;
mod tangent_circle;
#[cfg(test)]
mod tests;
mod trim;
@@ -28,6 +30,7 @@ pub use shared_edge::{
COINCIDENCE, EndSide, Follow, MAX_COINCIDENCE, MergePlan, MergePreview, Stretch, apply_merge, ends_at, merge_preview, stretches_at,
};
pub use slide::{MAX_SLIDE, slide_anchor, slide_stops, slide_t_at};
pub use tangent_circle::{Circle, MAX_TANGENT_CIRCLE_SEGMENTS, MAX_TANGENT_CIRCLES, TangentCircleError, tangent_circle_segments, tangent_circles};
pub use trim::{Span, slice, span_at, spans, without_spans};
use crate::fit::{end_tangent, start_tangent};
@@ -0,0 +1,744 @@
//! Tangent Circle: the circles that touch two shapes and have a given radius, or that touch three
//! shapes. A circle touches a shape when it meets the shape's outline without crossing it: the
//! whole outline lies outside the circle (its nearest point is on the circle) or inside it (its
//! farthest point is on the circle). At a smooth point of the outline the circle is tangent there;
//! at a corner or an open end it passes through that point.
//!
//! When every shape is a four-segment Bézier circle the answer is closed-form (the problem of
//! Apollonius for three), then moved onto the drawn outlines.
//! Otherwise the centers are isolated on a grid that is split where a root can be: the distance
//! from a point to an outline changes by at most the distance the point moves, so a cell whose
//! center is too far from every condition holds no center and is dropped. The cells left are
//! refined with Newton's method on the exact curves.
use kurbo::{CubicBez, ParamCurve, Point, Vec2};
use vectorcraft_geom::PathData;
#[cfg(test)]
mod tests;
/// Most segments the shapes may hold together, counted by [`tangent_circle_segments`].
pub const MAX_TANGENT_CIRCLE_SEGMENTS: usize = 2_000;
/// The segments of `p`'s subpaths, a lone anchor counting as one.
pub fn tangent_circle_segments(p: &PathData) -> usize {
p.subpaths.iter().map(|sp| sp.segment_count().max(usize::from(!sp.anchors.is_empty()))).sum()
}
/// Most circles one call returns.
pub const MAX_TANGENT_CIRCLES: usize = 64;
/// With three shapes, the largest radius looked for, as a multiple of the diagonal of the box
/// around the shapes' anchors and handles.
const MAX_RADIUS_FACTOR: f64 = 64.0;
/// A circle by its center and radius.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Circle {
pub center: Point,
pub radius: f64,
}
/// Why [`tangent_circles`] gives no answer.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TangentCircleError {
/// Not two shapes with a radius above 0, nor three shapes without one; or a shape with no
/// outline, or values that are not finite.
BadInput,
/// More than [`MAX_TANGENT_CIRCLE_SEGMENTS`] segments, or a search that would take too long.
TooComplex,
/// More than [`MAX_TANGENT_CIRCLES`] circles: the shapes may be touched along a whole curve
/// (two concentric circles, for example).
TooMany,
}
/// The circles that touch every one of `shapes` (document coordinates): two shapes and `radius`,
/// or three shapes and no radius. They are listed by radius, then top to bottom, then left to
/// right; an empty list when no circle touches them all.
pub fn tangent_circles(shapes: &[&PathData], radius: Option<f64>) -> Result<Vec<Circle>, TangentCircleError> {
use TangentCircleError::*;
match (shapes.len(), radius) {
(2, Some(r)) if r.is_finite() && r > 0.0 => {}
(3, None) => {}
_ => return Err(BadInput),
}
if shapes.iter().map(|p| tangent_circle_segments(p)).sum::<usize>() > MAX_TANGENT_CIRCLE_SEGMENTS {
return Err(TooComplex);
}
let mut bounds = None::<kurbo::Rect>;
// The smallest shape's diagonal.
let mut smallest = f64::INFINITY;
for p in shapes {
if p.subpaths.iter().all(|sp| sp.anchors.is_empty()) {
return Err(BadInput);
}
let b = p.control_bounds().ok_or(BadInput)?;
smallest = smallest.min(b.width().hypot(b.height()));
bounds = Some(bounds.map_or(b, |a| a.union(b)));
}
let bounds = bounds.ok_or(BadInput)?;
let finite = [bounds.x0, bounds.y0, bounds.x1, bounds.y1].iter().all(|v| v.is_finite());
// The work is done about the bounds' center and in units of their diagonal.
let origin = bounds.center();
let scale = bounds.width().hypot(bounds.height());
if !finite || !scale.is_finite() || scale <= 0.0 {
return Err(BadInput);
}
let local = |p: Point| Point::new((p.x - origin.x) / scale, (p.y - origin.y) / scale);
let r = radius.map(|r| r / scale);
if r.is_some_and(|r| !r.is_finite()) {
// Shapes so small that the radius is past any number in their units.
return Err(BadInput);
}
let circles: Option<Vec<Circle>> =
shapes.iter().map(|p| as_circle(p).map(|c| Circle { center: local(c.center), radius: c.radius / scale })).collect();
// Two of three shapes the same circle up to rounding, or two copies of the same path: every
// circle touching it and the third touches all three.
let same = |a: &Circle, b: &Circle| (a.center - b.center).hypot() <= COPY && (a.radius - b.radius).abs() <= COPY;
if shapes.len() == 3
&& (0..3).any(|i| match &circles {
Some(c) => same(&c[i], &c[(i + 1) % 3]),
None => shapes[i] == shapes[(i + 1) % 3],
})
{
return Err(TooMany);
}
let outlines: Vec<Outline> = shapes.iter().map(|p| Outline::new(p, &local)).collect();
let found = match circles {
Some(c) => {
let exact = match r {
Some(r) => two_circles(c[0], c[1], r)?,
None => apollonius(c[0], c[1], c[2]).into_iter().filter(|c| c.radius <= MAX_RADIUS_FACTOR).collect(),
};
// The paths are Bézier circles: each answer is polished on their outlines.
exact.into_iter().map(|found| on_outlines(&outlines, &c, r, found)).collect()
}
None => numeric(&outlines, r)?,
};
// Answers about a shape far smaller than the gaps between the shapes can be closer together than
// `SAME`: the tolerance shrinks with that shape.
let tolerance = SAME.min(smallest / scale * 1e-3).max(COPY);
let mut out = dedup(found, tolerance);
if out.len() > MAX_TANGENT_CIRCLES {
return Err(TooMany);
}
sort(&mut out, tolerance);
Ok(out
.into_iter()
.map(|c| Circle { center: Point::new(origin.x + c.center.x * scale, origin.y + c.center.y * scale), radius: c.radius * scale })
.filter(|c| c.center.x.is_finite() && c.center.y.is_finite() && c.radius.is_finite())
.collect())
}
/// `found`, an answer for the ideal circles `ideal`, moved by Newton's method to touch the
/// `outlines` of the paths themselves in the same way: each circle's outline lies outside the answer
/// (nearest point), or inside it when the answer holds that circle (farthest point). `found` as it
/// is when the method does not settle nearby: where the answer is within the Bézier circles' own
/// error (0.0273% of the radius) of touching them in two places or none, it follows the true
/// circles.
fn on_outlines(outlines: &[Outline], ideal: &[Circle], r: Option<f64>, found: Circle) -> Circle {
let mut combo = 0;
for (i, c) in ideal.iter().enumerate() {
let d = (found.center - c.center).hypot();
let holds = (d + c.radius - found.radius).abs();
if holds < (d - c.radius - found.radius).abs() && holds < (c.radius - d - found.radius).abs() {
combo |= 1 << i;
}
}
newton(outlines, r, combo, found.center, 1e-4, &mut 0.0)
.filter(|c| (c.center - found.center).hypot() <= 1e-3 && (c.radius - found.radius).abs() <= 1e-3)
.unwrap_or(found)
}
/// `path` as a circle when it is a four-segment Bézier circle: one closed subpath of four curved
/// segments with a square bounding box, lying within 0.03% of the radius of a circle (its largest
/// error is 0.0273%).
fn as_circle(path: &PathData) -> Option<Circle> {
let [sp] = path.subpaths.as_slice() else { return None };
if !sp.closed || sp.segment_count() != 4 || (0..4).any(|i| sp.segment_is_line(i)) {
return None;
}
let b = path.bounds()?;
let radius = (b.width() + b.height()) / 4.0;
if !radius.is_finite() || radius <= 0.0 || (b.width() - b.height()).abs() > 1e-6 * radius {
return None;
}
let center = b.center();
let near = |p: Point| ((p - center).hypot() - radius).abs() <= 3e-4 * radius;
let round = (0..sp.segment_count()).all(|i| {
let seg = sp.segment(i);
(0..=16).all(|k| near(seg.eval(k as f64 / 16.0)))
});
round.then_some(Circle { center, radius })
}
/// Below this (in units of the bounds' diagonal) two values are the same.
const EPS: f64 = 1e-9;
/// The circles of radius `r` touching circles `a` and `b`: their centers are `a.radius + r` from
/// `a`'s center (outside it) or `|a.radius - r|` (inside it, or holding it), and the same for `b`.
/// A distance of 0 (`r` equal to that circle's radius) puts the center on that circle's center.
/// Concentric circles at a distance both allow touch along a whole circle: [`TangentCircleError::TooMany`].
fn two_circles(a: Circle, b: Circle, r: f64) -> Result<Vec<Circle>, TangentCircleError> {
let mut out = vec![];
let apart = (a.center - b.center).hypot();
let only = |ok: bool, p: Point| if ok { vec![p] } else { vec![] };
for da in [a.radius + r, (a.radius - r).abs()] {
for db in [b.radius + r, (b.radius - r).abs()] {
let centers = match (da <= EPS, db <= EPS) {
(true, true) => only(apart <= EPS, a.center),
(true, false) => only((apart - db).abs() <= EPS, a.center),
(false, true) => only((apart - da).abs() <= EPS, b.center),
(false, false) if apart <= EPS && (da - db).abs() <= EPS => return Err(TangentCircleError::TooMany),
(false, false) => circle_crossings(a.center, da, b.center, db),
};
out.extend(centers.into_iter().map(|center| Circle { center, radius: r }));
}
}
Ok(out)
}
/// Where the circle about `c1` of radius `r1` meets the one about `c2` of radius `r2`: none, one
/// where they touch, or two.
fn circle_crossings(c1: Point, r1: f64, c2: Point, r2: f64) -> Vec<Point> {
let v = c2 - c1;
let d = v.hypot();
if d <= EPS || d > r1 + r2 + EPS || d < (r1 - r2).abs() - EPS {
return vec![];
}
let along = (d * d + r1 * r1 - r2 * r2) / (2.0 * d);
let h2 = r1 * r1 - along * along;
let u = v / d;
let foot = c1 + u * along;
// Only rounding takes a touching pair below 0; two crossings closer than `SAME` become one later.
if h2 <= 0.0 {
return vec![foot];
}
let n = Vec2::new(-u.y, u.x) * h2.sqrt();
vec![foot + n, foot - n]
}
/// The circles touching circles `c` (the problem of Apollonius): for each choice of outside (+)
/// or inside (−) per circle, `|center − cᵢ|² = (r ± rᵢ)²`. Subtracting the first equation from the
/// others leaves two linear equations in x, y and r; two of the three unknowns follow from the
/// third, and the first equation gives a quadratic in it.
fn apollonius(a: Circle, b: Circle, c: Circle) -> Vec<Circle> {
let cs = [a, b, c];
let mut out = vec![];
for signs in 0..8u8 {
let s = [0, 1, 2].map(|i| if signs & (1 << i) == 0 { 1.0 } else { -1.0 });
let (x1, y1, r1) = (cs[0].center.x, cs[0].center.y, cs[0].radius * s[0]);
let row = |i: usize| {
let (x, y, ri) = (cs[i].center.x, cs[i].center.y, cs[i].radius * s[i]);
([2.0 * (x - x1), 2.0 * (y - y1), 2.0 * (ri - r1)], (x * x + y * y - ri * ri) - (x1 * x1 + y1 * y1 - r1 * r1))
};
let (m1, b1) = row(1);
let (m2, b2) = row(2);
// Keep the third unknown free whose 2×2 minor is largest.
let minor = |i: usize, j: usize| m1[i] * m2[j] - m1[j] * m2[i];
let Some((free, (i, j))) =
[(2, (0, 1)), (1, (0, 2)), (0, (1, 2))].into_iter().max_by(|p, q| minor(p.1.0, p.1.1).abs().total_cmp(&minor(q.1.0, q.1.1).abs()))
else {
continue;
};
let det = minor(i, j);
if det.abs() <= EPS {
continue;
}
// vᵢ = αᵢ + βᵢ t, vⱼ = αⱼ + βⱼ t, with t the free unknown.
let alpha_i = (b1 * m2[j] - b2 * m1[j]) / det;
let beta_i = (-m1[free] * m2[j] + m2[free] * m1[j]) / det;
let alpha_j = (m1[i] * b2 - m2[i] * b1) / det;
let beta_j = (-m1[i] * m2[free] + m2[i] * m1[free]) / det;
let unknowns = |t: f64| {
let mut v = [0.0; 3];
v[free] = t;
v[i] = alpha_i + beta_i * t;
v[j] = alpha_j + beta_j * t;
v
};
// (x − x1)² + (y − y1)² − (r + r1)² as a quadratic in t.
let [v0, v1] = [unknowns(0.0), unknowns(1.0)];
let lin = [v0[0] - x1, v0[1] - y1, v0[2] + r1];
let dir = [v1[0] - v0[0], v1[1] - v0[1], v1[2] - v0[2]];
let qa = dir[0] * dir[0] + dir[1] * dir[1] - dir[2] * dir[2];
let qb = 2.0 * (lin[0] * dir[0] + lin[1] * dir[1] - lin[2] * dir[2]);
let qc = lin[0] * lin[0] + lin[1] * lin[1] - lin[2] * lin[2];
for t in quadratic_roots(qa, qb, qc) {
let [x, y, r] = unknowns(t);
if r > EPS && [x, y, r].iter().all(|v| v.is_finite()) {
out.push(Circle { center: Point::new(x, y), radius: r });
}
}
}
out
}
/// The real roots of `a t² + b t + c`, a double root once; none when every coefficient is 0.
fn quadratic_roots(a: f64, b: f64, c: f64) -> Vec<f64> {
let size = a.abs().max(b.abs()).max(c.abs());
if size == 0.0 {
return vec![];
}
let (a, b, c) = (a / size, b / size, c / size);
if a.abs() <= EPS {
return if b.abs() <= EPS { vec![] } else { vec![-c / b] };
}
let disc = b * b - 4.0 * a * c;
if disc < -1e-12 {
return vec![];
}
if disc <= 1e-12 {
return vec![-b / (2.0 * a)];
}
// The root that adds magnitudes first; with b = 0 either sign does.
let q = if b < 0.0 { -0.5 * (b - disc.sqrt()) } else { -0.5 * (b + disc.sqrt()) };
vec![q / a, c / q]
}
/// Circles closer than this (in units of the bounds' diagonal) are one.
const SAME: f64 = 1e-6;
/// Given circles closer than this (in units of the bounds' diagonal) are copies of one circle.
const COPY: f64 = 1e-12;
/// Sorts `circles` (local units) by radius, then top to bottom, then left to right. Values within
/// `tolerance` of each other (the radii of mirror images, for example) sort as equal.
fn sort(circles: &mut [Circle], tolerance: f64) {
let key = |v: f64| (v / tolerance).round();
circles.sort_by(|a, b| {
key(a.radius).total_cmp(&key(b.radius)).then(key(a.center.y).total_cmp(&key(b.center.y))).then(key(a.center.x).total_cmp(&key(b.center.x)))
});
}
/// `found` with each circle within `tolerance` of an earlier one left out.
fn dedup(found: Vec<Circle>, tolerance: f64) -> Vec<Circle> {
let mut out: Vec<Circle> = vec![];
for c in found {
if !out.iter().any(|o| (o.center - c.center).hypot() <= tolerance && (o.radius - c.radius).abs() <= tolerance) {
out.push(c);
}
}
out
}
/// A shape's outline, in local units: its segments, and chords that lie within `slack` of them.
struct Outline {
segments: Vec<CubicBez>,
/// Each segment's neighbors along its subpath (before, after), where it has them.
beside: Vec<(Option<usize>, Option<usize>)>,
/// (start, end, segment, t at start, t at end).
chords: Vec<(Point, Point, usize, f64, f64)>,
/// The farthest the chords are from the segments.
slack: f64,
}
/// How far chords may stray from their segment, at most (local units); each segment is cut into
/// at most [`MAX_CHORDS`] chords, so a tightly bent one may stray more.
const CHORD_SLACK: f64 = 1e-3;
const MAX_CHORDS: usize = 64;
impl Outline {
fn new(path: &PathData, local: &dyn Fn(Point) -> Point) -> Self {
let mut o = Outline { segments: vec![], beside: vec![], chords: vec![], slack: 0.0 };
for sp in &path.subpaths {
let n = sp.segment_count();
if n == 0 {
if let Some(a) = sp.anchors.first() {
// A lone anchor: a segment that stays on its point.
let p = local(a.p);
o.segments.push(CubicBez::new(p, p, p, p));
o.beside.push((None, None));
o.chords.push((p, p, o.segments.len() - 1, 0.0, 1.0));
}
continue;
}
let first = o.segments.len();
for i in 0..n {
let s = sp.segment(i);
let seg = CubicBez::new(local(s.p0), local(s.p1), local(s.p2), local(s.p3));
let k = o.segments.len();
let before = if i > 0 { Some(k - 1) } else { sp.closed.then_some(first + n - 1) };
let after = if i + 1 < n { Some(k + 1) } else { sp.closed.then_some(first) };
// |B''| is at most 6 × the larger second difference; a chord over a parameter step
// h strays at most |B''| h² / 8.
let bend = 6.0
* (seg.p0.to_vec2() - 2.0 * seg.p1.to_vec2() + seg.p2.to_vec2())
.hypot()
.max((seg.p1.to_vec2() - 2.0 * seg.p2.to_vec2() + seg.p3.to_vec2()).hypot());
let pieces = ((bend / (8.0 * CHORD_SLACK)).sqrt().ceil() as usize).clamp(1, MAX_CHORDS);
o.slack = o.slack.max(bend / (8.0 * (pieces * pieces) as f64));
let mut prev = seg.p0;
for j in 1..=pieces {
let t = j as f64 / pieces as f64;
let p = if j == pieces { seg.p3 } else { seg.eval(t) };
o.chords.push((prev, p, k, (j - 1) as f64 / pieces as f64, t));
prev = p;
}
o.segments.push(seg);
o.beside.push((before, after));
}
}
o
}
/// The chords' nearest and farthest distance from `q`.
fn reach(&self, q: Point) -> Reach {
let mut r = Reach { near: f64::INFINITY, far: -1.0 };
for &(a, b, ..) in &self.chords {
r.near = r.near.min(chord_near(q, a, b).0);
r.far = r.far.max((q - a).hypot()).max((q - b).hypot());
}
r
}
/// The point of the curves nearest `q` (or farthest, `far`) and its distance. Every segment
/// whose chords come within twice the slack of the chords' best answer may hold the true one,
/// so each is polished from its own best chord point, and the best result is kept.
fn extreme(&self, q: Point, far: bool) -> (Point, f64) {
let better = |a: f64, b: f64| if far { a > b } else { a < b };
let worst = if far { -1.0 } else { f64::INFINITY };
// Each segment's best chord distance and the parameter where it is reached.
let mut per = vec![(worst, 0.0); self.segments.len()];
for &(a, b, seg, t0, t1) in &self.chords {
let (d, u) = if far {
let (da, db) = ((q - a).hypot(), (q - b).hypot());
if db > da { (db, 1.0) } else { (da, 0.0) }
} else {
chord_near(q, a, b)
};
if let Some(slot) = per.get_mut(seg)
&& better(d, slot.0)
{
*slot = (d, t0 + (t1 - t0) * u);
}
}
let best = per.iter().fold(worst, |m, p| if better(p.0, m) { p.0 } else { m });
let window = 2.0 * self.slack + 1e-12;
let mut out: Option<(Point, f64)> = None;
for (seg, &(d, t)) in per.iter().enumerate() {
if (d - best).abs() > window {
continue;
}
let mut tries = vec![(seg, t)];
let (before, after) = self.beside.get(seg).copied().unwrap_or((None, None));
if t <= 0.0
&& let Some(b) = before
{
tries.push((b, 1.0));
}
if t >= 1.0
&& let Some(a) = after
{
tries.push((a, 0.0));
}
for (s, t) in tries {
let Some(curve) = self.segments.get(s) else { continue };
let (p, d) = polish(*curve, q, t, far);
if out.is_none_or(|(_, od)| better(d, od)) {
out = Some((p, d));
}
}
}
out.unwrap_or((q, 0.0))
}
}
/// The distance from `q` to the chord from `a` to `b`, and the parameter along it where it is reached.
fn chord_near(q: Point, a: Point, b: Point) -> (f64, f64) {
let ab = b - a;
let len2 = ab.hypot2();
let u = if len2 > 0.0 { ((q - a).dot(ab) / len2).clamp(0.0, 1.0) } else { 0.0 };
((q - (a + ab * u)).hypot(), u)
}
struct Reach {
near: f64,
far: f64,
}
/// The nearest (or farthest) point to `q` on `seg` near parameter `t`: Newton's method on
/// (B(t) − q)·B′(t) = 0, kept in 0..1, keeping only steps that improve the distance.
fn polish(seg: CubicBez, q: Point, t: f64, far: bool) -> (Point, f64) {
let dist = |t: f64| (seg.eval(t) - q).hypot();
let better = |a: f64, b: f64| if far { a > b } else { a < b };
let (mut t, mut d) = (t, dist(t));
let [p0, p1, p2, p3] = [seg.p0, seg.p1, seg.p2, seg.p3].map(Point::to_vec2);
for _ in 0..16 {
let mt = 1.0 - t;
let d1 = 3.0 * (mt * mt * (p1 - p0) + 2.0 * mt * t * (p2 - p1) + t * t * (p3 - p2));
let d2 = 6.0 * (mt * (p2 - 2.0 * p1 + p0) + t * (p3 - 2.0 * p2 + p1));
let w = seg.eval(t) - q;
let f = w.dot(d1);
let df = d1.hypot2() + w.dot(d2);
if df == 0.0 || !df.is_finite() {
break;
}
let next = (t - f / df).clamp(0.0, 1.0);
let nd = dist(next);
if !better(nd, d) && nd != d {
break;
}
let moved = (next - t).abs();
(t, d) = (next, nd);
if moved < 1e-15 {
break;
}
}
(seg.eval(t), d)
}
/// Most grid cells the search looks at, over all levels.
const MAX_CELLS: usize = 400_000;
/// Most cells × chords the search may measure.
const MAX_WORK: f64 = 1.5e8;
/// Most cells Newton's method starts from.
const MAX_TRIES: usize = 4_000;
/// Most chords Newton's method may measure, over all its starts.
const MAX_NEWTON_WORK: f64 = 1.5e8;
/// Which of a shape's two distances a condition uses: the nearest point (the outline outside the
/// circle) or the farthest (the outline inside it).
fn far_of(combo: usize, shape: usize) -> bool {
combo & (1 << shape) != 0
}
/// The circles touching `outlines` (local units): two outlines and radius `r`, or three and none.
fn numeric(outlines: &[Outline], r: Option<f64>) -> Result<Vec<Circle>, TangentCircleError> {
let n = outlines.len();
let combos = 1usize << n;
let slack = outlines.iter().map(|o| o.slack).fold(0.0, f64::max);
let chords: usize = outlines.iter().map(|o| o.chords.len()).sum();
let reach = match r {
Some(r) => r,
None => MAX_RADIUS_FACTOR,
};
// A center is within the radius of a point of every outline, so within its bounds grown by it.
let mut area: Option<kurbo::Rect> = None;
let mut whole: Option<kurbo::Rect> = None;
for o in outlines {
let b = o.chords.iter().fold(None::<kurbo::Rect>, |b, &(p, q, ..)| {
let c = kurbo::Rect::from_points(p, q);
Some(b.map_or(c, |b| b.union(c)))
});
let Some(b) = b else { return Err(TangentCircleError::BadInput) };
whole = Some(whole.map_or(b, |w| w.union(b)));
let b = b.inflate(reach + slack, reach + slack);
area = Some(area.map_or(b, |a| a.intersect(b)));
}
let whole = whole.ok_or(TangentCircleError::BadInput)?.inflate(slack, slack);
let span = whole.width().hypot(whole.height());
let Some(area) = area.filter(|a| a.width() >= 0.0 && a.height() >= 0.0) else { return Ok(vec![]) };
let side = area.width().max(area.height()).max(1e-12);
let leaf = 2.0 * slack.max(1e-4);
let mut half = side / 2.0;
// The cells alive at the current level: (center, combos still possible).
let all = (1u32 << combos) - 1;
let mut cells = vec![(area.center(), all)];
let mut looked = 0usize;
let test = |c: Point, half: f64, alive: u32| -> u32 {
let corner = half * std::f64::consts::SQRT_2;
let e = corner + slack;
// Seen from far off, the directions to any two points of the outlines differ little, and
// so do the gradients of their distances: the difference of two distances changes by at
// most 2 × span / (distance to the outlines) per unit moved, rather than 2.
let off = {
let dx = (whole.x0 - c.x).max(c.x - whole.x1).max(0.0);
let dy = (whole.y0 - c.y).max(c.y - whole.y1).max(0.0);
dx.hypot(dy) - corner
};
let steep = if off > 0.0 { (2.0 * span / off).min(2.0) } else { 2.0 };
let apart = steep * corner + 2.0 * slack;
let reach: Vec<Reach> = outlines.iter().map(|o| o.reach(c)).collect();
let d = |i: usize, combo: usize| if far_of(combo, i) { reach[i].far } else { reach[i].near };
let mut keep = 0;
for combo in 0..combos {
if alive & (1 << combo) == 0 {
continue;
}
let ok = match r {
Some(r) => (0..n).all(|i| (d(i, combo) - r).abs() <= e),
None => {
let (d0, d1, d2) = (d(0, combo), d(1, combo), d(2, combo));
(d0 - d1).abs() <= apart && (d0 - d2).abs() <= apart && (d1 - d2).abs() <= apart && d0 - e <= MAX_RADIUS_FACTOR
}
};
if ok {
keep |= 1 << combo;
}
}
keep
};
loop {
looked += cells.len();
if looked > MAX_CELLS || looked as f64 * chords as f64 > MAX_WORK {
return Err(TangentCircleError::TooComplex);
}
cells = cells.into_iter().filter_map(|(c, alive)| Some((c, test(c, half, alive))).filter(|x| x.1 != 0)).collect();
if half * std::f64::consts::SQRT_2 <= leaf || cells.is_empty() {
break;
}
let q = half / 2.0;
cells = cells
.into_iter()
.flat_map(|(c, alive)| [(-q, -q), (q, -q), (-q, q), (q, q)].map(|(dx, dy)| (Point::new(c.x + dx, c.y + dy), alive)))
.collect();
half = q;
}
// The leaf cells of each combination, in clusters of touching cells. Newton's method starts
// from up to [`SEEDS`] cells of each cluster, each the farthest from those before it. A cluster
// around one center (or two that nearly meet) gives one or two circles; three or more far apart
// mean the shapes are touched along a whole curve.
let step = 2.0 * half;
let mut out = vec![];
let mut tries = 0usize;
let mut work = 0.0;
let same = |a: &Circle, b: &Circle| (a.center - b.center).hypot() <= SAME && (a.radius - b.radius).abs() <= SAME;
let mut solve = |seed: Point, combo: usize| -> Result<Option<Circle>, TangentCircleError> {
tries += 1;
let c = newton(outlines, r, combo, seed, half, &mut work);
if tries > MAX_TRIES || work > MAX_NEWTON_WORK {
return Err(TangentCircleError::TooComplex);
}
Ok(c)
};
for combo in 0..combos {
let leaves: Vec<Point> = cells.iter().filter(|(_, a)| a & (1 << combo) != 0).map(|(c, _)| *c).collect();
let mut found: Vec<Circle> = vec![];
for cluster in clusters(&leaves, step) {
let mut seeds: Vec<Point> = vec![];
let mut here: Vec<Circle> = vec![];
while seeds.len() < SEEDS {
let next = cluster
.iter()
.copied()
.map(|c| (c, seeds.iter().map(|s| (*s - c).hypot()).fold(f64::INFINITY, f64::min)))
.max_by(|a, b| a.1.total_cmp(&b.1));
let Some((seed, gap)) = next else { break };
if !seeds.is_empty() && gap <= 2.0 * step {
break;
}
seeds.push(seed);
if let Some(c) = solve(seed, combo)?
&& !here.iter().any(|o| same(o, &c))
{
here.push(c);
}
}
if here.len() > 2 {
return Err(TangentCircleError::TooMany);
}
for c in here {
if !found.iter().any(|o| same(o, &c)) {
found.push(c);
}
}
if found.len() > MAX_TANGENT_CIRCLES {
return Err(TangentCircleError::TooMany);
}
}
out.extend(found);
}
Ok(out)
}
/// Seeds Newton's method starts from in one cluster of cells, at most.
const SEEDS: usize = 4;
/// `cells`, centers on a grid `step` apart, in groups of cells that touch (sides or corners).
fn clusters(cells: &[Point], step: f64) -> Vec<Vec<Point>> {
use std::collections::HashMap;
let Some(first) = cells.first() else { return vec![] };
let key = |p: &Point| (((p.x - first.x) / step).round() as i64, ((p.y - first.y) / step).round() as i64);
let mut at: HashMap<(i64, i64), usize> = cells.iter().enumerate().map(|(i, p)| (key(p), i)).collect();
let mut out = vec![];
for p in cells {
let Some(start) = at.remove(&key(p)) else { continue };
let mut group = vec![];
let mut stack = vec![start];
while let Some(i) = stack.pop() {
let Some(c) = cells.get(i) else { continue };
group.push(*c);
let (kx, ky) = key(c);
for dx in -1..=1 {
for dy in -1..=1 {
if let Some(j) = at.remove(&(kx + dx, ky + dy)) {
stack.push(j);
}
}
}
}
out.push(group);
}
out
}
/// Newton's method from `seed` on the conditions of `combo`: with `r`, distance(i) = r for both
/// outlines; without, the three distances equal (the radius). Adds the chords it measures to `work`.
fn newton(outlines: &[Outline], r: Option<f64>, combo: usize, seed: Point, step: f64, work: &mut f64) -> Option<Circle> {
let mut c = seed;
let n = outlines.len();
let cost: f64 = outlines.iter().map(|o| o.chords.len() as f64).sum();
let limit = (step * 8.0).max(1e-3);
// A radius the search sets itself (three shapes) is kept within its limit.
let fits = |radius: f64| radius > EPS && (r.is_some() || radius <= MAX_RADIUS_FACTOR);
for _ in 0..60 {
*work += cost;
let mut d = [0.0; 3];
let mut u = [Vec2::ZERO; 3];
for i in 0..n {
let (p, di) = outlines[i].extreme(c, far_of(combo, i));
if di <= EPS {
return None;
}
d[i] = di;
u[i] = (c - p) / di;
}
let (f, rows, radius) = match r {
Some(r) => ([d[0] - r, d[1] - r], [u[0], u[1]], r),
None => ([d[0] - d[1], d[0] - d[2]], [u[0] - u[1], u[0] - u[2]], d[0]),
};
if f[0].abs().max(f[1].abs()) <= 1e-12 {
return fits(radius).then_some(Circle { center: c, radius });
}
let det = rows[0].cross(rows[1]);
let mut delta = if det.abs() > 1e-9 {
// J Δ = −f, with J's rows the gradients.
Vec2::new(-(f[0] * rows[1].y - f[1] * rows[0].y) / det, -(rows[0].x * f[1] - rows[1].x * f[0]) / det)
} else {
// Rows (nearly) parallel: the least-squares step (JᵀJ + λI) Δ = −Jᵀf, which still
// closes the residual along the rows' direction.
let g = rows[0] * f[0] + rows[1] * f[1];
let lambda = 1e-12;
let (a, b, d) = (
rows[0].x * rows[0].x + rows[1].x * rows[1].x + lambda,
rows[0].x * rows[0].y + rows[1].x * rows[1].y,
rows[0].y * rows[0].y + rows[1].y * rows[1].y + lambda,
);
let m = a * d - b * b;
if !m.is_finite() || m == 0.0 {
break;
}
Vec2::new(-(d * g.x - b * g.y) / m, -(a * g.y - b * g.x) / m)
};
let len = delta.hypot();
if !len.is_finite() {
return None;
}
if len > limit {
delta *= limit / len;
}
c += delta;
if delta.hypot() <= 1e-15 {
break;
}
}
// Stopped short of 1e-12: keep it only when it is close (a double root converges slowly).
*work += cost;
let mut d = [0.0; 3];
for i in 0..n {
d[i] = outlines[i].extreme(c, far_of(combo, i)).1;
}
let (worst, radius) = match r {
Some(r) => ((d[0] - r).abs().max((d[1] - r).abs()), r),
None => ((d[0] - d[1]).abs().max((d[0] - d[2]).abs()), d[0]),
};
(worst <= 1e-8 && fits(radius)).then_some(Circle { center: c, radius })
}
@@ -0,0 +1,487 @@
use kurbo::{Affine, Point, Rect};
use vectorcraft_geom::{PathData, SubPath, shapes};
use super::*;
fn circle(x: f64, y: f64, r: f64) -> PathData {
shapes::ellipse(Rect::new(x - r, y - r, x + r, y + r))
}
fn square(x: f64, y: f64, half: f64) -> PathData {
shapes::rectangle(Rect::new(x - half, y - half, x + half, y + half))
}
/// Is `c` touching the ideal circle about `center` of radius `r`: `|c − center| = c.r ± r`?
fn touches_circle(c: &Circle, center: Point, r: f64, tol: f64) -> bool {
let d = (c.center - center).hypot();
(d - (c.radius + r)).abs() <= tol || (d - (c.radius - r).abs()).abs() <= tol
}
/// The nearest and farthest distance from `q` to points `pts`, a dense sampling of a curve.
fn reach(pts: &[Point], q: Point) -> (f64, f64) {
pts.iter().fold((f64::INFINITY, 0.0), |(lo, hi), p| {
let d = (*p - q).hypot();
(lo.min(d), hi.max(d))
})
}
/// Does circle `c` touch the densely sampled outline `pts`: its nearest or farthest point on the circle?
fn touches(c: &Circle, pts: &[Point], tol: f64) -> bool {
let (lo, hi) = reach(pts, c.center);
(lo - c.radius).abs() <= tol || (hi - c.radius).abs() <= tol
}
/// Points along every segment of `path`, `n` per segment.
fn samples(path: &PathData, n: usize) -> Vec<Point> {
path.subpaths
.iter()
.flat_map(|sp| (0..sp.segment_count()).flat_map(move |i| (0..n).map(move |k| sp.segment(i).eval(k as f64 / n as f64))))
.collect()
}
fn has(found: &[Circle], center: Point, r: f64, tol: f64) -> bool {
found.iter().any(|c| (c.center - center).hypot() <= tol && (c.radius - r).abs() <= tol)
}
#[test]
fn three_circles_give_the_eight_apollonius_circles() {
// Equal circles about the corners of a 3-4-5 triangle: the circumcenter (2, 1.5) at 2.5 from
// each center gives the circle outside all three (r = 2.5 − 1) and the one holding all three
// (r = 2.5 + 1).
let shapes = [circle(0.0, 0.0, 1.0), circle(4.0, 0.0, 1.0), circle(0.0, 3.0, 1.0)];
let found = tangent_circles(&[&shapes[0], &shapes[1], &shapes[2]], None).unwrap();
// The answers are polished on the Bézier circles, which stray up to 0.0273% of their radius
// from the ideal ones.
let tol = 2e-3;
assert_eq!(found.len(), 8, "{found:?}");
assert!(has(&found, Point::new(2.0, 1.5), 1.5, tol), "{found:?}");
assert!(has(&found, Point::new(2.0, 1.5), 3.5, tol), "{found:?}");
for c in &found {
for (center, r) in [(Point::new(0.0, 0.0), 1.0), (Point::new(4.0, 0.0), 1.0), (Point::new(0.0, 3.0), 1.0)] {
assert!(touches_circle(c, center, r, tol), "{c:?} and {center:?}");
}
}
// Listed by radius.
assert!(found.windows(2).all(|w| w[0].radius <= w[1].radius + 1e-9));
}
#[test]
fn answers_for_circles_touch_the_drawn_bezier_outlines() {
// Radius-100 Bézier circles stray up to 0.027 pt from the ideal circles; the answers touch the
// drawn outlines far closer than that.
let shapes = [circle(0.0, 0.0, 100.0), circle(500.0, 40.0, 100.0), circle(180.0, 420.0, 100.0)];
let found = tangent_circles(&[&shapes[0], &shapes[1], &shapes[2]], None).unwrap();
assert_eq!(found.len(), 8, "{found:?}");
let dense: Vec<Vec<Point>> = shapes.iter().map(|s| samples(s, 20_000)).collect();
for c in &found {
for pts in &dense {
assert!(touches(c, pts, 1e-3), "{c:?}");
}
}
let pair = tangent_circles(&[&shapes[0], &shapes[1]], Some(250.0)).unwrap();
assert!(!pair.is_empty());
for c in &pair {
assert!(touches(c, &dense[0], 1e-3) && touches(c, &dense[1], 1e-3), "{c:?}");
}
}
#[test]
fn three_circles_of_different_sizes() {
// A worked case: circles (0,0) r 1, (10,0) r 2, (5,8) r 3. Every answer satisfies the
// tangency equations, and there are eight since no circle holds or crosses another.
let defs = [(0.0, 0.0, 1.0), (10.0, 0.0, 2.0), (5.0, 8.0, 3.0)];
let shapes = defs.map(|(x, y, r)| circle(x, y, r));
let found = tangent_circles(&[&shapes[0], &shapes[1], &shapes[2]], None).unwrap();
assert_eq!(found.len(), 8, "{found:?}");
for c in &found {
for (x, y, r) in defs {
assert!(touches_circle(c, Point::new(x, y), r, 5e-3), "{c:?}");
}
}
}
#[test]
fn only_true_circles_take_the_closed_form() {
assert!(as_circle(&circle(0.0, 0.0, 100.0)).is_some());
// Turned, a Bézier circle keeps its square box.
assert!(as_circle(&circle(0.0, 0.0, 100.0).transformed(Affine::rotate(0.35))).is_some());
// A 200 × 200.1 ellipse is searched along its own outline.
assert!(as_circle(&shapes::ellipse(Rect::new(0.0, 0.0, 200.0, 200.1))).is_none());
assert!(as_circle(&square(0.0, 0.0, 10.0)).is_none());
// A 720-sided polygon lies within 0.03% of its circle, but is searched as drawn.
let polygon: Vec<Point> = (0..720)
.map(|k| Point::new(100.0 * (k as f64 / 360.0 * std::f64::consts::PI).cos(), 100.0 * (k as f64 / 360.0 * std::f64::consts::PI).sin()))
.collect();
assert!(as_circle(&PathData::single(SubPath::polyline(&polygon, true))).is_none());
}
#[test]
fn quadratics_without_a_linear_term_give_both_roots() {
let mut roots = quadratic_roots(1.0, 0.0, -1.0);
roots.sort_by(f64::total_cmp);
assert_eq!(roots, vec![-1.0, 1.0]);
let mut roots = quadratic_roots(2.0, -0.0, -8.0);
roots.sort_by(f64::total_cmp);
assert_eq!(roots, vec![-2.0, 2.0]);
}
#[test]
fn three_circles_keep_the_radius_limit() {
// Nearly in a row: some answers have radii near 1250, past 64 × the bounds' diagonal (about 770).
let shapes = [circle(0.0, 0.0, 1.0), circle(10.0, 0.0, 1.0), circle(5.0, 0.01, 1.0)];
let found = tangent_circles(&[&shapes[0], &shapes[1], &shapes[2]], None).unwrap();
let b = shapes.iter().map(|s| s.control_bounds().unwrap()).reduce(|a, b| a.union(b)).unwrap();
let limit = MAX_RADIUS_FACTOR * b.width().hypot(b.height());
assert!(!found.is_empty() && found.len() < 8, "{found:?}");
assert!(found.iter().all(|c| c.radius <= limit), "{found:?}");
}
#[test]
fn two_circles_and_a_radius() {
let a = circle(0.0, 0.0, 10.0);
let b = circle(30.0, 0.0, 10.0);
// Polished on the Bézier circles (see above).
let tol = 0.02;
// Radius 5: only the circle in the gap, touching both at once.
let found = tangent_circles(&[&a, &b], Some(5.0)).unwrap();
assert_eq!(found.len(), 1, "{found:?}");
assert!(has(&found, Point::new(15.0, 0.0), 5.0, tol));
// Radius 20: two outside both, two holding the first and two holding the second.
let found = tangent_circles(&[&a, &b], Some(20.0)).unwrap();
assert_eq!(found.len(), 6, "{found:?}");
let h = (30.0f64 * 30.0 - 15.0 * 15.0).sqrt();
assert!(has(&found, Point::new(15.0, -h), 20.0, tol) && has(&found, Point::new(15.0, h), 20.0, tol));
for c in &found {
assert!(touches_circle(c, Point::new(0.0, 0.0), 10.0, tol) && touches_circle(c, Point::new(30.0, 0.0), 10.0, tol));
}
// Top to bottom for one radius.
assert!(found.windows(2).all(|w| w[0].center.y <= w[1].center.y + 1e-9));
// Radius 10, the circles' own, 20 apart: each circle itself touches the other at one point; with
// the two outside both, four in all.
let c = circle(20.0, 0.0, 10.0);
let found = tangent_circles(&[&a, &c], Some(10.0)).unwrap();
assert_eq!(found.len(), 4, "{found:?}");
assert!(has(&found, Point::new(0.0, 0.0), 10.0, tol) && has(&found, Point::new(20.0, 0.0), 10.0, tol), "{found:?}");
for f in &found {
assert!(touches_circle(f, Point::new(0.0, 0.0), 10.0, tol) && touches_circle(f, Point::new(20.0, 0.0), 10.0, tol), "{f:?}");
}
// Too small to reach across: none.
let far = circle(100.0, 0.0, 10.0);
assert_eq!(tangent_circles(&[&a, &far], Some(5.0)).unwrap(), vec![]);
}
#[test]
fn the_numeric_search_agrees_with_the_closed_form() {
// The grid search and Newton on the Bézier outlines find what the closed form finds, within
// the Bézier circle's own error (0.03% of the radius).
let defs = [(0.0, 0.0, 10.0), (35.0, 5.0, 6.0), (12.0, 30.0, 4.0)];
let shapes = defs.map(|(x, y, r)| circle(x, y, r));
let refs = [&shapes[0], &shapes[1], &shapes[2]];
let closed = tangent_circles(&refs, None).unwrap();
let b = shapes.iter().map(|s| s.control_bounds().unwrap()).reduce(|a, b| a.union(b)).unwrap();
let (o, s) = (b.center(), b.width().hypot(b.height()));
let local = |p: Point| Point::new((p.x - o.x) / s, (p.y - o.y) / s);
let outlines: Vec<Outline> = refs.iter().map(|p| Outline::new(p, &local)).collect();
let numeric3 = dedup(numeric(&outlines, None).unwrap(), SAME);
assert_eq!(numeric3.len(), closed.len(), "{numeric3:?} vs {closed:?}");
for c in &closed {
let tol = 1e-3 * c.radius.max(10.0) / s;
assert!(has(&numeric3, local(c.center), c.radius / s, tol), "{c:?} missing from {numeric3:?}");
}
let closed2 = tangent_circles(&refs[..2], Some(12.0)).unwrap();
let numeric2 = dedup(numeric(&outlines[..2], Some(12.0 / s)).unwrap(), SAME);
assert_eq!(numeric2.len(), closed2.len(), "{numeric2:?} vs {closed2:?}");
for c in &closed2 {
assert!(has(&numeric2, local(c.center), c.radius / s, 1e-2 / s), "{c:?}");
}
}
/// An ellipse with semi-axes `a` and `b` about the origin, mapped by `m`: its Bézier path and its
/// exact points by angle.
fn mapped_ellipse(a: f64, b: f64, m: Affine) -> (PathData, impl Fn(f64) -> Point + Copy) {
let path = shapes::ellipse(Rect::new(-a, -b, a, b)).transformed(m);
let exact = move |th: f64| m * Point::new(a * th.cos(), b * th.sin());
(path, exact)
}
/// Independently of the code under test: the centers of the circles of radius `r` that touch the
/// exact convex curve `exact` (about `middle`) and the circle about `cc` of radius `rc`, in every
/// combination. A center lies on the curve's normal at `r` (outward or inward) where its distance to
/// `cc` is `rc + r` or `|rc − r|`; it counts when the curve's nearest or farthest point from it is
/// at `r`.
fn independent_centers(exact: impl Fn(f64) -> Point + Copy, middle: Point, cc: Point, rc: f64, r: f64) -> Vec<Point> {
let tau = std::f64::consts::TAU;
let dense: Vec<Point> = (0..100_000).map(|k| exact(k as f64 / 100_000.0 * tau)).collect();
let n = 200_000;
let mut out: Vec<Point> = vec![];
for side in [1.0, -1.0] {
let normal = move |th: f64| {
let p = exact(th);
let t = (exact(th + 1e-7) - exact(th - 1e-7)).normalize();
let mut nrm = Vec2::new(t.y, -t.x);
if nrm.dot(p - middle) < 0.0 {
nrm = -nrm;
}
p + nrm * (side * r)
};
for target in [rc + r, (rc - r).abs()] {
let g = |th: f64| (normal(th) - cc).hypot() - target;
for k in 0..n {
let (mut a, mut b) = (k as f64 / n as f64 * tau, (k + 1) as f64 / n as f64 * tau);
if g(a) * g(b) < 0.0 {
for _ in 0..60 {
let m = (a + b) / 2.0;
if g(a) * g(m) <= 0.0 { b = m } else { a = m }
}
let q = normal(a);
let (lo, hi) = reach(&dense, q);
let touching = (lo - r).abs() <= 1e-3 || (hi - r).abs() <= 1e-3;
if touching && !out.iter().any(|o| (*o - q).hypot() <= 1e-6) {
out.push(q);
}
}
}
}
}
out
}
/// `found` and `independent` are the same centers, within `tol`.
fn same_centers(found: &[Circle], independent: &[Point], tol: f64) {
assert_eq!(found.len(), independent.len(), "{found:?} vs {independent:?}");
for p in independent {
assert!(found.iter().any(|c| (c.center - *p).hypot() <= tol), "{p:?} missing from {found:?}");
}
}
#[test]
fn a_rotated_ellipse_and_a_circle_match_an_independent_solve() {
let (ellipse, exact) = mapped_ellipse(40.0, 20.0, Affine::rotate(30f64.to_radians()));
let (cc, rc, r) = (Point::new(70.0, 10.0), 12.0, 15.0);
let disc = circle(cc.x, cc.y, rc);
let found = tangent_circles(&[&ellipse, &disc], Some(r)).unwrap();
// Every circle touches the analytic ellipse and the circle (Bézier error: 0.03% of 40 pt).
let dense: Vec<Point> = (0..200_000).map(|k| exact(k as f64 / 200_000.0 * std::f64::consts::TAU)).collect();
for c in &found {
assert!(touches(c, &dense, 0.03), "{c:?}");
assert!(touches_circle(c, cc, rc, 0.01), "{c:?}");
}
// Every combination (outside both, holding the circle, holding the ellipse, inside it) solved
// independently: the same circles.
same_centers(&found, &independent_centers(exact, Point::ZERO, cc, rc, r), 0.05);
// A circle overlapping the ellipse, with a radius large enough to hold either.
let (cc, rc, r) = (Point::new(30.0, 5.0), 15.0, 50.0);
let found = tangent_circles(&[&ellipse, &circle(cc.x, cc.y, rc)], Some(r)).unwrap();
same_centers(&found, &independent_centers(exact, Point::ZERO, cc, rc, r), 0.05);
}
#[test]
fn a_rotated_and_skewed_ellipse_matches_an_independent_solve() {
let m = Affine::translate((-20.0, 15.0)) * Affine::skew(0.4, 0.0) * Affine::rotate(-0.7);
let (ellipse, exact) = mapped_ellipse(30.0, 12.0, m);
let (cc, rc, r) = (Point::new(15.0, 30.0), 8.0, 20.0);
let found = tangent_circles(&[&ellipse, &circle(cc.x, cc.y, rc)], Some(r)).unwrap();
let independent = independent_centers(exact, m * Point::ZERO, cc, rc, r);
assert!(!independent.is_empty());
same_centers(&found, &independent, 0.05);
}
#[test]
fn two_centers_close_together_are_both_found() {
// An ellipse 20 × 10 about (100, 0) and a circle of radius 10 about the origin: a circle of
// radius 35 fits the 70 pt gap between them on the axis. At 35.000003 two circles touch both
// from outside, about 0.011 pt above and below the axis.
let (ellipse, exact) = mapped_ellipse(20.0, 10.0, Affine::translate((100.0, 0.0)));
let (cc, rc, r) = (Point::ZERO, 10.0, 35.000003);
let found = tangent_circles(&[&ellipse, &circle(cc.x, cc.y, rc)], Some(r)).unwrap();
let independent = independent_centers(exact, Point::new(100.0, 0.0), cc, rc, r);
assert_eq!(independent.iter().filter(|p| (p.x - 45.0).abs() < 1.0).count(), 2, "{independent:?}");
same_centers(&found, &independent, 0.005);
// Two tiny circles a million points apart, and a radius just past half the gap: the two
// answers are about 22.36 pt above and below the axis, close together in units of the gap.
let (a, b) = (circle(0.0, 0.0, 0.01), circle(1e6, 0.0, 0.01));
let found = tangent_circles(&[&a, &b], Some(499999.9905)).unwrap();
assert_eq!(found.len(), 2, "{found:?}");
for c in &found {
assert!((c.center.x - 5e5).abs() < 0.1 && (c.center.y.abs() - 500f64.sqrt()).abs() < 0.1, "{found:?}");
}
}
#[test]
fn three_circles_give_eight_distinct_circles_in_a_steady_order() {
// Mirror-image pairs about y = 0 have radii equal up to rounding: the upper one comes first.
let defs = [(0.0, -5.0, 1.0), (0.0, 5.0, 1.0), (12.0, 0.0, 2.0)];
let shapes = defs.map(|(x, y, r)| circle(x, y, r));
let found = tangent_circles(&[&shapes[0], &shapes[1], &shapes[2]], None).unwrap();
for (i, a) in found.iter().enumerate() {
for b in &found[i + 1..] {
assert!((a.center - b.center).hypot() + (a.radius - b.radius).abs() > 1e-3, "{a:?} twice in {found:?}");
}
}
for w in found.windows(2) {
if (w[0].radius - w[1].radius).abs() <= 1e-9 {
assert!(w[0].center.y < w[1].center.y, "{found:?}");
}
}
// The selection mirrored left to right: the same circles mirrored, in the same order.
let flip = Affine::scale_non_uniform(-1.0, 1.0);
let mirrored = shapes.clone().map(|s| s.transformed(flip));
let again = tangent_circles(&[&mirrored[0], &mirrored[1], &mirrored[2]], None).unwrap();
assert_eq!(again.len(), found.len());
for (a, b) in found.iter().zip(&again) {
assert!((flip * a.center - b.center).hypot() <= 1e-6 && (a.radius - b.radius).abs() <= 1e-6, "{found:?} vs {again:?}");
}
}
#[test]
fn radii_equal_up_to_rounding_sort_top_to_bottom() {
let lower = Circle { center: Point::new(0.0, 0.2), radius: 0.1 };
let upper = Circle { center: Point::new(0.0, -0.2), radius: 0.1 + 1e-13 };
let wider = Circle { center: Point::new(0.0, -0.5), radius: 0.2 };
let mut v = [wider, lower, upper];
sort(&mut v, SAME);
assert_eq!(v, [upper, lower, wider]);
}
#[test]
fn the_nearest_point_is_looked_for_on_every_segment_it_may_be_on() {
// An arc bulging to y = −0.3 whose one chord lies on y = 0, and a line on y = −0.25. Seen from
// (0, −1), the line's chord is nearer (0.75 against 1.0), but the arc itself is (0.7).
let arc = CubicBez::new((-1.0, 0.0), (-1.0, -0.4), (1.0, -0.4), (1.0, 0.0));
let line = CubicBez::new((-0.5, -0.25), (-0.2, -0.25), (0.2, -0.25), (0.5, -0.25));
let outline = Outline {
segments: vec![arc, line],
beside: vec![(None, None), (None, None)],
chords: vec![(arc.p0, arc.p3, 0, 0.0, 1.0), (line.p0, line.p3, 1, 0.0, 1.0)],
slack: 0.3,
};
let (p, d) = outline.extreme(Point::new(0.0, -1.0), false);
assert!((d - 0.7).abs() <= 1e-9 && (p - Point::new(0.0, -0.3)).hypot() <= 1e-9, "{p:?} {d}");
}
#[test]
fn copies_among_three_shapes_are_a_whole_family() {
use TangentCircleError::*;
// A circle turned and turned back differs from itself by rounding only.
let b = circle(3.0, 7.0, 20.0);
let turned = b.transformed(Affine::rotate(0.3)).transformed(Affine::rotate(-0.3));
assert_ne!(b, turned);
assert_eq!(tangent_circles(&[&b, &turned, &circle(100.0, 0.0, 5.0)], None), Err(TooMany));
// Two copies of a square.
let sq = square(0.0, 0.0, 10.0);
assert_eq!(tangent_circles(&[&sq, &sq.clone(), &square(60.0, 0.0, 10.0)], None), Err(TooMany));
// Two circles half a point apart, a million points from the third, are not copies.
let far = [circle(0.0, 0.0, 10.0), circle(0.0, 0.5, 10.0), circle(1e6, 0.0, 10.0)];
assert_ne!(tangent_circles(&[&far[0], &far[1], &far[2]], None), Err(TooMany));
}
#[test]
fn three_squares_are_solved_numerically() {
let shapes = [square(0.0, 0.0, 10.0), square(60.0, 0.0, 10.0), square(30.0, 50.0, 10.0)];
let found = tangent_circles(&[&shapes[0], &shapes[1], &shapes[2]], None).unwrap();
assert!(!found.is_empty());
let dense: Vec<Vec<Point>> = shapes.iter().map(|s| samples(s, 4000)).collect();
for c in &found {
for pts in &dense {
assert!(touches(c, pts, 0.01), "{c:?}");
}
}
// By symmetry, the circle in the middle touching all three from outside is centered on x = 30.
let inner = found.iter().find(|c| (c.center.x - 30.0).abs() < 1e-6 && c.center.y > 0.0 && c.center.y < 40.0);
assert!(inner.is_some(), "{found:?}");
}
#[test]
fn compound_and_far_off_paths_give_the_same_circles_moved() {
// A ring (two subpaths of one path) and a small square in its hole.
let mut ring = circle(0.0, 0.0, 50.0);
ring.subpaths.extend(circle(0.0, 0.0, 30.0).subpaths);
let dot = square(0.0, 0.0, 5.0);
// Radius 12: in the hole 18 from the center, and 12 from a corner of the square: two by each
// corner.
let found = tangent_circles(&[&ring, &dot], Some(12.0)).unwrap();
assert_eq!(found.len(), 8, "{found:?}");
let (ring_pts, dot_pts) = (samples(&ring, 4000), samples(&dot, 4000));
for c in &found {
assert!(touches(c, &ring_pts, 0.02) && touches(c, &dot_pts, 0.02), "{c:?}");
}
// Moved far off and scaled: the same circles, moved and scaled.
let m = Affine::translate((1e6, -2e6)) * Affine::scale(3.0);
let (ring2, dot2) = (ring.transformed(m), dot.transformed(m));
let moved = tangent_circles(&[&ring2, &dot2], Some(36.0)).unwrap();
assert_eq!(moved.len(), found.len(), "{moved:?} vs {found:?}");
for c in &found {
assert!(has(&moved, m * c.center, 3.0 * c.radius, 1e-4), "{c:?}");
}
}
#[test]
fn open_paths_and_no_answer() {
let line = PathData::single(SubPath::polyline(&[Point::new(0.0, 0.0), Point::new(100.0, 0.0)], false));
let disc = circle(50.0, 40.0, 10.0);
// Radius 10: a center 10 from the line is at least 30 from the disc's center, never 20.
assert_eq!(tangent_circles(&[&line, &disc], Some(10.0)).unwrap(), vec![]);
// Radius 20: centers on y = 20, 30 from (50, 40): x = 50 ± √500.
let found = tangent_circles(&[&line, &disc], Some(20.0)).unwrap();
assert_eq!(found.len(), 2, "{found:?}");
let dx = 500f64.sqrt();
assert!(has(&found, Point::new(50.0 - dx, 20.0), 20.0, 0.05) && has(&found, Point::new(50.0 + dx, 20.0), 20.0, 0.05), "{found:?}");
// A given radius far past 64 × the bounds' diagonal: two short segments 10 apart and radius
// 1000 (the limit applies only when three shapes set the radius).
let left = PathData::single(SubPath::polyline(&[Point::new(0.0, 0.0), Point::new(1.0, 0.0)], false));
let right = PathData::single(SubPath::polyline(&[Point::new(10.0, 0.0), Point::new(11.0, 0.0)], false));
let found = tangent_circles(&[&left, &right], Some(1000.0)).unwrap();
assert!(!found.is_empty());
let (lp, rp) = (samples(&left, 4000), samples(&right, 4000));
for c in &found {
assert!(c.radius == 1000.0 && touches(c, &lp, 1e-3) && touches(c, &rp, 1e-3), "{c:?}");
}
// Two squares far apart with a small radius: none.
let (a, b) = (square(0.0, 0.0, 10.0), square(500.0, 0.0, 10.0));
assert_eq!(tangent_circles(&[&a, &b], Some(5.0)).unwrap(), vec![]);
}
#[test]
fn whole_curves_of_answers_and_bad_input_are_errors() {
use TangentCircleError::*;
let (a, b) = (circle(0.0, 0.0, 50.0), circle(0.0, 0.0, 20.0));
assert_eq!(tangent_circles(&[&a, &b], Some(15.0)), Err(TooMany));
let (outer, inner) = (square(0.0, 0.0, 50.0), square(0.0, 0.0, 20.0));
assert_eq!(tangent_circles(&[&outer, &inner], Some(15.0)), Err(TooMany));
assert_eq!(tangent_circles(&[&a], Some(1.0)), Err(BadInput));
assert_eq!(tangent_circles(&[&a, &b], None), Err(BadInput));
assert_eq!(tangent_circles(&[&a, &b, &a], Some(1.0)), Err(BadInput));
assert_eq!(tangent_circles(&[&a, &b], Some(0.0)), Err(BadInput));
assert_eq!(tangent_circles(&[&a, &b], Some(f64::NAN)), Err(BadInput));
// Two of three circles the same: a whole family touches all three.
let third = circle(100.0, 0.0, 5.0);
assert_eq!(tangent_circles(&[&b, &b.clone(), &third], None), Err(TooMany));
let mut reversed = b.clone();
reversed.reverse();
assert_eq!(tangent_circles(&[&b, &reversed, &third], None), Err(TooMany));
// Shapes so tiny that the radius overflows in their units.
let (tiny_a, tiny_b) = (circle(0.0, 0.0, 1e-305), circle(1e-304, 0.0, 1e-305));
assert_eq!(tangent_circles(&[&tiny_a, &tiny_b], Some(1e6)), Err(BadInput));
let empty = PathData::new(vec![]);
assert_eq!(tangent_circles(&[&a, &empty], Some(1.0)), Err(BadInput));
let big = PathData::single(SubPath::polyline(&(0..2001).map(|i| Point::new(i as f64, (i % 2) as f64)).collect::<Vec<_>>(), false));
assert_eq!(tangent_circles(&[&a, &big], Some(1.0)), Err(TooComplex));
// Lone anchors count as segments.
let dots = PathData::new((0..2001).map(|i| SubPath::polyline(&[Point::new(i as f64, 0.0)], false)).collect());
assert_eq!(tangent_circle_segments(&dots), 2001);
assert_eq!(tangent_circles(&[&a, &dots], Some(1.0)), Err(TooComplex));
}
#[test]
fn answers_about_a_tiny_shape_far_away_stay_apart() {
// Each tiny circle is touched from outside and from inside: answers 0.02 pt apart on each side,
// eight in all.
let (a, b) = (circle(0.0, 0.0, 0.01), circle(1e6, 0.0, 0.01));
let found = tangent_circles(&[&a, &b], Some(1e6)).unwrap();
assert_eq!(found.len(), 8, "{found:?}");
// All of one radius: top to bottom, then left to right.
for w in found.windows(2) {
let (a, b) = (w[0].center, w[1].center);
assert!(a.y < b.y - 1e-3 || ((a.y - b.y).abs() <= 1e-3 && a.x < b.x), "{found:?}");
}
}
+3 -1
View File
@@ -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 and Convert to Parametric Shape; the Anchor Inspector panel (the selected
//! Dashes ([`dashes`]), Expand Dashes into Paths, Convert to Parametric Shape and Tangent Circle… ([`tangent_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
@@ -11,6 +11,7 @@ pub mod dashes;
pub mod set_corners;
pub mod shape;
pub mod shared_edge;
pub mod tangent_circle;
use egui::Ui;
use serde_json::{Map, Value, json};
@@ -70,6 +71,7 @@ pub fn menu() -> Vec<Item> {
Item::Cmd("Divide into Dashes…", dashes::COMMAND, Value::Null),
Item::Cmd("Expand Dashes into Paths", "addon.pathtools.expandDashes", json!({})),
Item::Cmd("Convert to Parametric Shape", "addon.pathtools.shape.convert", json!({})),
Item::Cmd("Tangent Circle…", tangent_circle::COMMAND, Value::Null),
]
}
@@ -0,0 +1,161 @@
//! Tangent Circle in the interface: its dialog (the radius, with two shapes selected, and which
//! circle to draw, or all), which previews the circles on the canvas and runs
//! `addon.pathtools.tangentCircle` on OK.
use egui::Ui;
use serde_json::{Value, json};
use crate::VectorcraftApp;
use crate::dialogs::{DialogSpec, form};
use crate::state::Dialog;
use crate::widgets;
/// The command, and its dialog's kind.
pub const COMMAND: &str = "addon.pathtools.tangentCircle";
pub const KIND: &str = "tangentCircle";
/// The radius the command takes (pt).
const RADII: std::ops::RangeInclusive<f64> = 0.01..=1e6;
/// The most circles the command lists.
const MAX_CIRCLES: u64 = 64;
const LABEL_W: f32 = 60.0;
const FIELD_W: f32 = 90.0;
/// How many circles the last preview found (a private field).
const FOUND: &str = "__found";
/// The parameters the last preview ran with (a private field).
const TRIED: &str = "__tried";
/// How many objects were selected when the dialog opened (a private field): two take a radius,
/// three set it themselves. The preview selects the circles it draws, so the count is kept.
const SHAPES: &str = "__shapes";
/// The dialog's fields to start with: a radius of 36 pt, every circle, Preview on (the Circle menu
/// lists the circles the last preview found), and the selection's size.
pub(crate) fn fields(app: &VectorcraftApp) -> Value {
let shapes = app.session.active().map_or(0, |st| st.selection.objects.len());
json!({ "radius": 36, "circle": 0, "preview": true, SHAPES: shapes })
}
pub(crate) const SPEC: DialogSpec =
DialogSpec { heading: |_| tl!("Tangent Circle").to_string(), body, confirm, preview: true, min_width: 280.0, ..DialogSpec::FORM };
fn shapes(d: &Dialog) -> u64 {
d.fields.get(SHAPES).and_then(Value::as_u64).unwrap_or(0)
}
/// The command's parameters: the radius only with two shapes.
fn params(d: &Dialog) -> Value {
let mut p = json!({ "circle": d.fields.get("circle").cloned().unwrap_or(json!(0)) });
if shapes(d) == 2
&& let (Some(o), Some(r)) = (p.as_object_mut(), d.fields.get("radius"))
{
o.insert("radius".into(), r.clone());
}
p
}
fn body(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> bool {
let unit = app.session.general_unit();
widgets::label_row(ui, tl!("Radius:"), LABEL_W, |ui| {
ui.add_enabled_ui(shapes(d) == 2, |ui| form::length_within(ui, d, "radius", unit, FIELD_W, Some(RADII)));
});
// The command lists at most 64 circles; the menu never holds more.
let found = d.fields.get(FOUND).and_then(Value::as_u64).unwrap_or(0).min(MAX_CIRCLES);
let pick = d.fields.get("circle").and_then(Value::as_u64).unwrap_or(0).min(MAX_CIRCLES);
let mut options = vec![tl!("All").to_string()];
options.extend((1..=found.max(pick)).map(|n| n.to_string()));
let names: Vec<&str> = options.iter().map(String::as_str).collect();
let current = options.get(usize::try_from(pick).unwrap_or(0)).cloned().unwrap_or_default();
widgets::label_row(ui, tl!("Circle:"), LABEL_W, |ui| {
if let Some(i) = widgets::dropdown_names(ui, "tangent-circle-pick", &current, &names, FIELD_W) {
d.fields.insert("circle".into(), json!(i));
}
});
let p = params(d);
let fresh = d.fields.get(TRIED) != Some(&p);
match form::preview_result(app, ui, d, "Tangent Circle", COMMAND, p.clone()) {
Some(r) => {
d.fields.insert(FOUND.into(), r["found"].clone());
}
// A new radius or pick found nothing: the menu no longer lists the earlier circles, and a
// pick past the circles left shows them all again.
None if fresh && d.bool("preview") => {
d.fields.insert(FOUND.into(), json!(0));
if pick > 0 {
d.fields.insert("circle".into(), json!(0));
}
}
None => {}
}
d.fields.insert(TRIED.into(), p);
false
}
/// OK: run the command (keep its preview) and close.
fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
form::commit_preview(app, COMMAND, params(d))
}
#[cfg(test)]
mod tests {
use serde_json::json;
use vectorcraft_engine::Session;
use crate::tests_labels::painted_text;
use crate::{VectorcraftApp, menus};
fn circle(app: &mut VectorcraftApp, cx: f64, cy: f64, r: f64) -> u64 {
app.run("shape.ellipse", json!({"x": cx - r, "y": cy - r, "width": 2.0 * r, "height": 2.0 * r})).unwrap()["id"].as_u64().unwrap()
}
#[test]
fn tangent_circle_previews_picks_one_cancels_and_runs_on_ok() {
let mut app = VectorcraftApp::new(Session::new(), Default::default());
app.run("file.new", json!({"width": 400, "height": 300})).unwrap();
let a = circle(&mut app, 100.0, 100.0, 10.0);
let b = circle(&mut app, 130.0, 100.0, 10.0);
app.run("select.set", json!({"ids": [a, b]})).unwrap();
let entries = menus::menu_entries(&app);
let item = entries.iter().find(|e| e.path == ["Object", "Plug-ins", "Path Precision Tools"] && e.label == "Tangent Circle…").unwrap();
let (cmd, p) = menus::click_target(&item.label, item.command.as_deref().unwrap(), &item.params);
menus::invoke(&mut app, &cmd, p);
assert_eq!(app.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some(super::KIND));
let shown = painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx()));
for s in ["Tangent Circle", "Radius:", "Circle:", "All", "Preview"] {
assert!(shown.contains(s), "{s} in {shown}");
}
let count = |app: &VectorcraftApp| app.session.doc().unwrap().doc.layers[0].children().unwrap().len();
// Preview is on from the start: radius 36 gives eight circles, and the menu lists them.
assert_eq!(count(&app), 10, "previewed on opening: {}", app.ui.status);
assert_eq!(app.ui.dialog.as_ref().unwrap().fields["__found"], json!(8));
let d = app.ui.dialog.as_mut().unwrap();
d.fields.insert("radius".into(), json!(20));
painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx()));
// Six circles of radius 20 touch both: all previewed.
assert_eq!(count(&app), 8, "previewed: {}", app.ui.status);
assert_eq!(app.ui.dialog.as_ref().unwrap().fields["__found"], json!(6));
app.ui.dialog.as_mut().unwrap().fields.insert("circle".into(), json!(2));
painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx()));
assert_eq!(count(&app), 3, "one previewed");
// A pick past the circles found (a control request can set any number) goes back to All.
app.ui.dialog.as_mut().unwrap().fields.insert("circle".into(), json!(u64::MAX));
painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx()));
assert_eq!(app.ui.dialog.as_ref().unwrap().fields["circle"], json!(0));
painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx()));
assert_eq!(app.ui.dialog.as_ref().unwrap().fields["__found"], json!(6));
// Radius 2 cannot reach across the 10 pt gap: the menu lists no circles.
app.ui.dialog.as_mut().unwrap().fields.insert("radius".into(), json!(2));
painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx()));
assert_eq!(app.ui.dialog.as_ref().unwrap().fields["__found"], json!(0), "{}", app.ui.status);
crate::dialogs::cancel(&mut app);
assert_eq!(count(&app), 2, "rolled back");
app.run("select.set", json!({"ids": [a, b]})).unwrap();
menus::invoke(&mut app, &cmd, serde_json::Value::Null);
let n = app.session.doc().unwrap().history.undo.len();
app.ui.dialog.as_mut().unwrap().fields.insert("radius".into(), json!(5));
crate::dialogs::confirm(&mut app).unwrap();
assert!(app.ui.dialog.is_none());
assert_eq!(app.session.doc().unwrap().history.undo.len(), n + 1);
// Radius 5: the one circle in the gap.
assert_eq!(count(&app), 3);
}
}
+1
View File
@@ -470,6 +470,7 @@ registry! {
RenameArtboards: [rename_artboards::KIND] => rename_artboards::SPEC,
PathToolOptions: [crate::addons::pathtools::KIND] => crate::addons::pathtools::OPTIONS_SPEC,
DivideDashes: [crate::addons::pathtools::dashes::KIND] => crate::addons::pathtools::dashes::SPEC,
TangentCircle: [crate::addons::pathtools::tangent_circle::KIND] => crate::addons::pathtools::tangent_circle::SPEC,
SetCorners: [crate::addons::pathtools::set_corners::KIND] => crate::addons::pathtools::set_corners::SPEC,
NearestSwatch: [crate::addons::color::nearest::KIND] => crate::addons::color::nearest::SPEC,
SwatchLegend: [crate::addons::color::legend::KIND] => crate::addons::color::legend::SPEC,
+1 -1
View File
@@ -995,7 +995,7 @@ pub(crate) fn preview(app: &mut crate::VectorcraftApp, ui: &mut egui::Ui, d: &mu
/// As [`preview`], returning the command's result only when a new preview succeeds.
/// A dialog can retain a small summary (such as point counts) in its private fields.
pub(super) fn preview_result(
pub(crate) fn preview_result(
app: &mut crate::VectorcraftApp,
ui: &mut egui::Ui,
d: &mut Dialog,
+18
View File
@@ -6729,6 +6729,24 @@ breakText Glyphs Глифи
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Разширяване на тиретата в пътища
@msg select paths with dashed strokes to expand изберете пътища с прекъснат щрих за разширяване
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Допирателна окръжност…
Tangent Circle Допирателна окръжност
Circle: Окръжност:
@msg `ids` names an object twice `ids` посочва обект два пъти
@msg select two or three paths or compound paths изберете два или три пътя или съставни пътя
@msg `radius` must be from 0.01 to 1000000 pt `radius` трябва да е от 0.01 до 1000000 pt
@msg two shapes need a `radius` две форми изискват `radius`
@msg three shapes set the radius themselves: leave `radius` out три форми сами задават радиуса: пропуснете `radius`
@msg `circle` must be from 0 to 64 `circle` трябва да е от 0 до 64
@msg a shape has no outline една от формите няма контур
@msg the shapes are too complex: at most 2000 segments in all формите са твърде сложни: общо най-много 2000 сегмента
@msg these shapes take too long to search търсенето за тези форми отнема твърде дълго
@msg more than 64 circles touch these shapes: they may touch along a whole curve повече от 64 окръжности докосват тези форми: може да ги докосват по цяла крива
@msg no circle touches these shapes никоя окръжност не докосва тези форми
@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 тези форми са твърде малки, за да бъдат измерени
# Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy.
Document Tools Инструменти за документи
Save a Timestamped Copy Запазване на копие с дата и час
Can't render this file because it is too large.
+18
View File
@@ -6781,6 +6781,24 @@ shape Open Otvoren
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Proširi crtice u putanje
@msg select paths with dashed strokes to expand odaberite putanje s isprekidanim potezom za proširivanje
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Tangentna kružnica…
Tangent Circle Tangentna kružnica
Circle: Kružnica:
@msg `ids` names an object twice `ids` navodi objekat dvaput
@msg select two or three paths or compound paths odaberite dvije ili tri putanje ili složene putanje
@msg `radius` must be from 0.01 to 1000000 pt `radius` mora biti od 0.01 do 1000000 pt
@msg two shapes need a `radius` dva oblika trebaju `radius`
@msg three shapes set the radius themselves: leave `radius` out tri oblika sama određuju poluprečnik: izostavite `radius`
@msg `circle` must be from 0 to 64 `circle` mora biti od 0 do 64
@msg a shape has no outline oblik nema obris
@msg the shapes are too complex: at most 2000 segments in all oblici su previše složeni: najviše 2000 segmenata ukupno
@msg these shapes take too long to search pretraga za ove oblike traje predugo
@msg more than 64 circles touch these shapes: they may touch along a whole curve više od 64 kružnice dodiruje ove oblike: možda ih dodiruju duž cijele krivulje
@msg no circle touches these shapes nijedna kružnica ne dodiruje ove oblike
@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
# 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
Can't render this file because it contains an unexpected character in line 2 and column 73.
+18
View File
@@ -7361,6 +7361,24 @@ breakText Glyphs Glifs
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Expandeix els guions en camins
@msg select paths with dashed strokes to expand seleccioneu camins amb traç discontinu per expandir
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Cercle tangent…
Tangent Circle Cercle tangent
Circle: Cercle:
@msg `ids` names an object twice `ids` indica un objecte dues vegades
@msg select two or three paths or compound paths seleccioneu dos o tres camins o camins compostos
@msg `radius` must be from 0.01 to 1000000 pt `radius` ha de ser de 0.01 a 1000000 pt
@msg two shapes need a `radius` dues formes necessiten un `radius`
@msg three shapes set the radius themselves: leave `radius` out tres formes fixen el radi per si mateixes: ometeu `radius`
@msg `circle` must be from 0 to 64 `circle` ha de ser de 0 a 64
@msg a shape has no outline una forma no té contorn
@msg the shapes are too complex: at most 2000 segments in all les formes són massa complexes: com a màxim 2000 segments en total
@msg these shapes take too long to search la cerca triga massa amb aquestes formes
@msg more than 64 circles touch these shapes: they may touch along a whole curve més de 64 cercles toquen aquestes formes: potser les toquen al llarg de tota una corba
@msg no circle touches these shapes cap cercle no toca aquestes formes
@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
# 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
Can't render this file because it contains an unexpected character in line 2 and column 73.
+18
View File
@@ -7365,6 +7365,24 @@ breakText Glyphs Glyfy
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Rozložit čárky na cesty
@msg select paths with dashed strokes to expand vyberte cesty s čárkovaným tahem k rozložení
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Tečná kružnice…
Tangent Circle Tečná kružnice
Circle: Kružnice:
@msg `ids` names an object twice `ids` uvádí některý objekt dvakrát
@msg select two or three paths or compound paths vyberte dvě nebo tři cesty nebo složené cesty
@msg `radius` must be from 0.01 to 1000000 pt `radius` musí být od 0.01 do 1000000 pt
@msg two shapes need a `radius` dva tvary potřebují `radius`
@msg three shapes set the radius themselves: leave `radius` out tři tvary určují poloměr samy: vynechte `radius`
@msg `circle` must be from 0 to 64 `circle` musí být od 0 do 64
@msg a shape has no outline tvar nemá obrys
@msg the shapes are too complex: at most 2000 segments in all tvary jsou příliš složité: celkem nejvýše 2000 segmentů
@msg these shapes take too long to search hledání pro tyto tvary trvá příliš dlouho
@msg more than 64 circles touch these shapes: they may touch along a whole curve těchto tvarů se dotýká více než 64 kružnic: mohou se jich dotýkat podél celé křivky
@msg no circle touches these shapes žádná kružnice se těchto tvarů nedotýká
@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í
# 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
Can't render this file because it is too large.
+18
View File
@@ -7414,6 +7414,24 @@ breakText Glyphs Glyffer
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Udvid streger til stier
@msg select paths with dashed strokes to expand vælg stier med stiplet streg, der skal udvides
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Tangentcirkel…
Tangent Circle Tangentcirkel
Circle: Cirkel:
@msg `ids` names an object twice `ids` nævner et objekt to gange
@msg select two or three paths or compound paths vælg to eller tre stier eller sammensatte stier
@msg `radius` must be from 0.01 to 1000000 pt `radius` skal være fra 0.01 til 1000000 pt
@msg two shapes need a `radius` to figurer kræver en `radius`
@msg three shapes set the radius themselves: leave `radius` out tre figurer bestemmer selv radius: udelad `radius`
@msg `circle` must be from 0 to 64 `circle` skal være fra 0 til 64
@msg a shape has no outline en figur har ingen kontur
@msg the shapes are too complex: at most 2000 segments in all figurerne er for komplekse: højst 2000 segmenter i alt
@msg these shapes take too long to search søgningen tager for lang tid for disse figurer
@msg more than 64 circles touch these shapes: they may touch along a whole curve mere end 64 cirkler rører disse figurer: de rører dem måske langs en hel kurve
@msg no circle touches these shapes ingen cirkel rører disse figurer
@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
# 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
Can't render this file because it contains an unexpected character in line 2 and column 73.
+18
View File
@@ -6956,6 +6956,24 @@ breakText Glyphs Glyphen
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Striche in Pfade umwandeln
@msg select paths with dashed strokes to expand wählen Sie Pfade mit gestrichelter Kontur zum Umwandeln aus
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Tangentialkreis…
Tangent Circle Tangentialkreis
Circle: Kreis:
@msg `ids` names an object twice `ids` nennt ein Objekt zweimal
@msg select two or three paths or compound paths wählen Sie zwei oder drei Pfade oder zusammengesetzte Pfade aus
@msg `radius` must be from 0.01 to 1000000 pt `radius` muss von 0.01 bis 1000000 pt sein
@msg two shapes need a `radius` zwei Formen brauchen einen `radius`
@msg three shapes set the radius themselves: leave `radius` out drei Formen legen den Radius selbst fest: lassen Sie `radius` weg
@msg `circle` must be from 0 to 64 `circle` muss von 0 bis 64 sein
@msg a shape has no outline eine Form hat keinen Umriss
@msg the shapes are too complex: at most 2000 segments in all die Formen sind zu komplex: höchstens 2000 Segmente insgesamt
@msg these shapes take too long to search diese Formen brauchen zu lange für die Suche
@msg more than 64 circles touch these shapes: they may touch along a whole curve mehr als 64 Kreise berühren diese Formen: sie berühren sie womöglich entlang einer ganzen Kurve
@msg no circle touches these shapes kein Kreis berührt diese Formen
@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
# Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy.
Document Tools Dokumentwerkzeuge
Save a Timestamped Copy Kopie mit Zeitstempel speichern
Can't render this file because it is too large.
+18
View File
@@ -7334,6 +7334,24 @@ breakText Glyphs Γλύφοι
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Επέκταση παυλών σε διαδρομές
@msg select paths with dashed strokes to expand επιλέξτε διαδρομές με διακεκομμένο περίγραμμα για επέκταση
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Εφαπτόμενος κύκλος…
Tangent Circle Εφαπτόμενος κύκλος
Circle: Κύκλος:
@msg `ids` names an object twice το `ids` αναφέρει ένα αντικείμενο δύο φορές
@msg select two or three paths or compound paths επιλέξτε δύο ή τρεις διαδρομές ή σύνθετες διαδρομές
@msg `radius` must be from 0.01 to 1000000 pt το `radius` πρέπει να είναι από 0.01 έως 1000000 pt
@msg two shapes need a `radius` δύο σχήματα χρειάζονται `radius`
@msg three shapes set the radius themselves: leave `radius` out τρία σχήματα ορίζουν μόνα τους την ακτίνα: παραλείψτε το `radius`
@msg `circle` must be from 0 to 64 το `circle` πρέπει να είναι από 0 έως 64
@msg a shape has no outline ένα σχήμα δεν έχει περίγραμμα
@msg the shapes are too complex: at most 2000 segments in all τα σχήματα είναι υπερβολικά σύνθετα: το πολύ 2000 τμήματα συνολικά
@msg these shapes take too long to search η αναζήτηση για αυτά τα σχήματα διαρκεί υπερβολικά πολύ
@msg more than 64 circles touch these shapes: they may touch along a whole curve περισσότεροι από 64 κύκλοι αγγίζουν αυτά τα σχήματα: ίσως τα αγγίζουν κατά μήκος μιας ολόκληρης καμπύλης
@msg no circle touches these shapes κανένας κύκλος δεν αγγίζει αυτά τα σχήματα
@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 αυτά τα σχήματα είναι πολύ μικρά για να μετρηθούν
# Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy.
Document Tools Εργαλεία εγγράφου
Save a Timestamped Copy Αποθήκευση αντιγράφου με ημερομηνία και ώρα
Can't render this file because it is too large.
+18
View File
@@ -7322,6 +7322,24 @@ breakText Glyphs Glifos
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Expandir guiones en trazados
@msg select paths with dashed strokes to expand seleccione trazados con trazo discontinuo para expandir
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Círculo tangente…
Tangent Circle Círculo tangente
Circle: Círculo:
@msg `ids` names an object twice `ids` indica un objeto dos veces
@msg select two or three paths or compound paths seleccione dos o tres trazados o trazados compuestos
@msg `radius` must be from 0.01 to 1000000 pt `radius` debe ser de 0.01 a 1000000 pt
@msg two shapes need a `radius` dos formas necesitan un `radius`
@msg three shapes set the radius themselves: leave `radius` out tres formas fijan el radio por sí mismas: omita `radius`
@msg `circle` must be from 0 to 64 `circle` debe ser de 0 a 64
@msg a shape has no outline una forma no tiene contorno
@msg the shapes are too complex: at most 2000 segments in all las formas son demasiado complejas: como máximo 2000 segmentos en total
@msg these shapes take too long to search la búsqueda tarda demasiado con estas formas
@msg more than 64 circles touch these shapes: they may touch along a whole curve más de 64 círculos tocan estas formas: puede que las toquen a lo largo de toda una curva
@msg no circle touches these shapes ningún círculo toca estas formas
@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
# 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
Can't render this file because it contains an unexpected character in line 2 and column 73.
+18
View File
@@ -7410,6 +7410,24 @@ breakText Glyphs Merkit
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Laajenna viivat poluiksi
@msg select paths with dashed strokes to expand valitse laajennettavat polut, joissa on katkoviiva
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Sivuava ympyrä…
Tangent Circle Sivuava ympyrä
Circle: Ympyrä:
@msg `ids` names an object twice `ids` mainitsee saman objektin kahdesti
@msg select two or three paths or compound paths valitse kaksi tai kolme polkua tai yhdistelmäpolkua
@msg `radius` must be from 0.01 to 1000000 pt `radius` on oltava 0.01–1000000 pt
@msg two shapes need a `radius` kaksi muotoa tarvitsee arvon `radius`
@msg three shapes set the radius themselves: leave `radius` out kolme muotoa määrää säteen itse: jätä `radius` pois
@msg `circle` must be from 0 to 64 `circle` on oltava 0–64
@msg a shape has no outline muodolla ei ole ääriviivaa
@msg the shapes are too complex: at most 2000 segments in all muodot ovat liian monimutkaisia: enintään 2000 segmenttiä yhteensä
@msg these shapes take too long to search haku kestää liian kauan näille muodoille
@msg more than 64 circles touch these shapes: they may touch along a whole curve yli 64 ympyrää sivuaa näitä muotoja: ne saattavat sivuta niitä koko käyrän matkalta
@msg no circle touches these shapes mikään ympyrä ei sivua näitä muotoja
@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
# Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy.
Document Tools Asiakirjatyökalut
Save a Timestamped Copy Tallenna kopio aikaleimalla
Can't render this file because it contains an unexpected character in line 2 and column 73.
+18
View File
@@ -7360,6 +7360,24 @@ breakText Glyphs Glyphes
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Décomposer les tirets en tracés
@msg select paths with dashed strokes to expand sélectionnez des tracés à contour pointillé à décomposer
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Cercle tangent…
Tangent Circle Cercle tangent
Circle: Cercle :
@msg `ids` names an object twice `ids` désigne deux fois le même objet
@msg select two or three paths or compound paths sélectionnez deux ou trois tracés ou tracés transparents
@msg `radius` must be from 0.01 to 1000000 pt `radius` doit être compris entre 0.01 et 1000000 pt
@msg two shapes need a `radius` deux formes demandent un `radius`
@msg three shapes set the radius themselves: leave `radius` out trois formes fixent elles-mêmes le rayon : omettez `radius`
@msg `circle` must be from 0 to 64 `circle` doit être compris entre 0 et 64
@msg a shape has no outline une forme n’a pas de contour
@msg the shapes are too complex: at most 2000 segments in all les formes sont trop complexes : 2000 segments au plus au total
@msg these shapes take too long to search la recherche prend trop de temps pour ces formes
@msg more than 64 circles touch these shapes: they may touch along a whole curve plus de 64 cercles touchent ces formes : ils les touchent peut-être le long d’une courbe entière
@msg no circle touches these shapes aucun cercle ne touche ces formes
@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
# 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
Can't render this file because it is too large.
+3
View File
@@ -556,6 +556,7 @@
Chosen: {n} of {total} પસંદ કરેલ: {total} માંથી {n}
Chrome… ક્રોમ…
Circle વર્તુળ
Circle: વર્તુળ:
Classic ક્લાસિક
Clean Up સાફ કરો
Clean Up… સાફ કરો…
@@ -3836,6 +3837,8 @@
Table ટેબલ
Tabs ટૅબ
Tamil તમિલ
Tangent Circle સ્પર્શક વર્તુળ
Tangent Circle… સ્પર્શક વર્તુળ…
Taper ટેપર
Target લક્ષ્ય
Target Contents લક્ષ્ય સામગ્રી
Can't render this file because it contains an unexpected character in line 72 and column 5.
+17
View File
@@ -821,6 +821,7 @@ antiAlias Sharp शार्प
Chrome… क्रोम…
Circle वृत्त
Circle (open) सर्किल (ओपन)
Circle: वृत्त:
Classic क्लासिक
Classic Defaults क्लासिक डिफ़ॉल्ट
Clean Up क्लीन अप
@@ -5112,6 +5113,8 @@ antiAlias Sharp शार्प
Tag (open) टैग (ओपन)
Tail: पूंछ:
Tamil तमिल
Tangent Circle स्पर्शी वृत्त
Tangent Circle… स्पर्शी वृत्त…
Taper टेपर
Target लक्ष्य
Target Contents लक्ष्य सामग्री
@@ -8039,6 +8042,20 @@ antiAlias Sharp शार्प
@msg select paths, or segments, to divide विभाजित करने के लिए पाथ, या खंड चुनें
@msg select plain rectangles, ellipses or regular polygons to convert बदलने के लिए सादे आयत, अंडाकार या नियमित बहुभुजों सिलेक्ट करें
@msg Select point type पॉइंट टाइप सिलेक्ट करें
@msg select two or three paths or compound paths दो या तीन पाथ या यौगिक पाथ सिलेक्ट करें
@msg `ids` names an object twice `ids` एक ऑब्जेक्ट को दो बार बताता है
@msg `radius` must be from 0.01 to 1000000 pt `radius` 0.01 से 1000000 pt तक होना चाहिए
@msg two shapes need a `radius` दो आकृतियों के लिए `radius` चाहिए
@msg three shapes set the radius themselves: leave `radius` out तीन आकृतियाँ त्रिज्या खुद तय करती हैं: `radius` न दें
@msg `circle` must be from 0 to 64 `circle` 0 से 64 तक होना चाहिए
@msg a shape has no outline एक आकृति की कोई आउटलाइन नहीं है
@msg the shapes are too complex: at most 2000 segments in all आकृतियाँ बहुत जटिल हैं: कुल मिलाकर अधिकतम 2000 सेगमेंट
@msg these shapes take too long to search इन आकृतियों की खोज में बहुत ज़्यादा समय लगता है
@msg more than 64 circles touch these shapes: they may touch along a whole curve इन आकृतियों को 64 से ज़्यादा वृत्त छूते हैं: शायद वे पूरे वक्र के साथ छूते हैं
@msg no circle touches these shapes कोई भी वृत्त इन आकृतियों को नहीं छूता
@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 ये आकृतियाँ मापने के लिए बहुत छोटी हैं
@msg select rows or objects to collect इकट्ठा करने के लिए पंक्तियों या ऑब्जेक्ट्स सिलेक्ट करें
@msg select segments, or paths, to add points to पॉइंट्स जोड़ने के लिए सेगमेंट या पाथ सिलेक्ट करें
@msg select some type first पहले कुछ टाइप सिलेक्ट करें
Can't render this file because it is too large.
+18
View File
@@ -7350,6 +7350,24 @@ breakText Glyphs Glifák
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Szaggatások kibontása útvonalakká
@msg select paths with dashed strokes to expand jelöljön ki szaggatott körvonalú útvonalakat a kibontáshoz
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Érintőkör…
Tangent Circle Érintőkör
Circle: Kör:
@msg `ids` names an object twice `ids`: egy objektumot kétszer nevez meg
@msg select two or three paths or compound paths jelölj ki két vagy három útvonalat vagy összetett útvonalat
@msg `radius` must be from 0.01 to 1000000 pt a `radius` értéke 0.01 és 1000000 pt között lehet
@msg two shapes need a `radius` két alakzathoz `radius` kell
@msg three shapes set the radius themselves: leave `radius` out három alakzat maga határozza meg a sugarat: hagyd el a `radius` értéket
@msg `circle` must be from 0 to 64 a `circle` értéke 0 és 64 között lehet
@msg a shape has no outline egy alakzatnak nincs körvonala
@msg the shapes are too complex: at most 2000 segments in all az alakzatok túl összetettek: összesen legfeljebb 2000 szakasz
@msg these shapes take too long to search ezeknek az alakzatoknak a keresése túl sokáig tart
@msg more than 64 circles touch these shapes: they may touch along a whole curve több mint 64 kör érinti ezeket az alakzatokat: lehet, hogy egy teljes görbe mentén érintik őket
@msg no circle touches these shapes egyetlen kör sem érinti ezeket az alakzatokat
@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
# 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
Can't render this file because it is too large.
+18
View File
@@ -6744,6 +6744,24 @@ breakText Glyphs Glif
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Perluas garis putus menjadi jalur
@msg select paths with dashed strokes to expand pilih jalur dengan stroke putus-putus yang akan diperluas
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Lingkaran singgung…
Tangent Circle Lingkaran singgung
Circle: Lingkaran:
@msg `ids` names an object twice `ids` menyebut satu objek dua kali
@msg select two or three paths or compound paths pilih dua atau tiga jalur atau jalur gabungan
@msg `radius` must be from 0.01 to 1000000 pt `radius` harus dari 0.01 sampai 1000000 pt
@msg two shapes need a `radius` dua bentuk memerlukan `radius`
@msg three shapes set the radius themselves: leave `radius` out tiga bentuk menentukan jari-jarinya sendiri: hilangkan `radius`
@msg `circle` must be from 0 to 64 `circle` harus dari 0 sampai 64
@msg a shape has no outline sebuah bentuk tidak punya garis luar
@msg the shapes are too complex: at most 2000 segments in all bentuknya terlalu rumit: paling banyak 2000 segmen seluruhnya
@msg these shapes take too long to search pencarian untuk bentuk ini memakan waktu terlalu lama
@msg more than 64 circles touch these shapes: they may touch along a whole curve lebih dari 64 lingkaran menyentuh bentuk ini: mungkin menyentuhnya di sepanjang satu kurva utuh
@msg no circle touches these shapes tidak ada lingkaran yang menyentuh bentuk ini
@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
# 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
Can't render this file because it contains an unexpected character in line 2471 and column 5.
+18
View File
@@ -6992,6 +6992,24 @@ breakText Glyphs Glifi
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Espandi trattini in tracciati
@msg select paths with dashed strokes to expand seleziona tracciati con traccia tratteggiata da espandere
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Cerchio tangente…
Tangent Circle Cerchio tangente
Circle: Cerchio:
@msg `ids` names an object twice `ids` indica due volte lo stesso oggetto
@msg select two or three paths or compound paths seleziona due o tre tracciati o tracciati composti
@msg `radius` must be from 0.01 to 1000000 pt `radius` deve essere da 0.01 a 1000000 pt
@msg two shapes need a `radius` due forme richiedono un `radius`
@msg three shapes set the radius themselves: leave `radius` out tre forme fissano da sole il raggio: ometti `radius`
@msg `circle` must be from 0 to 64 `circle` deve essere da 0 a 64
@msg a shape has no outline una forma non ha contorno
@msg the shapes are too complex: at most 2000 segments in all le forme sono troppo complesse: al massimo 2000 segmenti in tutto
@msg these shapes take too long to search la ricerca richiede troppo tempo per queste forme
@msg more than 64 circles touch these shapes: they may touch along a whole curve più di 64 cerchi toccano queste forme: potrebbero toccarle lungo un’intera curva
@msg no circle touches these shapes nessun cerchio tocca queste forme
@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
# 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
Can't render this file because it is too large.
+18
View File
@@ -8869,6 +8869,24 @@ breakText Glyphs 字形
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths 破線をパスに拡張
@msg select paths with dashed strokes to expand 拡張する破線のパスを選択してください
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… 接円…
Tangent Circle 接円
Circle: 円:
@msg `ids` names an object twice `ids` に同じオブジェクトが 2 回指定されています
@msg select two or three paths or compound paths パスまたは複合パスを 2 つか 3 つ選択してください
@msg `radius` must be from 0.01 to 1000000 pt `radius` は 0.01 から 1000000 pt にしてください
@msg two shapes need a `radius` 2 つのシェイプには `radius` が必要です
@msg three shapes set the radius themselves: leave `radius` out 3 つのシェイプでは半径が決まるため、`radius` は指定しないでください
@msg `circle` must be from 0 to 64 `circle` は 0 から 64 にしてください
@msg a shape has no outline アウトラインのないシェイプがあります
@msg the shapes are too complex: at most 2000 segments in all シェイプが複雑すぎます:セグメントは合計 2000 個までです
@msg these shapes take too long to search これらのシェイプの検索に時間がかかりすぎます
@msg more than 64 circles touch these shapes: they may touch along a whole curve これらのシェイプに接する円が 64 個を超えています:曲線全体に沿って接している可能性があります
@msg no circle touches these shapes これらのシェイプに接する円はありません
@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 これらのシェイプは小さすぎて測定できません
# Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy.
Document Tools ドキュメントツール
Save a Timestamped Copy 日時付きのコピーを保存
Can't render this file because it is too large.
+18
View File
@@ -9481,6 +9481,24 @@ breakText Glyphs გლიფები
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths ტირეების ტრაექტორიებად გაშლა
@msg select paths with dashed strokes to expand აირჩიეთ გასაშლელი ტირეებიანი ხაზის კონტურები
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… მხები წრე…
Tangent Circle მხები წრე
Circle: წრე:
@msg `ids` names an object twice `ids` ერთსა და იმავე ობიექტს ორჯერ მიუთითებს
@msg select two or three paths or compound paths მონიშნეთ ორი ან სამი ტრაექტორია ან შედგენილი ტრაექტორია
@msg `radius` must be from 0.01 to 1000000 pt `radius` უნდა იყოს 0.01-დან 1000000 pt-მდე
@msg two shapes need a `radius` ორ ფიგურას `radius` სჭირდება
@msg three shapes set the radius themselves: leave `radius` out სამი ფიგურა რადიუსს თავად ადგენს: გამოტოვეთ `radius`
@msg `circle` must be from 0 to 64 `circle` უნდა იყოს 0-დან 64-მდე
@msg a shape has no outline ერთ-ერთ ფიგურას კონტური არ აქვს
@msg the shapes are too complex: at most 2000 segments in all ფიგურები ზედმეტად რთულია: სულ არაუმეტეს 2000 სეგმენტი
@msg these shapes take too long to search ამ ფიგურების ძიებას ზედმეტად დიდი დრო სჭირდება
@msg more than 64 circles touch these shapes: they may touch along a whole curve ამ ფიგურებს 64-ზე მეტი წრე ეხება: შესაძლოა მთელი მრუდის გასწვრივ ეხებოდნენ
@msg no circle touches these shapes ამ ფიგურებს არცერთი წრე არ ეხება
@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 ეს ფიგურები ზედმეტად პატარაა გასაზომად
# Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy.
Document Tools დოკუმენტის ხელსაწყოები
Save a Timestamped Copy ასლის შენახვა თარიღითა და დროით
Can't render this file because it is too large.
+18
View File
@@ -6956,6 +6956,24 @@ breakText Glyphs 글리프
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths 대시를 패스로 확장
@msg select paths with dashed strokes to expand 확장할 점선 획의 패스를 선택하십시오
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… 접원…
Tangent Circle 접원
Circle: 원:
@msg `ids` names an object twice `ids`에 같은 오브젝트가 두 번 있습니다
@msg select two or three paths or compound paths 패스나 컴파운드 패스를 두 개 또는 세 개 선택하세요
@msg `radius` must be from 0.01 to 1000000 pt `radius`은(는) 0.01에서 1000000 pt 사이여야 합니다
@msg two shapes need a `radius` 모양 두 개에는 `radius`이(가) 필요합니다
@msg three shapes set the radius themselves: leave `radius` out 모양 세 개는 반지름을 스스로 정하므로 `radius`을(를) 빼세요
@msg `circle` must be from 0 to 64 `circle`은(는) 0에서 64 사이여야 합니다
@msg a shape has no outline 윤곽선이 없는 모양이 있습니다
@msg the shapes are too complex: at most 2000 segments in all 모양이 너무 복잡합니다: 세그먼트는 모두 합쳐 최대 2000개입니다
@msg these shapes take too long to search 이 모양들을 찾는 데 시간이 너무 오래 걸립니다
@msg more than 64 circles touch these shapes: they may touch along a whole curve 이 모양들에 닿는 원이 64개를 넘습니다: 곡선 전체를 따라 닿아 있을 수 있습니다
@msg no circle touches these shapes 이 모양들에 닿는 원이 없습니다
@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 이 모양들은 너무 작아서 측정할 수 없습니다
# Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy.
Document Tools 문서 도구
Save a Timestamped Copy 날짜와 시간이 붙은 사본 저장
Can't render this file because it is too large.
+18
View File
@@ -9239,6 +9239,24 @@ breakText Glyphs Glyphs
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Streepjes uitbreiden tot paden
@msg select paths with dashed strokes to expand selecteer paden met een streepjeslijn om uit te breiden
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Raakcirkel…
Tangent Circle Raakcirkel
Circle: Cirkel:
@msg `ids` names an object twice `ids` noemt een object twee keer
@msg select two or three paths or compound paths selecteer twee of drie paden of samengestelde paden
@msg `radius` must be from 0.01 to 1000000 pt `radius` moet van 0.01 tot 1000000 pt zijn
@msg two shapes need a `radius` twee vormen hebben een `radius` nodig
@msg three shapes set the radius themselves: leave `radius` out drie vormen bepalen de straal zelf: laat `radius` weg
@msg `circle` must be from 0 to 64 `circle` moet van 0 tot 64 zijn
@msg a shape has no outline een vorm heeft geen omtrek
@msg the shapes are too complex: at most 2000 segments in all de vormen zijn te complex: hoogstens 2000 segmenten in totaal
@msg these shapes take too long to search het zoeken duurt te lang voor deze vormen
@msg more than 64 circles touch these shapes: they may touch along a whole curve meer dan 64 cirkels raken deze vormen: ze raken ze misschien langs een hele kromme
@msg no circle touches these shapes geen enkele cirkel raakt deze vormen
@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
# 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
Can't render this file because it is too large.
+18
View File
@@ -7221,6 +7221,24 @@ breakText Glyphs Glify
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Rozszerz kreski na ścieżki
@msg select paths with dashed strokes to expand zaznacz ścieżki z przerywanym konturem do rozszerzenia
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Okrąg styczny…
Tangent Circle Okrąg styczny
Circle: Okrąg:
@msg `ids` names an object twice `ids` wskazuje ten sam obiekt dwa razy
@msg select two or three paths or compound paths zaznacz dwie lub trzy ścieżki lub ścieżki złożone
@msg `radius` must be from 0.01 to 1000000 pt `radius` musi wynosić od 0.01 do 1000000 pt
@msg two shapes need a `radius` dwa kształty wymagają `radius`
@msg three shapes set the radius themselves: leave `radius` out trzy kształty same wyznaczają promień: pomiń `radius`
@msg `circle` must be from 0 to 64 `circle` musi wynosić od 0 do 64
@msg a shape has no outline kształt nie ma konturu
@msg the shapes are too complex: at most 2000 segments in all kształty są zbyt złożone: łącznie najwyżej 2000 segmentów
@msg these shapes take too long to search wyszukiwanie dla tych kształtów trwa zbyt długo
@msg more than 64 circles touch these shapes: they may touch along a whole curve tych kształtów dotyka ponad 64 okręgów: mogą się z nimi stykać wzdłuż całej krzywej
@msg no circle touches these shapes żaden okrąg nie dotyka tych kształtów
@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ć
# 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ą
Can't render this file because it is too large.
+18
View File
@@ -7396,6 +7396,24 @@ breakText Glyphs Glifos
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Expandir traços em demarcadores
@msg select paths with dashed strokes to expand selecione demarcadores com traçado tracejado para expandir
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Círculo tangente…
Tangent Circle Círculo tangente
Circle: Círculo:
@msg `ids` names an object twice `ids` indica um objeto duas vezes
@msg select two or three paths or compound paths selecione dois ou três caminhos ou caminhos compostos
@msg `radius` must be from 0.01 to 1000000 pt `radius` deve ser de 0.01 a 1000000 pt
@msg two shapes need a `radius` duas formas precisam de um `radius`
@msg three shapes set the radius themselves: leave `radius` out três formas definem o raio sozinhas: omita `radius`
@msg `circle` must be from 0 to 64 `circle` deve ser de 0 a 64
@msg a shape has no outline uma forma não tem contorno
@msg the shapes are too complex: at most 2000 segments in all as formas são complexas demais: no máximo 2000 segmentos no total
@msg these shapes take too long to search a busca demora demais para estas formas
@msg more than 64 circles touch these shapes: they may touch along a whole curve mais de 64 círculos tocam estas formas: eles podem tocá-las ao longo de uma curva inteira
@msg no circle touches these shapes nenhum círculo toca estas formas
@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
# 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
Can't render this file because it is too large.
+18
View File
@@ -7355,6 +7355,24 @@ breakText Glyphs Глифы
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Разобрать штрихи на контуры
@msg select paths with dashed strokes to expand выделите контуры со штриховой обводкой для разбора
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Касательная окружность…
Tangent Circle Касательная окружность
Circle: Окружность:
@msg `ids` names an object twice `ids` указывает объект дважды
@msg select two or three paths or compound paths выделите два или три контура или составных контура
@msg `radius` must be from 0.01 to 1000000 pt `radius` должен быть от 0.01 до 1000000 pt
@msg two shapes need a `radius` для двух фигур нужен `radius`
@msg three shapes set the radius themselves: leave `radius` out три фигуры сами задают радиус: не указывайте `radius`
@msg `circle` must be from 0 to 64 `circle` должен быть от 0 до 64
@msg a shape has no outline у фигуры нет контура
@msg the shapes are too complex: at most 2000 segments in all фигуры слишком сложные: всего не более 2000 сегментов
@msg these shapes take too long to search поиск для этих фигур занимает слишком много времени
@msg more than 64 circles touch these shapes: they may touch along a whole curve этих фигур касается больше 64 окружностей: возможно, они касаются вдоль целой кривой
@msg no circle touches these shapes ни одна окружность не касается этих фигур
@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 эти фигуры слишком малы для измерения
# Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy.
Document Tools Инструменты документа
Save a Timestamped Copy Сохранить копию с датой и временем
Can't render this file because it is too large.
+18
View File
@@ -7381,6 +7381,24 @@ breakText Glyphs Glyfer
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Expandera streck till banor
@msg select paths with dashed strokes to expand markera banor med streckad kontur att expandera
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Tangentcirkel…
Tangent Circle Tangentcirkel
Circle: Cirkel:
@msg `ids` names an object twice `ids` anger ett objekt två gånger
@msg select two or three paths or compound paths markera två eller tre banor eller sammansatta banor
@msg `radius` must be from 0.01 to 1000000 pt `radius` måste vara från 0.01 till 1000000 pt
@msg two shapes need a `radius` två former kräver en `radius`
@msg three shapes set the radius themselves: leave `radius` out tre former bestämmer radien själva: utelämna `radius`
@msg `circle` must be from 0 to 64 `circle` måste vara från 0 till 64
@msg a shape has no outline en form har ingen kontur
@msg the shapes are too complex: at most 2000 segments in all formerna är för komplexa: högst 2000 segment totalt
@msg these shapes take too long to search sökningen tar för lång tid för formerna
@msg more than 64 circles touch these shapes: they may touch along a whole curve fler än 64 cirklar rör vid formerna: de kan röra vid dem längs en hel kurva
@msg no circle touches these shapes ingen cirkel rör vid formerna
@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
# 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
Can't render this file because it is too large.
+18
View File
@@ -9243,6 +9243,24 @@ breakText Glyphs Glifler
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Tireleri Yollara Genişlet
@msg select paths with dashed strokes to expand genişletilecek kesikli konturlu yolları seçin
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Teğet Daire…
Tangent Circle Teğet Daire
Circle: Daire:
@msg `ids` names an object twice `ids` bir nesneyi iki kez belirtiyor
@msg select two or three paths or compound paths iki veya üç yol ya da bileşik yol seçin
@msg `radius` must be from 0.01 to 1000000 pt `radius` 0.01 ile 1000000 pt arasında olmalıdır
@msg two shapes need a `radius` iki şekil için `radius` gerekir
@msg three shapes set the radius themselves: leave `radius` out üç şekil yarıçapı kendisi belirler: `radius` değerini vermeyin
@msg `circle` must be from 0 to 64 `circle` 0 ile 64 arasında olmalıdır
@msg a shape has no outline bir şeklin anahattı yok
@msg the shapes are too complex: at most 2000 segments in all şekiller çok karmaşık: toplamda en fazla 2000 bölüm
@msg these shapes take too long to search bu şekiller için arama çok uzun sürüyor
@msg more than 64 circles touch these shapes: they may touch along a whole curve bu şekillere 64'ten fazla daire değiyor: bütün bir eğri boyunca değiyor olabilirler
@msg no circle touches these shapes bu şekillere hiçbir daire değmiyor
@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
# 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
Can't render this file because it is too large.
+18
View File
@@ -6974,6 +6974,24 @@ breakText Glyphs Гліфи
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Розібрати штрихи на контури
@msg select paths with dashed strokes to expand виділіть контури зі штриховим обведенням для розбору
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Дотичне коло…
Tangent Circle Дотичне коло
Circle: Коло:
@msg `ids` names an object twice `ids` указує об’єкт двічі
@msg select two or three paths or compound paths виділіть два або три контури чи складені контури
@msg `radius` must be from 0.01 to 1000000 pt `radius` має бути від 0.01 до 1000000 pt
@msg two shapes need a `radius` для двох фігур потрібен `radius`
@msg three shapes set the radius themselves: leave `radius` out три фігури самі задають радіус: не вказуйте `radius`
@msg `circle` must be from 0 to 64 `circle` має бути від 0 до 64
@msg a shape has no outline фігура не має контуру
@msg the shapes are too complex: at most 2000 segments in all фігури надто складні: загалом не більше 2000 сегментів
@msg these shapes take too long to search пошук для цих фігур триває надто довго
@msg more than 64 circles touch these shapes: they may touch along a whole curve цих фігур торкається понад 64 кола: можливо, вони торкаються вздовж цілої кривої
@msg no circle touches these shapes жодне коло не торкається цих фігур
@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 ці фігури замалі для вимірювання
# Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy.
Document Tools Інструменти документа
Save a Timestamped Copy Зберегти копію з датою і часом
Can't render this file because it is too large.
+18
View File
@@ -6991,6 +6991,24 @@ breakText Glyphs Glyph
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths Mở rộng nét đứt thành đường dẫn
@msg select paths with dashed strokes to expand chọn các đường dẫn có nét đứt để mở rộng
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… Đường tròn tiếp xúc…
Tangent Circle Đường tròn tiếp xúc
Circle: Đường tròn:
@msg `ids` names an object twice `ids` nêu một đối tượng hai lần
@msg select two or three paths or compound paths chọn hai hoặc ba đường dẫn hoặc đường dẫn phức hợp
@msg `radius` must be from 0.01 to 1000000 pt `radius` phải từ 0.01 đến 1000000 pt
@msg two shapes need a `radius` hai hình cần `radius`
@msg three shapes set the radius themselves: leave `radius` out ba hình tự xác định bán kính: hãy bỏ `radius`
@msg `circle` must be from 0 to 64 `circle` phải từ 0 đến 64
@msg a shape has no outline một hình không có đường viền
@msg the shapes are too complex: at most 2000 segments in all các hình quá phức tạp: tổng cộng tối đa 2000 đoạn
@msg these shapes take too long to search việc tìm kiếm cho các hình này mất quá nhiều thời gian
@msg more than 64 circles touch these shapes: they may touch along a whole curve hơn 64 đường tròn chạm vào các hình này: có thể chúng chạm dọc theo cả một đường cong
@msg no circle touches these shapes không có đường tròn nào chạm vào các hình này
@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
# 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ờ
Can't render this file because it contains an unexpected character in line 205 and column 5.
+18
View File
@@ -7206,6 +7206,24 @@ breakText Glyphs 字形
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths 将短划线扩展为路径
@msg select paths with dashed strokes to expand 请选择要扩展的虚线描边路径
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… 相切圆…
Tangent Circle 相切圆
Circle: 圆:
@msg `ids` names an object twice `ids` 重复指定了同一个对象
@msg select two or three paths or compound paths 请选择两个或三个路径或复合路径
@msg `radius` must be from 0.01 to 1000000 pt `radius` 必须为 0.01 到 1000000 pt
@msg two shapes need a `radius` 两个形状需要 `radius`
@msg three shapes set the radius themselves: leave `radius` out 三个形状会自行确定半径:请省略 `radius`
@msg `circle` must be from 0 to 64 `circle` 必须为 0 到 64
@msg a shape has no outline 有一个形状没有轮廓
@msg the shapes are too complex: at most 2000 segments in all 形状过于复杂:总共最多 2000 个线段
@msg these shapes take too long to search 这些形状的搜索耗时过长
@msg more than 64 circles touch these shapes: they may touch along a whole curve 与这些形状相切的圆超过 64 个:它们可能沿整条曲线相接
@msg no circle touches these shapes 没有与这些形状相切的圆
@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 这些形状太小,无法测量
# Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy.
Document Tools 文档工具
Save a Timestamped Copy 保存带时间戳的副本
Can't render this file because it is too large.
+18
View File
@@ -7015,6 +7015,24 @@ breakText Glyphs 字符
# Path Precision Tools add-on: Expand Dashes into Paths.
Expand Dashes into Paths 將短破折號展開為路徑
@msg select paths with dashed strokes to expand 請選取要展開的虛線筆畫路徑
# Path Precision Tools add-on: Tangent Circle.
Tangent Circle… 相切圓…
Tangent Circle 相切圓
Circle: 圓:
@msg `ids` names an object twice `ids` 將同一個物件指定了兩次
@msg select two or three paths or compound paths 請選取兩個或三個路徑或複合路徑
@msg `radius` must be from 0.01 to 1000000 pt `radius` 必須為 0.01 到 1000000 pt
@msg two shapes need a `radius` 兩個形狀需要 `radius`
@msg three shapes set the radius themselves: leave `radius` out 三個形狀會自行決定半徑:請勿指定 `radius`
@msg `circle` must be from 0 to 64 `circle` 必須為 0 到 64
@msg a shape has no outline 有一個形狀沒有外框
@msg the shapes are too complex: at most 2000 segments in all 形狀過於複雜:總共最多 2000 個線段
@msg these shapes take too long to search 這些形狀的搜尋耗時過長
@msg more than 64 circles touch these shapes: they may touch along a whole curve 與這些形狀相切的圓超過 64 個:它們可能沿整條曲線相接
@msg no circle touches these shapes 沒有與這些形狀相切的圓
@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 這些形狀太小,無法測量
# Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy.
Document Tools 文件工具
Save a Timestamped Copy 儲存附時間戳記的拷貝
Can't render this file because it is too large.
+3
View File
@@ -77,6 +77,9 @@ pub(super) fn menu_dialog(app: &VectorcraftApp, id: &str) -> Option<(&'static st
(crate::addons::pathtools::set_corners::KIND, crate::addons::pathtools::set_corners::fields(app))
}
crate::addons::pathtools::dashes::COMMAND => (crate::addons::pathtools::dashes::KIND, crate::addons::pathtools::dashes::fields()),
crate::addons::pathtools::tangent_circle::COMMAND => {
(crate::addons::pathtools::tangent_circle::KIND, crate::addons::pathtools::tangent_circle::fields(app))
}
crate::addons::color::nearest::COMMAND => (crate::addons::color::nearest::KIND, crate::addons::color::nearest::fields()),
crate::addons::color::legend::COMMAND => (crate::addons::color::legend::KIND, crate::addons::color::legend::fields()),
crate::addons::typetools::COMMAND => (crate::addons::typetools::KIND, crate::addons::typetools::fields(app)),
+3 -2
View File
@@ -296,11 +296,11 @@ fn a_shortcut_runs_what_its_menu_item_runs() {
/// Smooth and Simplify, Offset Path, the Object › Transform dialogs, Average, Split Into Grid,
/// Vector Halftone, Rearrange All Artboards, Pathfinder Options, the Object › Plug-ins dialogs
/// (Arrange in Grid, Replace with Top Object, the size, opacity and sort dialogs of the Arrange
/// add-on, Set Corners…, Divide into Dashes, Find Nearest Swatch, the swatch legend, the type
/// add-on, Set Corners…, Divide into Dashes, Tangent Circle…, Find Nearest Swatch, the swatch legend, the type
/// tools, the select add-on and Select by Link Status…), three "…" items whose menu entry gives
/// params, Smart Punctuation…, Edit Custom Dictionary…, Composite Fonts…, Recolor Artwork…, the Edit menu's preset
/// dialogs and Apply SVG Filter….
const MENU_DIALOG_COMMANDS: [&str; 39] = [
const MENU_DIALOG_COMMANDS: [&str; 40] = [
"object.path.smooth",
"object.path.simplify",
"object.path.offsetPath",
@@ -323,6 +323,7 @@ const MENU_DIALOG_COMMANDS: [&str; 39] = [
"addon.arrange.sort",
crate::addons::pathtools::set_corners::COMMAND,
crate::addons::pathtools::dashes::COMMAND,
crate::addons::pathtools::tangent_circle::COMMAND,
crate::addons::color::nearest::COMMAND,
crate::addons::color::legend::COMMAND,
crate::addons::typetools::COMMAND,
+20
View File
@@ -11845,6 +11845,26 @@ Commands:
drawn, and the path's fills stay on it, below its dashes (a path without fills goes). A compound path's dashes are
plain paths with its appearance. Paths without a dashed stroke stay as they are, and it is an error if none has one.
The dashes are selected; more than 100,000 (or a pattern too fine to draw) is refused. → `{ids, dashes}`.
- `addon.pathtools.tangentCircle {ids?, radius?, circle?}` draws the circles that touch two paths or compound paths
and have `radius` (0.01 to 1,000,000 pt, needed with two), or that touch three (which set the radius themselves, so
`radius` is then an error), as one undo step (Object › Plug-ins › Path Precision Tools › Tangent Circle…). `ids`
defaults to the selection. A circle touches a shape when it meets the shape's outline without crossing it, the whole
outline lying outside the circle or inside it: at a smooth point it is tangent to the outline, and at a corner or an
open end it passes through that point. A compound path's members count as one outline. For shapes that are all
circles of four curved segments (as the Ellipse tool draws them) the answers come from the true circles and are then
moved onto the drawn Bézier outlines, which differ by up to 0.0273% of the radius; within that much of a tangency
threshold the true circles decide. Every circle that touches all the shapes is found (three circles have up to
eight); with three shapes, circles up to 64 times the diagonal of the box around the shapes' anchors and handles.
They are listed by radius, then top to bottom, then left to right, and `circle` (0 to 64; 0 by default) picks the
nth of them, or 0 draws them all. Each circle is a new ellipse with the current paint on top of the current layer,
or of the isolated group, and the circles are selected; inside an isolated compound path they join it. Locked and
hidden shapes given by `ids` are read and left as they are. It is an error, with the document unchanged, when no
circle touches the shapes, when more than 64 do (shapes touched along a whole curve, such as two concentric
circles), when `circle` is past the last one, when `ids` names an object twice, when the shapes lie at one point or
are too small for the radius, above 2,000 segments in all, and when the search for other shapes goes past its
limits. → `{ids, found}` (`found`: how many circles touch the shapes). Tangent Circle… opens a dialog
(`ui.menuDialog {command}`, kind `tangentCircle`) with the radius (used with two shapes selected; 36 pt to start), a
Circle menu (All, or one circle by number, as many as the last preview found) and Preview, which starts on.
- `addon.pathtools.cornerSet {ids?, anchors?, items?, radius, kind?, every?, minAngle?, maxAngle?}` cuts live corners, the ones Direct Selection's
corner widgets and the Corners dialog edit, as one undo step. `ids` (default: the selection) are the paths and
`anchors` the anchor indices of each path's outline with no corners cut; without `anchors`, a path's direct-selected
+4
View File
@@ -2446,6 +2446,10 @@ A VectorCraft addition, so no area score moves. Object › Plug-ins › Cutting
A VectorCraft addition, not a feature of the reference app, so no area score moves. Object › Plug-ins › Path Precision Tools › Divide into Dashes… cuts the selected paths into separate open paths along the curve (arc length, not straight distance): each `dash` long (0.01 to 1000000 pt, 10 by default) with `gap` between them (0 by default: the pieces touch); the gap pieces are left out unless Remove Gaps is off. With direct-selected segments (or anchors) only those runs are divided, the pattern running on across segments that follow one another, and the rest of such a path stays as pieces of its own. Fit to Corners and Ends gives every run between corners and ends a whole number of dashes, all stretched or squeezed alike so it starts and ends on a dash (a closed path without corners holds whole periods); otherwise the lengths are exact and each run's last piece is what is left. Every piece keeps the path's appearance and is selected; one undo step; at most 100000 pieces (more is refused). The dialog takes lengths in any unit and previews on the canvas. Tests: `dashes::tests` in `vectorcraft-pathops` (exact and fitted lengths, curves measured along them, picked segments on open and closed paths, the piece cap and bad patterns), `divide_into_dashes_*` in `cmd::addons::pathtools::tests` in `vectorcraft-engine` (gaps removed or kept, fitted lengths, the stroke kept, one undo step, selected segments only, bad params and too many pieces refused), `divide_into_dashes_opens_its_dialog_previews_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: Tangent Circle (2026-11-15)
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: 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.
+1
View File
@@ -481,6 +481,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 › Set Corners… (also a button in the Anchor Inspector's Corners section: Radius in any unit, Corner kind, Anchors: All, Odd-Numbered or Even-Numbered, counted from each path's first anchor; Angle: from … to …°, only the corners whose sides meet at an angle in that range; Preview) cuts corners on the chosen anchors of every selected path, one undo step | done | #5546, #5545; `addon.pathtools.cornerSet` (`every`, `minAngle`, `maxAngle`), `crates/ui-egui/src/addons/pathtools/set_corners.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 › Trim at Crossings Tool (in the All Tools drawer under the add-on's heading, in neither toolbar as shipped, no shortcut) 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 every stretch its rectangle touches, an Alt-drag every stretch its freehand line crosses; one undo step each; Escape during a drag removes nothing | 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): 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 |