Shapes: the Curvature Circle tool draws the circle a path bends along

The Curvature Circle tool, after the Circle tool in the Ellipse tool's
flyout, draws the circle that touches a path at a point and bends as the
path bends there, with shape.curvatureCircle. The pointer snaps to the
nearest path that is not a guide within 5 screen points, or within the
Smart Guides snapping tolerance when that is larger, and the tool shows
the circle as a dashed outline (solid once it is more than 50,000 screen
points around), its center, a line from the center to the point it
touches and, with Measurement Labels on, its radius. A click draws the
circle in one undo step, on the side the path bends toward; Shift held at
the press puts it on the other side. A press dragged 2 screen points or
more, or canceled with Escape, draws nothing.

A segment that is the usual cubic of a circular arc of 90° or less gives
a circle with the arc's own radius, shown with an asterisk, so a click on
a circle drawn with the Ellipse tool draws that circle. On a straight
segment, at a cusp or a corner anchor, or where the circle would reach
past the canvas, the pointer shows "Straight segment", "Cusp" or "Circle
too large", and a click draws nothing. An anchor is a corner when the
segments meet there at more than half a degree and it is not marked
smooth; segments of no length between them are passed over. The tool's
icon is new and drawn for VectorCraft.

shape.curvatureCircle takes the path, subpath, segment, t and convex, and
returns the circle's center and radius and whether the radius is an
arc's own. A guide is refused.

draw2::candidate_paths skips the selected paths with a hash set, so it
takes time linear in the number of paths on each pointer move.

Part of #7178.
This commit is contained in:
dotCooCoo
2026-11-17 20:18:05 -08:00
parent a5cc189172
commit de29baab11
47 changed files with 1308 additions and 8 deletions
+1
View File
@@ -135,6 +135,7 @@ Generated-in-code art is original and has no file to list. This covers the defau
| `assets/icons/dc-contour.svg` | VectorCraft contributors | Original work, drawn for VectorCraft (a solid rounded square inside four corner arcs, its offset outline); not derived from any other application's icon | MIT OR Apache-2.0 | |
| `assets/icons/dc-crystallize.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/icons/dc-cube.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/icons/dc-curvature-circle.svg` | VectorCraft contributors | Original work, drawn for VectorCraft (an arch with the circle that touches it at its top, and that circle's center) | MIT OR Apache-2.0 | |
| `assets/icons/dc-dash-align.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/icons/dc-dash-exact.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
| `assets/icons/dc-dimension.svg` | Osama Amin | Original work, drawn for VectorCraft: a dimension line with arrowheads between two extension lines | MIT OR Apache-2.0 | |
+1
View File
@@ -137,6 +137,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap
- 2026-11-14: Packaging Tools add-on (Object › Plug-ins › Packaging Tools): fold line roles for dielines (Cut, Crease, Partial Cut, Perforation), each carried by the swatch on a path's top stroke through a per-document role table that native files keep; PDF prints a role line on its swatch's separation when that swatch is a spot color, as the default role swatches are, and SVG, DXF and HP-GL keep the stroke's color. Make Cut Line, Make Crease Line, Make Partial Cut Line and Make Perforation Line give the selected paths a role, overprinting by default, and make a missing role swatch; the Fold Lines panel counts each role in the selection or the document, and its Role Swatches… picks another swatch for a role (`addon.packaging.setRole`, `addon.packaging.roles`, `addon.packaging.setRoleSwatch`). A VectorCraft addition: headline numbers unchanged.
- 2026-11-16: Check Fold Lines in the Packaging Tools add-on (Object › Plug-ins › Packaging Tools, and the Fold Lines panel's Check button): the fold lines of the selection or the document are split into blanks, panels and hinges (cut lines bound the material, and creases, partial cuts and perforations divide it into panels), and 15 kinds of issue are listed, errors and warnings, each naming its lines: cut lines that enclose nothing or end loose, gaps closed within a tolerance, a cut on top of a crease, duplicate lines, creases that end inside a panel, divide nothing, lie outside the blank or are not straight, gaps too narrow to map, fold lines in a hole, panels joined by no crease, and fold lines on a non-printing layer. The panel lists the issues in the interface language; clicking one selects its lines (`addon.packaging.check`). A VectorCraft addition: headline numbers unchanged.
- 2026-11-02: Mouse wheel over a closed font-family field in Character, Properties or Control changes selected text through the family list using saved font filters (excluding search text), one undo step per notch, stopping at the ends (#5253). Scores and estimates unchanged.
- 2026-11-17: Curvature Circle tool (after the Circle tool in its group): a click on a path draws the circle that touches it there and bends as it bends, on the side it bends toward, or with Shift on the other side; a segment that is the usual cubic of a circular arc of 90° or less gives the arc's own radius, so a click on a circle draws that circle; the tool shows the circle, its center and its radius (with an asterisk for an arc's radius) until the click, or "Straight segment", "Cusp" or "Circle too large" where it draws none (`shape.curvatureCircle`). One undo step per circle. A VectorCraft addition: headline numbers unchanged.
- 2026-11-15: Circle through three points: three Shift-clicks with the Ellipse tool, or `shape.circleThroughPoints` with three points or three selected anchor points, draw the circle whose edge passes through them, with the current paint, in one undo step; after two points the tool previews the circle through the pointer, and two points that are the same or three on one line are refused with a message. Scores and estimates unchanged.
- 2026-11-17: Circle tool (after the Ellipse tool in its group): two clicks or a drag draw the circle on that diameter, and a click followed by a drag from a second point to a third draws the circle through the three; Shift keeps the diameter at 45° steps, Alt rounds a two-point circle's diameter to the rulers' ticks at the current zoom, points snap to Smart Guides, and the tool shows the circle, its center, its radii and its diameter until the release, or "Circle too large" for points on one line or a circle past the canvas. `shape.circleThroughPoints` also takes two points or two selected anchor points as the ends of a diameter. One undo step per circle. A VectorCraft addition: headline numbers unchanged.
- 2026-10-31: Pattern libraries: Window › Swatch Libraries › Patterns and the Swatches panel's library menu open Geometric Patterns, a built-in library of eleven pattern swatches (dots, stripes, checks, a grid and shapes); clicking one adds its pattern and swatch to the document, once, and applies it to the active fill or stroke (`swatch.library.add`).
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 19Q12 4 21 19"/><circle cx="12" cy="16.9" r="5.4"/><circle cx="12" cy="16.9" r="1" fill="currentColor"/></svg>

After

Width:  |  Height:  |  Size: 306 B

+57 -2
View File
@@ -1,14 +1,16 @@
//! Creating art: shapes, paths, text.
use serde_json::{Value, json};
use vectorcraft_doc::{Appearance, CharStyle, LiveShape, Node, NodeKind, TextObject};
use vectorcraft_doc::{Appearance, CharStyle, LiveShape, MAX_COORD, Node, NodeKind, TextObject};
use vectorcraft_geom::curvature::{self, NoCircle};
use vectorcraft_geom::{Affine, Anchor, AnchorKind, FillRule, PathData, Point, Rect, SubPath, shapes};
use super::newart::NewArt;
use super::{
CommandSpec, NodeId, Result, Session, bad, bool_or, check_numbers, check_switches, cmd, color_value, f64_or, f64_req, finite_numbers, has_doc,
number_or, str_param, switch_or,
index_opt, number_or, object_param, str_param, switch_or,
};
use crate::EngineError;
pub fn specs() -> Vec<CommandSpec> {
vec![
@@ -66,6 +68,15 @@ pub fn specs() -> Vec<CommandSpec> {
has_doc,
circle_through_points
),
cmd!(
"shape.curvatureCircle",
"Curvature Circle",
[],
None,
"{id, subpath?=0, segment, t: 0..1, convex?=false} → {id, cx, cy, radius, nominal}: a circle with the current paint that touches path `id` at `t` on the segment and bends as the path bends there (its circle of curvature), on the side the path bends toward, or on the other side with convex; a segment that is the usual cubic of a circular arc of 90° or less gives a circle of that arc's own radius (nominal: true), on the concave side the arc's own circle; not pixel-aligned even while Align New Objects to Pixel Grid is on; a straight stretch, a cusp, a corner anchor (t 0 or 1 where two segments meet at an angle of more than half a degree and the anchor is not marked smooth; segments of no length between them are passed over), a guide, or a circle reaching past the canvas is an error, and nothing is drawn",
has_doc,
curvature_circle
),
cmd!("shape.line", "Line Segment", [], None, "{x1, y1, x2, y2, fill?: bool (Fill Line: the current fill, else none)} → {id}", has_doc, line),
cmd!(
"shape.spiral",
@@ -476,6 +487,50 @@ fn selected_anchor_points(s: &Session) -> Result<Option<Vec<Point>>> {
Ok(matches!(points.len(), 2 | 3).then_some(points))
}
/// A live ellipse that touches a path at a point with the path's curvature there
/// ([`curvature::curvature_circle_on`]). One undo step, named as an Ellipse tool drag is.
fn curvature_circle(s: &mut Session, p: &Value) -> Result<Value> {
const C: &str = "shape.curvatureCircle";
let id = object_param(p, "id", C)?.ok_or_else(|| bad(C, "missing id"))?;
let si = index_opt(p, "subpath", C)?.unwrap_or(0);
let seg = index_opt(p, "segment", C)?.ok_or_else(|| bad(C, "missing segment"))?;
let t = f64_req(p, "t", C)?;
if !(0.0..=1.0).contains(&t) {
return Err(bad(C, "`t` must be from 0 to 1"));
}
let convex = switch_or(p, "convex", false, C)?;
let found = {
let st = s.doc()?;
let node = st.doc.node(id).ok_or(EngineError::NoNode(id))?;
if node.is_guide() {
return Err(bad(C, "a guide has no curvature circle"));
}
let path = node.path_data().ok_or_else(|| bad(C, format!("object {id} is not a path")))?;
let sp = path.subpaths.get(si).ok_or_else(|| bad(C, "no such subpath"))?;
if seg >= sp.segment_count() {
return Err(bad(C, "no such segment"));
}
curvature::curvature_circle_on(sp, seg, t, convex)
};
let circle = found.map_err(|e| match e {
NoCircle::Straight => bad(C, "the path is straight there, so no circle matches its curvature"),
NoCircle::Cusp => bad(C, "the path has a cusp there, so it has no single curvature"),
})?;
let (center, radius) = (circle.center, circle.radius);
let r = Rect::new(center.x - radius, center.y - radius, center.x + radius, center.y + radius);
if ![r.x0, r.y0, r.x1, r.y1].iter().all(|v| v.abs() <= MAX_COORD) {
return Err(bad(C, "the circle that matches the path there would reach past the canvas"));
}
let live = LiveShape::Ellipse { w: r.width(), h: r.height(), pie: (0.0, 360.0), xf: Affine::translate(r.origin().to_vec2()) };
// Not pixel-aligned: the circle stays on the path.
let mut out = add_art_unaligned(s, "Ellipse", path_kind(live.to_path(), Some(live)))?;
out["cx"] = json!(center.x);
out["cy"] = json!(center.y);
out["radius"] = json!(radius);
out["nominal"] = json!(circle.nominal);
Ok(out)
}
/// The whole-number count `p` gives for `key` (`5` or `5.0`), or `default` when it is left out or
/// null. A fraction, a negative, a non-finite or a non-number is an error rather than the default.
fn count_or(p: &Value, key: &str, default: u64, cmd: &str) -> Result<u64> {
@@ -549,6 +549,7 @@ pub(super) const ALLOWED: &[&str] = &[
"select.update",
"shape.arc",
"shape.circleThroughPoints",
"shape.curvatureCircle",
"shape.ellipse",
"shape.flare",
"shape.line",
+1
View File
@@ -44,6 +44,7 @@ mod constrain_new;
mod constrain_tools;
mod containers;
mod css;
mod curvature_circle;
mod cut;
mod dashalign;
mod dcs;
+202
View File
@@ -0,0 +1,202 @@
//! `shape.curvatureCircle`: the circle that touches a path at a point and bends as the path bends
//! there, and the Curvature Circle tool that runs it.
use serde_json::{Value, json};
use vectorcraft_doc::LiveShape;
use vectorcraft_geom::{Point, Rect};
use vectorcraft_tools::{Mods, PointerEvent, PointerKind};
use crate::*;
const C: &str = "shape.curvatureCircle";
fn session() -> Session {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap();
s
}
fn undo_len(s: &Session) -> usize {
s.doc().unwrap().history.undo.len()
}
fn object_count(s: &Session) -> usize {
let mut n = 0;
s.doc().unwrap().doc.walk(|_| n += 1);
n
}
fn id_of(v: &Value) -> NodeId {
NodeId(v["id"].as_u64().unwrap())
}
fn center_of(v: &Value) -> Point {
Point::new(v["cx"].as_f64().unwrap(), v["cy"].as_f64().unwrap())
}
/// Whether the geometric bounds of `id` are `want` to within 10⁻⁶ pt.
fn bounds_are(s: &Session, id: NodeId, want: Rect) -> bool {
let b = s.doc().unwrap().doc.bounds_of(&[id], false).unwrap();
[(b.x0, want.x0), (b.y0, want.y0), (b.x1, want.x1), (b.y1, want.y1)].iter().all(|(a, w)| (a - w).abs() < 1e-6)
}
/// A circle of radius 100 centered at (200, 200).
fn circle(s: &mut Session) -> NodeId {
id_of(&s.execute("shape.ellipse", &json!({"x": 100, "y": 100, "width": 200, "height": 200})).unwrap())
}
/// The parabola y = 200 + (x − 200)² / 200 from x = 100 to 300, one cubic: its vertex is at
/// (200, 200), where it bends with radius 100 about (200, 300).
fn parabola(s: &mut Session) -> NodeId {
let (a, b) = (166.666_666_666_666_66, 233.333_333_333_333_34);
let d = format!("M100 250 C{a} 183.333333333333334 {b} 183.333333333333334 300 250");
id_of(&s.execute("path.create", &json!({ "d": d })).unwrap())
}
/// On a circle, the curvature circle is the circle itself: a live ellipse with the current paint,
/// selected, in one undo step. On the other side, it is the same size and touches the circle from
/// outside.
#[test]
fn the_curvature_circle_of_a_circle_is_the_circle() {
let mut s = session();
let path = circle(&mut s);
let (undo, count) = (undo_len(&s), object_count(&s));
for seg in 0..4 {
let v = s.execute(C, &json!({"id": path.0, "segment": seg, "t": 0.5})).unwrap();
assert!(v["nominal"].as_bool().unwrap() && (v["radius"].as_f64().unwrap() - 100.0).abs() < 1e-9, "{v}");
assert!(center_of(&v).distance(Point::new(200.0, 200.0)) < 1e-9, "{v}");
let id = id_of(&v);
assert!(bounds_are(&s, id, Rect::new(100.0, 100.0, 300.0, 300.0)));
let node = s.doc().unwrap().doc.node(id).unwrap().clone();
let vectorcraft_doc::NodeKind::Path { live: Some(live), .. } = &node.kind else { panic!("a live shape: {node:?}") };
assert!(matches!(**live, LiveShape::Ellipse { .. }));
assert_eq!(s.doc().unwrap().selection.objects, vec![id]);
}
assert_eq!((undo_len(&s), object_count(&s)), (undo + 4, count + 4));
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(object_count(&s), count + 3);
let v = s.execute(C, &json!({"id": path.0, "segment": 1, "t": 0.5, "convex": true})).unwrap();
assert!((center_of(&v).distance(Point::new(200.0, 200.0)) - 200.0).abs() < 1e-9 && (v["radius"].as_f64().unwrap() - 100.0).abs() < 1e-9, "{v}");
}
/// At the vertex of a parabola, the circle has the parabola's curvature, radius 100, on the side
/// it bends toward, or on the other side with `convex`.
#[test]
fn the_curvature_circle_at_a_parabola_vertex() {
let mut s = session();
let path = parabola(&mut s);
let v = s.execute(C, &json!({"id": path.0, "segment": 0, "t": 0.5})).unwrap();
assert!(!v["nominal"].as_bool().unwrap() && (v["radius"].as_f64().unwrap() - 100.0).abs() < 1e-6, "{v}");
assert!(center_of(&v).distance(Point::new(200.0, 300.0)) < 1e-6, "{v}");
let v = s.execute(C, &json!({"id": path.0, "segment": 0, "t": 0.5, "convex": true})).unwrap();
assert!(center_of(&v).distance(Point::new(200.0, 100.0)) < 1e-6, "{v}");
}
/// A straight segment, a cusp, a corner anchor and a bend so slight that its circle would reach
/// past the canvas are errors, and nothing is drawn.
#[test]
fn straight_segments_cusps_and_huge_circles_are_refused() {
let mut s = session();
let line = id_of(&s.execute("shape.line", &json!({"x1": 10, "y1": 20, "x2": 130, "y2": 70})).unwrap());
let cusp = id_of(&s.execute("path.create", &json!({"d": "M0 0 C100 100 0 100 100 0"})).unwrap());
let gentle = id_of(&s.execute("path.create", &json!({"d": "M0 0 C100 0.0000001 200 0.0000001 300 0"})).unwrap());
// A curve that meets a line at a corner anchor (150, 0).
let corner = id_of(&s.execute("path.create", &json!({"d": "M0 0 C50 -50 100 -50 150 0 L300 0"})).unwrap());
let (undo, count) = (undo_len(&s), object_count(&s));
for (id, t, want) in [
(line, 0.5, "the path is straight there, so no circle matches its curvature"),
(cusp, 0.5, "the path has a cusp there, so it has no single curvature"),
(corner, 1.0, "the path has a cusp there, so it has no single curvature"),
(gentle, 0.5, "the circle that matches the path there would reach past the canvas"),
] {
let e = s.execute(C, &json!({"id": id.0, "segment": 0, "t": t})).unwrap_err().to_string();
assert!(e.contains(want), "{e}");
}
assert_eq!((undo_len(&s), object_count(&s)), (undo, count));
}
/// Params that are missing or out of range are errors, and nothing is drawn.
#[test]
fn bad_params_are_refused() {
let mut s = session();
let path = circle(&mut s);
let (undo, count) = (undo_len(&s), object_count(&s));
for (p, want) in [
(json!({"segment": 0, "t": 0.5}), "missing id"),
(json!({"id": path.0, "t": 0.5}), "missing segment"),
(json!({"id": path.0, "segment": 0}), "missing number `t`"),
(json!({"id": path.0, "segment": 0, "t": 1.5}), "`t` must be from 0 to 1"),
(json!({"id": path.0, "segment": 0, "t": -0.1}), "`t` must be from 0 to 1"),
(json!({"id": path.0, "segment": 0, "t": "0.5"}), "`t` must be a number"),
(json!({"id": path.0, "segment": 4, "t": 0.5}), "no such segment"),
(json!({"id": path.0, "subpath": 1, "segment": 0, "t": 0.5}), "no such subpath"),
(json!({"id": path.0, "segment": 0, "t": 0.5, "convex": "yes"}), "`convex` must be true or false"),
] {
let e = s.execute(C, &p).unwrap_err().to_string();
assert!(e.contains(want), "{p}: {e}");
}
assert!(s.execute(C, &json!({"id": 9999, "segment": 0, "t": 0.5})).is_err());
assert_eq!((undo_len(&s), object_count(&s)), (undo, count));
}
/// A guide has no curvature circle, as the tool leaves guides out; an error names the command.
#[test]
fn a_guide_is_refused() {
let mut s = session();
let path = circle(&mut s);
s.execute("view.guides.make", &json!({})).unwrap();
assert!(s.doc().unwrap().doc.node(path).unwrap().is_guide());
let (undo, count) = (undo_len(&s), object_count(&s));
let e = s.execute(C, &json!({"id": path.0, "segment": 0, "t": 0.5})).unwrap_err().to_string();
assert!(e.contains("a guide has no curvature circle") && e.contains(C), "{e}");
assert_eq!((undo_len(&s), object_count(&s)), (undo, count));
}
/// With Align New Objects to Pixel Grid on, the circle still touches the path where it was asked:
/// it is not pixel-aligned, so the grid does not move it.
#[test]
fn the_circle_is_not_moved_onto_the_pixel_grid() {
let mut s = session();
s.execute("document.setup", &json!({"alignNewObjectsToPixelGrid": true})).unwrap();
let path = id_of(&s.execute("shape.ellipse", &json!({"x": 100.3, "y": 100.2, "width": 200.4, "height": 200.4})).unwrap());
let v = s.execute(C, &json!({"id": path.0, "segment": 0, "t": 0.5})).unwrap();
let (c, r) = (center_of(&v), v["radius"].as_f64().unwrap());
let id = id_of(&v);
assert!(bounds_are(&s, id, Rect::new(c.x - r, c.y - r, c.x + r, c.y + r)), "{v}");
assert!(!s.doc().unwrap().doc.node(id).unwrap().extras().pixel_aligned);
}
fn view() -> ViewInfo {
ViewInfo { smart_guides: false, ..ViewInfo::default() }
}
fn click(s: &mut Session, mods: Mods, x: f64, y: f64) {
for k in [PointerKind::Move, PointerKind::Down, PointerKind::Up] {
s.pointer(&PointerEvent::new(k, x, y).with_mods(mods), view()).unwrap();
}
}
/// With the Curvature Circle tool, a click on a path draws the circle that matches it there, in
/// one undo step; with Shift, on the other side. A click on a straight line or away from every
/// path draws nothing.
#[test]
fn the_curvature_circle_tool_draws_the_circle_where_it_clicks() {
let mut s = session();
let path = circle(&mut s);
s.execute("shape.line", &json!({"x1": 10, "y1": 380, "x2": 390, "y2": 380})).unwrap();
s.select_tool("curvatureCircle", view()).unwrap();
let (undo, count) = (undo_len(&s), object_count(&s));
click(&mut s, Mods::default(), 301.0, 200.0);
assert_eq!(undo_len(&s), undo + 1);
let id = *s.doc().unwrap().selection.objects.first().unwrap();
assert_ne!(id, path);
assert!(bounds_are(&s, id, Rect::new(100.0, 100.0, 300.0, 300.0)));
let shift = Mods { shift: true, ..Mods::default() };
click(&mut s, shift, 300.0, 200.0);
let id = *s.doc().unwrap().selection.objects.first().unwrap();
assert!(bounds_are(&s, id, Rect::new(300.0, 100.0, 500.0, 300.0)));
assert_eq!(object_count(&s), count + 2);
click(&mut s, Mods::default(), 200.0, 381.0);
click(&mut s, Mods::default(), 20.0, 20.0);
assert_eq!((undo_len(&s), object_count(&s)), (undo + 2, count + 2));
}
+369
View File
@@ -0,0 +1,369 @@
//! The circle that touches a curve at one of its points with the curve's curvature there (its
//! osculating circle): the circle the curve bends along at that point.
use kurbo::{CubicBez, ParamCurve, ParamCurveDeriv, Point, Vec2};
use crate::{AnchorKind, SubPath};
/// Why no circle matches a curve at a point.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum NoCircle {
/// The curve is straight there (a straight segment, or the turn of an S curve): the circle
/// would have no end.
Straight,
/// The curve has no single direction there: a cusp, a handle drawn back onto its anchor, or a
/// segment with no length.
Cusp,
}
/// The circle that touches a curve at one point and bends as the curve does there.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CurvatureCircle {
/// The point where the circle touches the curve.
pub at: Point,
pub center: Point,
pub radius: f64,
/// The segment is the usual cubic of a circular arc of 90° or less ([`circular_arc`]), and the
/// circle has that arc's own radius rather than the cubic's curvature at the point.
pub nominal: bool,
}
/// Largest turn (radians) of an arc that [`circular_arc`] takes: a quarter turn.
const MAX_ARC: f64 = std::f64::consts::FRAC_PI_2 * (1.0 + 1e-9);
/// How far apart (as a share of the radius) the arc's two ends may lie from its center.
const RADIUS_TOL: f64 = 1e-4;
/// How far each handle's length may differ from the circular arc's (as a share of it).
const HANDLE_TOL: f64 = 1e-3;
/// Below this sine of the angle between the curve's first two derivatives, the curve is straight.
const STRAIGHT_SIN: f64 = 1e-10;
/// Below this share of the control polygon's length, the curve's direction is not defined.
const CUSP_SHARE: f64 = 1e-9;
/// The largest turn (radians) at an anchor not marked smooth that still counts as smooth: half a
/// degree, which takes in handles rounded to a few decimals in imported files.
const SMOOTH_TURN: f64 = 0.5 * std::f64::consts::PI / 180.0;
/// The circle that touches segment `c` at `t` (0 to 1) with its curvature there, on the side the
/// segment bends toward, or on the other side with `convex`. A segment that is the usual cubic of
/// a circular arc of 90° or less gives the circle of that arc: on the concave side it is the arc's
/// own circle, and it touches the arc's circle at the point nearest `c` at `t`. A `t` outside 0 to
/// 1 and a segment whose points are not finite give [`NoCircle::Cusp`].
pub fn curvature_circle(c: CubicBez, t: f64, convex: bool) -> Result<CurvatureCircle, NoCircle> {
let finite = [c.p0, c.p1, c.p2, c.p3].iter().all(|p| p.is_finite());
if !finite || !(0.0..=1.0).contains(&t) {
return Err(NoCircle::Cusp);
}
let at = c.eval(t);
let (center, radius, nominal) = match circular_arc(c) {
Some((center, radius)) => {
let out = at - center;
let len = out.hypot();
if len == 0.0 || !len.is_finite() {
return Err(NoCircle::Cusp);
}
// The point of the arc's circle nearest `at`: the circle touches the segment there.
let on = center + out * (radius / len);
let center = if convex { on + (on - center) } else { center };
return Ok(CurvatureCircle { at: on, center, radius, nominal: true });
}
None => {
let (center, radius) = osculating(c, t)?;
(center, radius, false)
}
};
let center = if convex { at + (at - center) } else { center };
Ok(CurvatureCircle { at, center, radius, nominal })
}
/// [`curvature_circle`] at `t` on segment `seg` of `sp`. At an end of the segment where it meets
/// the next or previous segment at a corner, the path has no single direction: that is a
/// [`NoCircle::Cusp`], and so is a segment `sp` lacks. Segments with no length between the two are
/// passed over. The anchor is smooth when it is marked smooth, or when the two segments leave it
/// within [`SMOOTH_TURN`] of one direction.
pub fn curvature_circle_on(sp: &SubPath, seg: usize, t: f64, convex: bool) -> Result<CurvatureCircle, NoCircle> {
let n = sp.segment_count();
if seg >= n {
return Err(NoCircle::Cusp);
}
let c = sp.segment(seg);
let corner = if t == 0.0 {
neighbor(sp, seg, false).is_some_and(|(prev, skipped)| !smooth(sp, seg, skipped, end_direction(prev), start_direction(c)))
} else if t == 1.0 {
neighbor(sp, seg, true).is_some_and(|(next, skipped)| !smooth(sp, (seg + 1) % n, skipped, end_direction(c), start_direction(next)))
} else {
false
};
if corner {
return Err(NoCircle::Cusp);
}
curvature_circle(c, t, convex)
}
/// The nearest segment with length before (or with `forward`, after) segment `seg`, and whether
/// segments with no length lay between; `None` at an open end of the subpath.
fn neighbor(sp: &SubPath, seg: usize, forward: bool) -> Option<(CubicBez, bool)> {
let n = sp.segment_count();
for k in 1..n {
let i = if forward { (seg + k < n || sp.closed).then(|| (seg + k) % n)? } else { (seg >= k || sp.closed).then(|| (seg + n - k) % n)? };
let s = sp.segment(i);
if start_direction(s) != Vec2::ZERO {
return Some((s, k > 1));
}
}
None
}
/// Is the join at anchor `anchor` smooth: marked smooth (with no segment of no length passed
/// over), or the directions `a` into it and `b` out of it the same within [`SMOOTH_TURN`]?
fn smooth(sp: &SubPath, anchor: usize, skipped: bool, a: Vec2, b: Vec2) -> bool {
let marked = !skipped && sp.anchors.get(anchor).is_some_and(|an| an.kind == AnchorKind::Smooth && an.has_in() && an.has_out());
let (la, lb) = (a.hypot(), b.hypot());
marked || (la > 0.0 && lb > 0.0 && a.dot(b) > 0.0 && a.cross(b).abs() <= SMOOTH_TURN.sin() * la * lb)
}
/// The direction a segment leaves its first anchor in: toward its first control point that is
/// not on that anchor; zero for a segment with no length.
fn start_direction(c: CubicBez) -> Vec2 {
[c.p1 - c.p0, c.p2 - c.p0, c.p3 - c.p0].into_iter().find(|v| v.hypot() > 0.0).unwrap_or_default()
}
/// The direction a segment reaches its last anchor in, as [`start_direction`] finds it.
fn end_direction(c: CubicBez) -> Vec2 {
[c.p3 - c.p2, c.p3 - c.p1, c.p3 - c.p0].into_iter().find(|v| v.hypot() > 0.0).unwrap_or_default()
}
/// The center and radius of the circle of curvature of `c` at `t`.
fn osculating(c: CubicBez, t: f64) -> Result<(Point, f64), NoCircle> {
let polygon = c.p0.distance(c.p1) + c.p1.distance(c.p2) + c.p2.distance(c.p3);
let d = c.deriv().eval(t).to_vec2();
let dd = c.deriv().deriv().eval(t).to_vec2();
let speed = d.hypot();
if polygon <= 0.0 || !polygon.is_finite() {
return Err(NoCircle::Cusp);
}
// All four control points on one line: a straight segment, whatever its handles.
let (v1, v2, v3) = (c.p1 - c.p0, c.p2 - c.p0, c.p3 - c.p0);
if [v1.cross(v2), v1.cross(v3), v2.cross(v3)].iter().all(|a| a.abs() <= 1e-12 * polygon * polygon) {
return Err(NoCircle::Straight);
}
if speed <= CUSP_SHARE * polygon {
return Err(NoCircle::Cusp);
}
let cross = d.cross(dd);
if cross.abs() <= STRAIGHT_SIN * speed * dd.hypot().max(polygon) {
return Err(NoCircle::Straight);
}
// The center lies along the normal toward the side the curve turns to, `|d|² / cross` of the
// normal `(-d.y, d.x)` away: its length is the radius, `|d|³ / |cross|`.
let center = c.eval(t) + Vec2::new(-d.y, d.x) * (d.hypot2() / cross);
let radius = speed.powi(3) / cross.abs();
if !center.is_finite() || !radius.is_finite() {
return Err(NoCircle::Straight);
}
Ok((center, radius))
}
/// The center and radius of the circular arc `c` draws, when it is the usual cubic of an arc of
/// 90° or less: its two ends are the same distance from the point where the lines square to its
/// handles meet, and each handle is `4/3 · tan(θ/4)` of the radius long for an arc of θ, pointing
/// along the arc.
pub fn circular_arc(c: CubicBez) -> Option<(Point, f64)> {
let (d0, d3, chord) = (c.p1 - c.p0, c.p3 - c.p2, c.p3 - c.p0);
let (l0, l3) = (d0.hypot(), d3.hypot());
let usable = |v: f64| v.is_finite() && v != 0.0;
if !usable(l0) || !usable(l3) || !usable(chord.hypot()) || d0.dot(chord) <= 0.0 || d3.dot(chord) <= 0.0 {
return None;
}
// The ends' normals: p0 + s·n0 = p3 + u·n3.
let (n0, n3) = (Vec2::new(-d0.y, d0.x), Vec2::new(-d3.y, d3.x));
let den = n0.cross(n3);
if den.abs() <= 1e-12 * l0 * l3 {
return None;
}
let center = c.p0 + n0 * (chord.cross(n3) / den);
let (r0, r3) = (c.p0.distance(center), c.p3.distance(center));
let radius = (r0 + r3) / 2.0;
if !center.is_finite() || !usable(radius) || (r0 - r3).abs() > RADIUS_TOL * radius {
return None;
}
let (a, b) = (c.p0 - center, c.p3 - center);
let turn = a.cross(b).abs().atan2(a.dot(b));
if turn.is_nan() || turn <= 0.0 || turn > MAX_ARC {
return None;
}
let handle = 4.0 / 3.0 * (turn / 4.0).tan() * radius;
((l0 - handle).abs() <= HANDLE_TOL * handle && (l3 - handle).abs() <= HANDLE_TOL * handle).then_some((center, radius))
}
#[cfg(test)]
mod tests {
use super::*;
use crate::{Anchor, shapes};
use kurbo::Rect;
/// Every segment of a circle drawn by [`shapes::ellipse`] is the usual cubic of a quarter
/// turn, and the circle at any point of it is the circle itself: radius 100, center (150, 150).
#[test]
fn the_curvature_circle_of_a_circle_is_the_circle() {
let pd = shapes::ellipse(Rect::new(50.0, 50.0, 250.0, 250.0));
let sp = &pd.subpaths[0];
for seg in 0..sp.segment_count() {
for t in [0.0, 0.3, 0.5, 1.0] {
let got = curvature_circle(sp.segment(seg), t, false).unwrap();
assert!(got.nominal, "{seg} {t}");
assert!((got.radius - 100.0).abs() < 1e-9 && got.center.distance(Point::new(150.0, 150.0)) < 1e-9, "{seg} {t}: {got:?}");
assert!((got.at.distance(got.center) - 100.0).abs() < 1e-9, "the circle touches on its own edge");
}
}
}
/// The cubic's own radius of curvature on a quarter circle's segment is about 2.2% larger than
/// the circle's at its ends and 0.6% larger at its middle: the nominal radius is the circle's.
#[test]
fn a_circle_segment_bends_near_its_radius() {
let pd = shapes::ellipse(Rect::new(-100.0, -100.0, 100.0, 100.0));
let seg = pd.subpaths[0].segment(0);
for t in [0.0, 0.5, 1.0] {
let (center, r) = osculating(seg, t).unwrap();
assert!((r - 100.0).abs() < 2.5 && center.distance(Point::ORIGIN) < 2.5, "{t}: {center:?} {r}");
}
}
/// On the parabola y = x² / 200, the curvature at its vertex is 1/100: drawn as a cubic from
/// (-100, 50) to (100, 50), the circle at the middle has radius 100 and center (0, 100), above
/// the curve on the side it bends toward; Shift's other side puts the center at (0, -100).
#[test]
fn the_curvature_circle_at_a_parabola_vertex() {
// The quadratic (-100, 50), (0, -50), (100, 50) raised to a cubic.
let (p0, q, p3) = (Point::new(-100.0, 50.0), Point::new(0.0, -50.0), Point::new(100.0, 50.0));
let c = CubicBez::new(p0, p0 + (q - p0) * (2.0 / 3.0), p3 + (q - p3) * (2.0 / 3.0), p3);
assert_eq!(circular_arc(c), None);
let got = curvature_circle(c, 0.5, false).unwrap();
assert!(!got.nominal && got.at.distance(Point::ORIGIN) < 1e-9, "{got:?}");
assert!((got.radius - 100.0).abs() < 1e-9 && got.center.distance(Point::new(0.0, 100.0)) < 1e-9, "{got:?}");
let other = curvature_circle(c, 0.5, true).unwrap();
assert!((other.radius - 100.0).abs() < 1e-9 && other.center.distance(Point::new(0.0, -100.0)) < 1e-9, "{other:?}");
}
/// A straight segment, with its handles on its line or on its anchors, and the
/// turning point of an S curve have no curvature circle.
#[test]
fn a_straight_segment_has_no_circle() {
let (a, b) = (Point::new(10.0, 20.0), Point::new(130.0, 70.0));
let on_line = CubicBez::new(a, a.lerp(b, 0.3), a.lerp(b, 0.7), b);
assert_eq!(curvature_circle(on_line, 0.4, false), Err(NoCircle::Straight));
// A line's handles sit on its anchors: straight at its ends too.
for t in [0.0, 0.5, 1.0] {
assert_eq!(curvature_circle(CubicBez::new(a, a, b, b), t, false), Err(NoCircle::Straight), "{t}");
}
let s = CubicBez::new(Point::new(0.0, 0.0), Point::new(50.0, 50.0), Point::new(50.0, -50.0), Point::new(100.0, 0.0));
assert_eq!(curvature_circle(s, 0.5, false), Err(NoCircle::Straight));
assert!(curvature_circle(s, 0.25, false).is_ok());
}
/// A cusp, a handle drawn back onto its anchor at that end, a segment with no length, points
/// that are not finite and a `t` outside 0 to 1 have no curvature circle.
#[test]
fn a_cusp_has_no_circle() {
let cusp = CubicBez::new(Point::new(0.0, 0.0), Point::new(100.0, 100.0), Point::new(0.0, 100.0), Point::new(100.0, 0.0));
assert_eq!(curvature_circle(cusp, 0.5, false), Err(NoCircle::Cusp));
let p = Point::new(5.0, 5.0);
let retracted = CubicBez::new(Point::new(0.0, 0.0), Point::new(0.0, 0.0), Point::new(60.0, 40.0), Point::new(100.0, 0.0));
assert_eq!(curvature_circle(retracted, 0.0, false), Err(NoCircle::Cusp));
assert_eq!(curvature_circle(CubicBez::new(p, p, p, p), 0.5, false), Err(NoCircle::Cusp));
let far = CubicBez::new(Point::new(f64::NAN, 0.0), p, p, Point::new(9.0, 0.0));
assert_eq!(curvature_circle(far, 0.5, false), Err(NoCircle::Cusp));
for t in [-0.1, 1.5, f64::NAN] {
assert_eq!(curvature_circle(cusp, t, false), Err(NoCircle::Cusp), "{t}");
}
}
/// At an anchor where a curve meets a line at a corner, the path has no single direction, from
/// either segment; at a smooth anchor of a circle, and at the open ends of a path, the circle is
/// drawn. A segment the subpath lacks has none.
#[test]
fn a_corner_anchor_has_no_circle() {
let bp = kurbo::BezPath::from_svg("M0 0 C50 -50 100 -50 150 0 L300 0").unwrap();
let sp = &crate::PathData::from_bezpath(&bp).subpaths[0];
assert_eq!(curvature_circle_on(sp, 0, 1.0, false), Err(NoCircle::Cusp));
assert_eq!(curvature_circle_on(sp, 1, 0.0, false), Err(NoCircle::Cusp));
assert_eq!(curvature_circle_on(sp, 1, 0.5, false), Err(NoCircle::Straight));
assert!(curvature_circle_on(sp, 0, 0.0, false).is_ok() && curvature_circle_on(sp, 0, 0.5, false).is_ok());
assert_eq!(curvature_circle_on(sp, 2, 0.5, false), Err(NoCircle::Cusp));
let circle = &shapes::ellipse(Rect::new(0.0, 0.0, 100.0, 100.0)).subpaths[0];
for seg in 0..4 {
for t in [0.0, 1.0] {
assert!(curvature_circle_on(circle, seg, t, false).is_ok_and(|c| c.nominal), "{seg} {t}");
}
}
// A closed triangle of curves: the anchor where the last segment meets the first is a corner.
let bp = kurbo::BezPath::from_svg("M0 0 C10 -10 90 -10 100 0 C110 10 60 90 50 100 C40 90 -10 30 0 0 Z").unwrap();
let tri = &crate::PathData::from_bezpath(&bp).subpaths[0];
assert!(tri.closed);
assert_eq!(curvature_circle_on(tri, 0, 0.0, false), Err(NoCircle::Cusp));
}
/// A segment with no length between a curve and a line, or a closed subpath whose last anchor
/// repeats its first, still leaves a corner there: the segments with no length are passed over.
#[test]
fn a_corner_behind_a_segment_with_no_length_has_no_circle() {
let (a, b, c) = (Point::new(0.0, 0.0), Point::new(150.0, 0.0), Point::new(300.0, 0.0));
let curve_in = Anchor::with_handles(b, Point::new(100.0, -50.0), b);
let open = SubPath::new(vec![Anchor::with_handles(a, a, Point::new(50.0, -50.0)), curve_in, Anchor::corner(b), Anchor::corner(c)], false);
assert_eq!(curvature_circle_on(&open, 0, 1.0, false), Err(NoCircle::Cusp));
assert_eq!(curvature_circle_on(&open, 2, 0.0, false), Err(NoCircle::Cusp), "from the line's side too");
assert_eq!(curvature_circle_on(&open, 2, 0.5, false), Err(NoCircle::Straight));
// A closed triangle of curves drawn back to its first anchor before it closes.
let tri = SubPath::new(
vec![
Anchor::with_handles(a, a, Point::new(10.0, -10.0)),
Anchor::with_handles(Point::new(100.0, 0.0), Point::new(90.0, -10.0), Point::new(110.0, 10.0)),
Anchor::with_handles(Point::new(50.0, 100.0), Point::new(60.0, 90.0), Point::new(40.0, 90.0)),
Anchor::with_handles(a, Point::new(-10.0, 30.0), a),
],
true,
);
assert_eq!(tri.segment_count(), 4);
assert_eq!(curvature_circle_on(&tri, 0, 0.0, false), Err(NoCircle::Cusp));
assert_eq!(curvature_circle_on(&tri, 2, 1.0, false), Err(NoCircle::Cusp));
}
/// An anchor whose handles turn by a thousandth of a radian, as rounded coordinates leave them,
/// is smooth; one marked smooth is smooth whatever its handles; a turn of 2° is a corner.
#[test]
fn a_nearly_smooth_or_marked_smooth_anchor_has_a_circle() {
let mid = |out_x: f64, kind: AnchorKind| {
let p = Point::new(100.0, 0.0);
let mut an = Anchor::with_handles(p, Point::new(100.0, -50.0), Point::new(out_x, 50.0));
an.kind = kind;
let ends = |q: Point, h: Point| Anchor::with_handles(q, h, h);
SubPath::new(vec![ends(Point::new(0.0, 0.0), Point::new(0.0, -50.0)), an, ends(Point::new(0.0, 100.0), Point::new(0.0, 150.0))], false)
};
let rounded = mid(100.05, AnchorKind::Corner);
assert!(curvature_circle_on(&rounded, 0, 1.0, false).is_ok() && curvature_circle_on(&rounded, 1, 0.0, false).is_ok());
let turned = 50.0 * 2f64.to_radians().tan();
assert_eq!(curvature_circle_on(&mid(100.0 - turned, AnchorKind::Corner), 0, 1.0, false), Err(NoCircle::Cusp));
assert!(curvature_circle_on(&mid(100.0 - turned, AnchorKind::Smooth), 0, 1.0, false).is_ok());
}
/// An arc's cubic is taken only up to a quarter turn, with both ends on one circle and handles
/// of the arc's length: a third of a circle, a circle squashed into an ellipse and handles 1%
/// too long give the cubic's own curvature.
#[test]
fn only_a_true_arc_of_a_quarter_turn_or_less_is_nominal() {
let arc = |deg: f64, r: f64, stretch: f64, handle: f64| {
let th = deg.to_radians();
let k = 4.0 / 3.0 * (th / 4.0).tan() * r * handle;
let (p0, p3) = (Point::new(r, 0.0), Point::new(r * th.cos() * stretch, r * th.sin()));
CubicBez::new(p0, p0 + Vec2::new(0.0, k), p3 + Vec2::new(th.sin(), -th.cos()) * k, p3)
};
let (center, r) = circular_arc(arc(60.0, 50.0, 1.0, 1.0)).unwrap();
assert!(center.distance(Point::ORIGIN) < 1e-9 && (r - 50.0).abs() < 1e-9);
assert!(circular_arc(arc(90.0, 50.0, 1.0, 1.0)).is_some());
assert_eq!(circular_arc(arc(120.0, 50.0, 1.0, 1.0)), None);
assert_eq!(circular_arc(arc(60.0, 50.0, 1.1, 1.0)), None);
assert_eq!(circular_arc(arc(60.0, 50.0, 1.0, 1.01)), None);
// On the convex side, the circle touches the arc's circle from outside.
let c = curvature_circle(arc(60.0, 50.0, 1.0, 1.0), 0.0, true).unwrap();
assert!(c.nominal && c.center.distance(Point::new(100.0, 0.0)) < 1e-9 && (c.radius - 50.0).abs() < 1e-9, "{c:?}");
}
}
+1
View File
@@ -11,6 +11,7 @@ pub mod anchors;
pub mod arc;
pub mod bez;
pub mod corners;
pub mod curvature;
pub mod hit;
pub mod path;
pub mod projective;
+1
View File
@@ -57,6 +57,7 @@ pub const TOOL_GROUPS: &[&[ToolInfo]] = &[
t("roundedRectangle", "Rounded Rectangle Tool", None, "tool-rounded-rect"),
t("ellipse", "Ellipse Tool", Some("L"), "tool-ellipse"),
t(crate::circle::ID, "Circle Tool", None, "tool-circle"),
t(crate::curvature_circle::ID, "Curvature Circle Tool", None, "tool-curvature-circle"),
t("polygon", "Polygon Tool", None, "tool-polygon"),
t("star", "Star Tool", None, "tool-star"),
t("flare", "Flare Tool", None, "tool-flare"),
+221
View File
@@ -0,0 +1,221 @@
//! The Curvature Circle tool draws the circle that touches a path at a point and bends as the path
//! bends there (`shape.curvatureCircle`).
//!
//! The pointer snaps to the nearest path within 5 screen points, or within Smart Guides › Snapping
//! Tolerance when that is larger, and the tool shows the circle that matches the path there: a
//! dashed outline (solid once it is more than 50,000 screen points around), its center as a small
//! cross, a line from the center to the point it touches and, with Measurement Labels on, its
//! radius by the pointer, with an asterisk when the segment is the usual cubic of a circular arc
//! of 90° or less and the circle has the arc's own radius. A click draws it, in one undo step, and a
//! press dragged 2 screen points or more, or canceled with Escape, draws nothing. The circle goes on the side the path bends
//! toward; with Shift held at the press, on the other side. On a straight stretch, at a cusp or a
//! corner, or where the circle would reach past the canvas, the pointer shows "Straight segment",
//! "Cusp" or "Circle too large" instead, and a click draws nothing.
use serde_json::json;
use vectorcraft_doc::{MAX_COORD, NodeId};
use vectorcraft_geom::curvature::{CurvatureCircle, NoCircle, curvature_circle_on};
use vectorcraft_geom::{Point, Rect, Vec2, shapes};
use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, ToolContext, ToolKey};
pub const ID: &str = "curvatureCircle";
/// How near (screen points) a path pulls the pointer, unless the Smart Guides' snapping tolerance
/// is larger.
const SNAP_PX: f64 = 5.0;
/// How far (screen points) the pointer travels from a press before the press counts as a drag.
const DRAG_PX: f64 = 2.0;
/// Half the length (screen points) of each arm of the cross at the circle's center.
const CROSS_PX: f64 = 4.0;
/// The longest outline (screen points) the preview draws dashed, about 7,000 dashes.
const DASHED_PX: f64 = 50_000.0;
/// The point of a path the pointer snapped to: the path, subpath, segment and `t` on it.
#[derive(Clone, Copy, Debug, PartialEq)]
struct Hit {
id: NodeId,
subpath: usize,
segment: usize,
t: f64,
}
/// What the tool shows at a hit.
enum Found {
Circle(CurvatureCircle),
/// The pointer's text, and where the path is.
Refused(&'static str, Point),
}
#[derive(Default)]
pub struct CurvatureCircleTool {
/// The point under the pointer, and whether Shift was held.
hover: Option<(Hit, bool)>,
/// The press in progress, where the pointer was pressed: what a release draws.
press: Option<(Hit, bool)>,
from: Point,
}
/// The nearest point within reach of `p` on the paths a click can pick, guides left out; of paths
/// at the same distance, a selected one, then the one on top.
fn hit_at(cx: &ToolContext, p: Point) -> Option<Hit> {
let tol = cx.tol(SNAP_PX).max(cx.snap_tol());
let mut best: Option<(Hit, f64)> = None;
for id in crate::draw2::candidate_paths(cx) {
let Some(pd) = cx.doc.node(id).filter(|n| !n.is_guide()).and_then(|n| n.path_data()) else { continue };
// A path whose control points' box lies out of reach holds no point within reach.
if pd.control_bounds().is_none_or(|b| !b.inflate(tol, tol).contains(p)) {
continue;
}
if let Some((subpath, segment, t, _, d)) = pd.nearest(p)
&& d <= tol
&& best.is_none_or(|(_, b)| d < b)
{
best = Some((Hit { id, subpath, segment, t }, d));
}
}
best.map(|(hit, _)| hit)
}
/// The circle at `hit` as `shape.curvatureCircle` draws it, or why it draws none; `None` when the
/// path or segment is gone.
fn found(cx: &ToolContext, hit: Hit, convex: bool) -> Option<Found> {
let sp = cx.doc.node(hit.id)?.path_data()?.subpaths.get(hit.subpath)?;
if hit.segment >= sp.segment_count() {
return None;
}
let at = vectorcraft_geom::ParamCurve::eval(&sp.segment(hit.segment), hit.t);
Some(match curvature_circle_on(sp, hit.segment, hit.t, convex) {
Ok(c) if on_canvas(&c) => Found::Circle(c),
Ok(_) => Found::Refused("Circle too large", at),
Err(NoCircle::Straight) => Found::Refused("Straight segment", at),
Err(NoCircle::Cusp) => Found::Refused("Cusp", at),
})
}
/// Does the circle stay on the canvas?
fn on_canvas(c: &CurvatureCircle) -> bool {
let (p, r) = (c.center, c.radius);
[p.x - r, p.y - r, p.x + r, p.y + r].iter().all(|v| v.abs() <= MAX_COORD)
}
impl Tool for CurvatureCircleTool {
fn id(&self) -> &'static str {
ID
}
fn pointer(&mut self, cx: &ToolContext, ev: &PointerEvent) -> Vec<Action> {
if !ev.pos.is_finite() {
return vec![];
}
match ev.kind {
PointerKind::Move => {
self.hover = hit_at(cx, ev.pos).map(|h| (h, ev.mods.shift));
vec![]
}
PointerKind::Down => {
self.press = hit_at(cx, ev.pos).map(|h| (h, ev.mods.shift));
self.hover = self.press;
self.from = ev.pos;
vec![]
}
// A drag is not a click: the release draws nothing.
PointerKind::Drag => {
if ev.pos.distance(self.from) >= cx.tol(DRAG_PX) {
self.press = None;
self.hover = None;
}
vec![]
}
PointerKind::Up => {
let press = self.press.take();
self.hover = hit_at(cx, ev.pos).map(|h| (h, ev.mods.shift));
let Some((hit, convex)) = press else { return vec![] };
if ev.pos.distance(self.from) >= cx.tol(DRAG_PX) || !matches!(found(cx, hit, convex), Some(Found::Circle(_))) {
return vec![];
}
let p = json!({"id": hit.id.0, "subpath": hit.subpath, "segment": hit.segment, "t": hit.t, "convex": convex});
vec![Action::Exec("shape.curvatureCircle".into(), p)]
}
PointerKind::DoubleClick | PointerKind::TripleClick => vec![],
}
}
/// Escape during a press cancels it: the release draws nothing.
fn key(&mut self, _cx: &ToolContext, key: ToolKey, _mods: Mods) -> Vec<Action> {
if key == ToolKey::Escape && self.press.take().is_some() {
self.hover = None;
}
vec![]
}
fn claims_key(&self, _cx: &ToolContext, key: ToolKey) -> bool {
key == ToolKey::Escape && self.press.is_some()
}
/// A dropped press (a second finger, a canceled touch) draws nothing.
fn drop_press(&mut self, _cx: &ToolContext) -> Vec<Action> {
self.press = None;
vec![]
}
/// The circle shown depends on the path under the pointer, which an edit, an undo or a zoom
/// (the reach is in screen points) changes.
fn wants_rehover(&self) -> bool {
true
}
fn deactivate(&mut self, _cx: &ToolContext) -> Vec<Action> {
self.hover = None;
self.press = None;
vec![]
}
fn hover_ended(&mut self, _cx: &ToolContext) {
if self.press.is_none() {
self.hover = None;
}
}
/// An edit, Undo or Redo made outside the tool, or another document, may move or remove the
/// path under the pointer.
fn history_moved(&mut self) {
self.hover = None;
self.press = None;
}
fn overlays(&self, cx: &ToolContext) -> Vec<Overlay> {
let Some((hit, convex)) = self.hover else { return vec![] };
let color = crate::draw2::FEEDBACK;
let mut o = vec![];
match found(cx, hit, convex) {
Some(Found::Circle(c)) => {
let r = c.radius;
let path = shapes::ellipse(Rect::new(c.center.x - r, c.center.y - r, c.center.x + r, c.center.y + r)).to_bezpath();
// The canvas draws a dashed outline dash by dash along its whole length: a circle
// longer than DASHED_PX on screen is drawn solid instead.
let dashed = std::f64::consts::TAU * r <= cx.tol(DASHED_PX);
o.push(Overlay::Path { path, color, width: 1.0, dashed });
o.push(Overlay::Line { a: c.center, b: c.at, color, dashed: false });
let arm = cx.tol(CROSS_PX);
o.push(Overlay::Line { a: c.center - Vec2::new(arm, 0.0), b: c.center + Vec2::new(arm, 0.0), color, dashed: false });
o.push(Overlay::Line { a: c.center - Vec2::new(0.0, arm), b: c.center + Vec2::new(0.0, arm), color, dashed: false });
o.push(Overlay::Anchor { p: c.at, color, filled: true, size: 6.0 });
if cx.measurement_labels {
let star = if c.nominal { "*" } else { "" };
o.push(Overlay::Measure { p: c.at + Vec2::new(cx.tol(12.0), cx.tol(12.0)), text: format!("R: {}{star}", cx.len(r)) });
}
}
Some(Found::Refused(text, at)) => o.push(Overlay::Label { p: at, text: text.into(), color }),
None => {}
}
o
}
fn cursor(&self, _cx: &ToolContext, _p: Point, _mods: Mods) -> Cursor {
Cursor::Crosshair
}
}
#[cfg(test)]
mod tests;
+255
View File
@@ -0,0 +1,255 @@
use super::*;
use crate::testutil::*;
use vectorcraft_doc::{Appearance, Document, Node, Selection};
use vectorcraft_geom::PathData;
fn ev(kind: PointerKind, (x, y): (f64, f64), mods: Mods) -> PointerEvent {
PointerEvent::new(kind, x, y).with_mods(mods)
}
/// A document holding `paths`, the first one on top.
fn doc_with(paths: &[PathData]) -> Document {
let mut d = Document::new(500.0, 500.0);
let l = d.layers[0].id;
for path in paths.iter().rev() {
let id = d.alloc_id();
d.insert(Some(l), usize::MAX, Node::path(id, path.clone(), Appearance::default_art())).unwrap();
}
d
}
/// A circle of radius 100 centered at (200, 200).
fn circle() -> PathData {
shapes::ellipse(Rect::new(100.0, 100.0, 300.0, 300.0))
}
fn click(t: &mut CurvatureCircleTool, cx: &ToolContext, p: (f64, f64), mods: Mods) -> Vec<Action> {
let mut acts = t.pointer(cx, &ev(PointerKind::Move, p, mods));
acts.extend(t.pointer(cx, &ev(PointerKind::Down, p, mods)));
acts.extend(t.pointer(cx, &ev(PointerKind::Up, p, mods)));
acts
}
/// The one command `acts` runs: its params.
fn params(acts: &[Action]) -> serde_json::Value {
let [Action::Exec(c, v)] = acts else { panic!("one command: {acts:?}") };
assert_eq!(c, "shape.curvatureCircle");
v.clone()
}
/// The dashed circle the tool shows: its bounding box.
fn preview(o: &[Overlay]) -> Option<Rect> {
o.iter().find_map(|o| match o {
Overlay::Path { path, dashed: true, .. } => Some(vectorcraft_geom::Shape::bounding_box(path)),
_ => None,
})
}
fn near(a: Rect, b: Rect) -> bool {
[(a.x0, b.x0), (a.y0, b.y0), (a.x1, b.x1), (a.y1, b.y1)].iter().all(|(p, q)| (p - q).abs() < 1e-9)
}
fn label(o: &[Overlay]) -> Option<String> {
o.iter().find_map(|o| match o {
Overlay::Label { text, .. } => Some(text.clone()),
_ => None,
})
}
/// Over a circle, the tool shows the circle itself, its center, the radius to the point it touches
/// and "R: 100 pt*" (an arc's own radius); a click draws it on the point of the path nearest the
/// pointer.
#[test]
fn a_click_on_a_circle_draws_the_circle_that_matches_it() {
let d = doc_with(&[circle()]);
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = CurvatureCircleTool::default();
t.pointer(&cx, &ev(PointerKind::Move, (302.0, 200.0), Mods::default()));
let o = t.overlays(&cx);
assert!(near(preview(&o).expect("the circle is shown"), Rect::new(100.0, 100.0, 300.0, 300.0)), "{o:?}");
let center = Point::new(200.0, 200.0);
assert!(o.iter().any(|o| matches!(o, Overlay::Line { a, b, .. } if *a == center && b.distance(Point::new(300.0, 200.0)) < 1e-9)), "{o:?}");
assert!(o.iter().any(|o| matches!(o, Overlay::Measure { text, .. } if text.starts_with("R: 100") && text.ends_with('*'))), "{o:?}");
let without_labels = ToolContext { measurement_labels: false, ..cx };
assert!(!t.overlays(&without_labels).iter().any(|o| matches!(o, Overlay::Measure { .. })));
let v = params(&click(&mut t, &cx, (302.0, 200.0), Mods::default()));
assert_eq!(v["convex"], json!(false));
let id = d.layers[0].children().unwrap()[0].id;
assert_eq!(v["id"], json!(id.0));
let sp = &d.node(id).unwrap().path_data().unwrap().subpaths[0];
let seg = sp.segment(v["segment"].as_u64().unwrap() as usize);
let at = vectorcraft_geom::ParamCurve::eval(&seg, v["t"].as_f64().unwrap());
assert!(at.distance(Point::new(300.0, 200.0)) < 1e-6, "{v}");
}
/// Shift held at the press puts the circle on the other side of the path, and the preview follows
/// Shift too.
#[test]
fn shift_puts_the_circle_on_the_other_side() {
let d = doc_with(&[circle()]);
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let shift = Mods { shift: true, ..Mods::default() };
let mut t = CurvatureCircleTool::default();
t.pointer(&cx, &ev(PointerKind::Move, (300.0, 200.0), shift));
assert!(near(preview(&t.overlays(&cx)).expect("the circle is shown"), Rect::new(300.0, 100.0, 500.0, 300.0)), "{:?}", t.overlays(&cx));
assert_eq!(params(&click(&mut t, &cx, (300.0, 200.0), shift))["convex"], json!(true));
}
/// On a straight segment the pointer shows "Straight segment", at a cusp "Cusp", and where the
/// circle would reach past the canvas "Circle too large"; a click there draws nothing.
#[test]
fn straight_segments_cusps_and_huge_circles_are_refused() {
let line = PathData::from_bezpath(&vectorcraft_geom::BezPath::from_svg("M0 400 L400 400").unwrap());
// A handle drawn back onto its anchor at (0, 0).
let cusp = PathData::from_bezpath(&vectorcraft_geom::BezPath::from_svg("M0 0 C0 0 60 40 100 0").unwrap());
let gentle = PathData::from_bezpath(&vectorcraft_geom::BezPath::from_svg("M0 450 C100 450.0000001 200 450.0000001 300 450").unwrap());
let d = doc_with(&[line, cusp, gentle]);
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = CurvatureCircleTool::default();
for (at, want) in [((200.0, 401.0), "Straight segment"), ((-1.0, -1.0), "Cusp"), ((150.0, 451.0), "Circle too large")] {
t.pointer(&cx, &ev(PointerKind::Move, at, Mods::default()));
let o = t.overlays(&cx);
assert_eq!(label(&o).as_deref(), Some(want), "{o:?}");
assert_eq!(preview(&o), None);
assert_eq!(click(&mut t, &cx, at, Mods::default()), vec![], "{want}");
}
}
/// Away from every path the tool shows nothing and a click draws nothing; the pointer reaches a
/// path within 5 screen points, so at 200% within 2.5 pt.
#[test]
fn the_pointer_reaches_a_path_within_5_screen_points() {
let d = doc_with(&[circle()]);
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, snapping_tolerance: 0.0, ..cx(&d, &s, &p) };
let mut t = CurvatureCircleTool::default();
assert_eq!(click(&mut t, &cx, (200.0, 200.0), Mods::default()), vec![]);
assert!(t.overlays(&cx).is_empty());
assert_eq!(click(&mut t, &cx, (306.0, 200.0), Mods::default()), vec![]);
assert_eq!(click(&mut t, &cx, (304.0, 200.0), Mods::default()).len(), 1);
let zoomed = ToolContext { zoom: 2.0, ..cx };
assert_eq!(click(&mut t, &zoomed, (303.0, 200.0), Mods::default()), vec![]);
assert_eq!(click(&mut t, &zoomed, (302.0, 200.0), Mods::default()).len(), 1);
}
/// Of two paths within reach, the nearer one is used, even when the other one is selected: a
/// selected circle 4 pt from the pointer loses to a circle under it.
#[test]
fn the_nearest_path_wins_over_a_selected_one() {
let far = shapes::ellipse(Rect::new(104.0, 100.0, 304.0, 300.0));
let d = doc_with(&[circle(), far]);
let ids: Vec<NodeId> = d.layers[0].children().unwrap().iter().map(|n| n.id).collect();
let far_id = *ids.iter().find(|id| d.node(**id).unwrap().path_data().unwrap().bounds().unwrap().x0 > 100.5).unwrap();
let s = Selection { objects: vec![far_id], ..Selection::default() };
let p = paint();
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = CurvatureCircleTool::default();
let v = params(&click(&mut t, &cx, (300.0, 200.0), Mods::default()));
assert_ne!(v["id"], json!(far_id.0), "{v}");
}
/// A guide is not a path the tool draws from, even when it is selected.
#[test]
fn a_selected_guide_is_left_out() {
let mut d = doc_with(&[circle()]);
let id = d.layers[0].children().unwrap()[0].id;
if let Some(vectorcraft_doc::NodeKind::Path { guide, .. }) = d.node_mut(id).map(|n| &mut n.kind) {
*guide = true;
}
let s = Selection { objects: vec![id], ..Selection::default() };
let p = paint();
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = CurvatureCircleTool::default();
assert_eq!(click(&mut t, &cx, (300.0, 200.0), Mods::default()), vec![]);
assert!(t.overlays(&cx).is_empty());
}
/// A press that a second finger or a canceled touch drops draws nothing on the release, and an
/// edit made outside the tool drops what the pointer was over.
#[test]
fn a_dropped_press_and_an_outside_edit_draw_nothing() {
let d = doc_with(&[circle()]);
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = CurvatureCircleTool::default();
t.pointer(&cx, &ev(PointerKind::Down, (300.0, 200.0), Mods::default()));
t.drop_press(&cx);
assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, (300.0, 200.0), Mods::default())), vec![]);
t.pointer(&cx, &ev(PointerKind::Move, (300.0, 200.0), Mods::default()));
t.history_moved();
assert!(t.overlays(&cx).is_empty());
}
/// Escape during a press cancels it, and the tool takes Escape only while a press is held; the
/// tool asks to be hovered again after an edit or a zoom.
#[test]
fn escape_cancels_a_press() {
let d = doc_with(&[circle()]);
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = CurvatureCircleTool::default();
assert!(!t.claims_key(&cx, ToolKey::Escape));
t.pointer(&cx, &ev(PointerKind::Down, (300.0, 200.0), Mods::default()));
assert!(t.claims_key(&cx, ToolKey::Escape));
t.key(&cx, ToolKey::Escape, Mods::default());
assert!(t.overlays(&cx).is_empty());
assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, (300.0, 200.0), Mods::default())), vec![]);
assert!(t.wants_rehover());
}
/// The preview of a circle more than 50,000 screen points around is drawn solid; a smaller one is
/// dashed.
#[test]
fn a_huge_preview_is_drawn_solid() {
let big = shapes::ellipse(Rect::new(-10_000.0, -10_000.0, 10_000.0, 10_000.0));
let d = doc_with(&[big]);
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = CurvatureCircleTool::default();
t.pointer(&cx, &ev(PointerKind::Move, (10_001.0, 0.0), Mods::default()));
let o = t.overlays(&cx);
assert_eq!(preview(&o), None, "{o:?}");
assert!(o.iter().any(|o| matches!(o, Overlay::Path { dashed: false, .. })), "{o:?}");
}
/// A press dragged 2 screen points or more is not a click and draws nothing; a press that moves
/// less still draws the circle.
#[test]
fn a_drag_draws_nothing() {
let d = doc_with(&[circle()]);
let (s, p) = (Selection::default(), paint());
let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) };
let mut t = CurvatureCircleTool::default();
let press = |t: &mut CurvatureCircleTool, to: (f64, f64)| {
t.pointer(&cx, &ev(PointerKind::Down, (300.0, 200.0), Mods::default()));
t.pointer(&cx, &ev(PointerKind::Drag, to, Mods::default()));
t.pointer(&cx, &ev(PointerKind::Up, to, Mods::default()))
};
assert_eq!(press(&mut t, (300.0, 230.0)), vec![]);
// The circle at the press is not shown once the press is a drag; at a release away from every
// path nothing is shown.
t.pointer(&cx, &ev(PointerKind::Down, (300.0, 200.0), Mods::default()));
t.pointer(&cx, &ev(PointerKind::Drag, (250.0, 200.0), Mods::default()));
assert!(t.overlays(&cx).is_empty());
t.pointer(&cx, &ev(PointerKind::Up, (250.0, 200.0), Mods::default()));
assert!(t.overlays(&cx).is_empty());
assert_eq!(press(&mut t, (300.0, 202.0)), vec![]);
assert_eq!(press(&mut t, (300.0, 201.0)).len(), 1);
// A release that far away with no drag before it is not a click either.
t.pointer(&cx, &ev(PointerKind::Down, (300.0, 200.0), Mods::default()));
assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, (300.0, 230.0), Mods::default())), vec![]);
}
/// The tool is in the Ellipse tool's group, after the Circle tool.
#[test]
fn the_curvature_circle_tool_follows_the_circle_tool() {
let tool = crate::create(ID);
assert_eq!(tool.id(), ID);
let group = crate::catalog::group_of(ID).unwrap();
let ids: Vec<&str> = crate::TOOL_GROUPS[group].iter().map(|t| t.id).collect();
let circle = ids.iter().position(|id| *id == crate::circle::ID).unwrap();
assert_eq!(ids.get(circle + 1), Some(&ID));
}
+4 -2
View File
@@ -365,7 +365,7 @@ pub(crate) fn walk_pickable<'a>(cx: &ToolContext<'a>, mut f: impl FnMut(&'a vect
}
/// Editable path nodes, selected ones first, then the rest top-most first ([`walk_pickable`]).
fn candidate_paths(cx: &ToolContext) -> Vec<NodeId> {
pub(crate) fn candidate_paths(cx: &ToolContext) -> Vec<NodeId> {
let mut v: Vec<NodeId> = cx.selection.objects.iter().copied().filter(|id| cx.doc.node(*id).is_some_and(|n| n.path_data().is_some())).collect();
let mut rest = vec![];
walk_pickable(cx, |n| {
@@ -374,8 +374,10 @@ fn candidate_paths(cx: &ToolContext) -> Vec<NodeId> {
}
});
rest.reverse();
// A set keeps this linear: hover runs it on every pointer move, over every path.
let mut seen: std::collections::HashSet<NodeId> = v.iter().copied().collect();
for id in rest {
if !v.contains(&id) {
if seen.insert(id) {
v.push(id);
}
}
+2
View File
@@ -15,6 +15,7 @@ pub mod catalog;
pub mod circle;
pub mod corners;
pub mod cropimage;
pub mod curvature_circle;
pub mod cut;
pub mod dimension;
pub mod direct;
@@ -366,6 +367,7 @@ pub fn create(id: &str) -> Box<dyn Tool> {
"type" | "areaType" | "typeOnPath" | "verticalType" | "verticalAreaType" | "verticalTypeOnPath" => Box::new(text::TypeTool::new(id)),
"rectangle" | "roundedRectangle" | "ellipse" | "polygon" | "star" | "lineSegment" => Box::new(shape::ShapeTool::new(id)),
circle::ID => Box::new(circle::CircleTool::default()),
curvature_circle::ID => Box::new(curvature_circle::CurvatureCircleTool::default()),
// Not in the toolbar: `file.place.queue` loads it.
"place" => Box::new(place::PlaceTool::default()),
other => symbolism::create(other)
+3 -3
View File
@@ -207,7 +207,7 @@ fn the_commands_add_move_remove_and_reset_tools() {
assert_eq!(slots(&app)[2], ["slice"]);
let ellipse = slot_of(&app, "ellipse").unwrap();
app.run("toolbar.addTool", json!({"tool": "star", "slot": ellipse, "place": "group"})).unwrap();
assert_eq!(slots(&app)[ellipse], ["ellipse", "circle", "star"]);
assert_eq!(slots(&app)[ellipse], ["ellipse", "circle", "curvatureCircle", "star"]);
assert!(!slots(&app)[slot_of(&app, "rectangle").unwrap()].contains(&"star"));
// Onto its own group: nothing changes.
let before = slots(&app);
@@ -217,7 +217,7 @@ fn the_commands_add_move_remove_and_reset_tools() {
assert_eq!(crate::toolbar::slots(&app)[0].0, Some("Select"));
// Out: one tool, or its whole group; an emptied slot goes.
app.run("toolbar.removeTool", json!({"tool": "ellipse"})).unwrap();
assert_eq!(slots(&app)[ellipse], ["circle", "star"]);
assert_eq!(slots(&app)[ellipse], ["circle", "curvatureCircle", "star"]);
app.run("toolbar.removeTool", json!({"tool": "addAnchor", "group": true})).unwrap();
assert!(slot_of(&app, "pen").is_none() && slot_of(&app, "addAnchor").is_none());
// Bad params change nothing.
@@ -379,7 +379,7 @@ fn tools_drag_between_the_drawer_and_the_toolbar() {
let drawer = drawer_rect(&ctx).unwrap();
let (slice, _) = cell_at(&shown, drawer, "Slice Tool");
drag(&mut app, &ctx, 2.0, slice, tools[ellipse].center());
assert_eq!(slots(&app)[ellipse], ["ellipse", "circle", "slice"]);
assert_eq!(slots(&app)[ellipse], ["ellipse", "circle", "curvatureCircle", "slice"]);
// A dimmed tool (in the toolbar already) doesn't drag.
let before = slots(&app);
let shown = frame(&mut app, &ctx, 2.9, vec![]);
+3
View File
@@ -464,6 +464,9 @@ font-technology Variable Променливи
Check Spelling… Проверка на правописа…
Choose a folder Избор на папка
Choose… Избор…
Curvature Circle Tool Инструмент Кръг на кривината
Cusp Връх
Straight segment Прав сегмент
Circle Кръг
Circle Tool Инструмент Кръг
Circle too large Кръгът е твърде голям
Can't render this file because it is too large.
+3
View File
@@ -4524,6 +4524,9 @@ font-technology Variable Varijabilni
Couldn't copy to the system clipboard: {e} Nije moguće kopirati u sistemski međuspremnik: {e}
Couldn't paste from the clipboard: {e} Nije moguće zalijepiti iz međuspremnika: {e}
Channel Kanal
Curvature Circle Tool Alat Krug zakrivljenosti
Cusp Šiljak
Straight segment Ravan segment
Circle Krug
Circle Tool Alat za krug
Circle too large Krug je prevelik
Can't render this file because it contains an unexpected character in line 2 and column 73.
+6
View File
@@ -701,6 +701,9 @@ antiAlias Sharp Nítid
Chrome… Crom…
Circle Cercle
Circle Tool Eina de cercle
Curvature Circle Tool Eina Cercle de curvatura
Cusp Punta
Straight segment Segment recte
Circle too large El cercle és massa gran
Circle (open) Cercle (obert)
Classic Clàssic
@@ -6153,6 +6156,9 @@ liquify-list-end {0}, {1} {0} i {1}
@msg no anchor points selected no hi ha cap punt d’ancoratge seleccionat
@msg `points` must be two or three [x, y] pairs of numbers `points` han de ser dos o tres parells de nombres [x, y]
@msg direct-select two or three anchor points, or give `points` seleccioneu directament dos o tres punts d’ancoratge o indiqueu `points`
@msg the path is straight there, so no circle matches its curvature el traçat és recte en aquest punt, així que cap cercle no coincideix amb la seva curvatura
@msg the path has a cusp there, so it has no single curvature el traçat té una punta en aquest punt, així que no té una curvatura única
@msg the circle that matches the path there would reach past the canvas el cercle que coincideix amb el traçat en aquest punt sortiria del llenç
@msg no circle passes through these points: two are the same or all three lie on one line cap cercle no passa per aquests punts: dos són iguals o tots tres són en una mateixa recta
@msg no app to open files here aquí no hi ha cap aplicació per obrir fitxers
@msg no artboard no hi ha tauler
Can't render this file because it contains an unexpected character in line 2 and column 73.
+6
View File
@@ -4630,6 +4630,9 @@ font-technology Variable Variabilní
Channel Kanál
Circle Kruh
Circle Tool Nástroj Kruh
Curvature Circle Tool Nástroj Kružnice křivosti
Cusp Hrot
Straight segment Přímý segment
Circle too large Kruh je příliš velký
Clip to Art Oříznout podle kresby
Colorize Obarvit
@@ -5318,6 +5321,9 @@ liquify-list-end {0}, {1} {0} a {1}
@msg no anchor points selected nejsou vybrány žádné kotevní body
@msg `points` must be two or three [x, y] pairs of numbers `points` musí být dvě nebo tři dvojice čísel [x, y]
@msg direct-select two or three anchor points, or give `points` vyberte přímým výběrem dva nebo tři kotevní body, nebo zadejte `points`
@msg the path is straight there, so no circle matches its curvature cesta je v tomto místě rovná, takže jejímu zakřivení neodpovídá žádná kružnice
@msg the path has a cusp there, so it has no single curvature cesta má v tomto místě hrot, takže nemá jediné zakřivení
@msg the circle that matches the path there would reach past the canvas kružnice odpovídající cestě v tomto místě by přesáhla plátno
@msg no circle passes through these points: two are the same or all three lie on one line těmito body neprochází žádná kružnice: dva jsou stejné nebo všechny tři leží na jedné přímce
@msg no app to open files here zde chybí aplikace pro otevírání souborů
@msg no artboard žádná pracovní plocha
Can't render this file because it is too large.
+6
View File
@@ -7029,6 +7029,9 @@ font-technology Variable Variable
Channel Kanal
Circle Cirkel
Circle Tool Cirkelværktøj
Curvature Circle Tool Krumningscirkelværktøj
Cusp Spids
Straight segment Lige segment
Circle too large Cirklen er for stor
Clip to Art Beskær til grafik
Colorize Farvelæg
@@ -7507,6 +7510,9 @@ imageTrace Outline Kontur
@msg no anchor points selected ingen ankerpunkter er markeret
@msg `points` must be two or three [x, y] pairs of numbers `points` skal være to eller tre talpar [x, y]
@msg direct-select two or three anchor points, or give `points` direkte markér to eller tre ankerpunkter, eller angiv `points`
@msg the path is straight there, so no circle matches its curvature kurven er lige der, så ingen cirkel passer til dens krumning
@msg the path has a cusp there, so it has no single curvature kurven har en spids der, så den har ingen entydig krumning
@msg the circle that matches the path there would reach past the canvas cirklen, der passer til kurven der, ville gå ud over lærredet
@msg no circle passes through these points: two are the same or all three lie on one line ingen cirkel går gennem disse punkter: to er ens, eller alle tre ligger på én linje
@msg no app to open files here ingen app til at åbne filer her
@msg no artboard ingen tegneflade
Can't render this file because it is too large.
+6
View File
@@ -457,6 +457,9 @@ font-technology Variable Variabel
Choose… Wählen…
Circle Kreis
Circle Tool Kreis-Werkzeug
Curvature Circle Tool Krümmungskreis-Werkzeug
Cusp Spitze
Straight segment Gerades Segment
Circle too large Kreis zu groß
Classic Defaults Klassische Standardwerte
Clean Up… Aufräumen…
@@ -4919,6 +4922,9 @@ liquify-list-end {0}, {1} {0} und {1}
@msg no anchor points selected keine Ankerpunkte ausgewählt
@msg `points` must be two or three [x, y] pairs of numbers `points` muss aus zwei oder drei Zahlenpaaren [x, y] bestehen
@msg direct-select two or three anchor points, or give `points` wählen Sie zwei oder drei Ankerpunkte direkt aus oder geben Sie `points` an
@msg the path is straight there, so no circle matches its curvature der Pfad ist dort gerade, daher passt kein Kreis zu seiner Krümmung
@msg the path has a cusp there, so it has no single curvature der Pfad hat dort eine Spitze und daher keine eindeutige Krümmung
@msg the circle that matches the path there would reach past the canvas der Kreis, der dort zum Pfad passt, würde über die Arbeitsfläche hinausreichen
@msg no circle passes through these points: two are the same or all three lie on one line durch diese Punkte verläuft kein Kreis: zwei sind gleich oder alle drei liegen auf einer Linie
@msg no app to open files here hier gibt es keine App zum Öffnen von Dateien
@msg no artboard keine Zeichenfläche
Can't render this file because it is too large.
+6
View File
@@ -450,6 +450,9 @@ font-technology Variable Μεταβλητές
Choose… Επιλογή…
Circle Κύκλος
Circle Tool Εργαλείο κύκλου
Curvature Circle Tool Εργαλείο Κύκλος καμπυλότητας
Cusp Ακίδα
Straight segment Ευθύ τμήμα
Circle too large Ο κύκλος είναι πολύ μεγάλος
Classic Defaults Κλασικές προεπιλογές
Clean Up… Εκκαθάριση…
@@ -4977,6 +4980,9 @@ digits Malayalam Μαλαγιάλαμ
@msg no anchor points selected δεν έχουν επιλεγεί σημεία αγκύρωσης
@msg `points` must be two or three [x, y] pairs of numbers το `points` πρέπει να είναι δύο ή τρία ζεύγη αριθμών [x, y]
@msg direct-select two or three anchor points, or give `points` επιλέξτε άμεσα δύο ή τρία σημεία αγκύρωσης ή δώστε `points`
@msg the path is straight there, so no circle matches its curvature η διαδρομή είναι ευθεία εκεί, οπότε κανένας κύκλος δεν ταιριάζει με την καμπυλότητά της
@msg the path has a cusp there, so it has no single curvature η διαδρομή έχει ακίδα εκεί, οπότε δεν έχει μία μόνο καμπυλότητα
@msg the circle that matches the path there would reach past the canvas ο κύκλος που ταιριάζει με τη διαδρομή εκεί θα υπερέβαινε τον καμβά
@msg no circle passes through these points: two are the same or all three lie on one line κανένας κύκλος δεν περνά από αυτά τα σημεία: δύο είναι ίδια ή και τα τρία βρίσκονται σε μία ευθεία
@msg no app to open files here δεν υπάρχει εφαρμογή για άνοιγμα αρχείων εδώ
@msg no artboard δεν υπάρχει πίνακας σχεδίασης
Can't render this file because it is too large.
+6
View File
@@ -480,6 +480,9 @@ font-technology Variable Variables
Choose… Elegir…
Circle Círculo
Circle Tool Herramienta Círculo
Curvature Circle Tool Herramienta Círculo de curvatura
Cusp Cúspide
Straight segment Segmento recto
Circle too large Círculo demasiado grande
Classic Defaults Valores predeterminados clásicos
Clean Up… Limpiar…
@@ -5023,6 +5026,9 @@ liquify-list-end {0}, {1} {0}, {1}
@msg no anchor points selected no hay puntos de ancla seleccionados
@msg `points` must be two or three [x, y] pairs of numbers `points` debe ser dos o tres pares de números [x, y]
@msg direct-select two or three anchor points, or give `points` seleccione directamente dos o tres puntos de ancla o indique `points`
@msg the path is straight there, so no circle matches its curvature el trazado es recto en ese punto, así que ningún círculo coincide con su curvatura
@msg the path has a cusp there, so it has no single curvature el trazado tiene una cúspide en ese punto, así que no tiene una curvatura única
@msg the circle that matches the path there would reach past the canvas el círculo que coincide con el trazado en ese punto excedería el lienzo
@msg no circle passes through these points: two are the same or all three lie on one line ningún círculo pasa por estos puntos: dos son iguales o los tres están en una misma línea
@msg no app to open files here aquí no hay ninguna aplicación para abrir archivos
@msg no artboard no hay mesa de trabajo
Can't render this file because it contains an unexpected character in line 2 and column 73.
+6
View File
@@ -4549,6 +4549,9 @@ font-technology Variable Muuttuvat
Channel Kanava
Circle Ympyrä
Circle Tool Ympyrätyökalu
Curvature Circle Tool Kaarevuusympyrätyökalu
Cusp Kärki
Straight segment Suora segmentti
Circle too large Ympyrä on liian suuri
Clip to Art Rajaa kuvitukseen
Colorize Väritä
@@ -5247,6 +5250,9 @@ liquify-list-end {0}, {1} {0} ja {1}
@msg no anchor points selected ankkuripisteitä ei ole valittu
@msg `points` must be two or three [x, y] pairs of numbers `points` on annettava kahtena tai kolmena lukuparina [x, y]
@msg direct-select two or three anchor points, or give `points` valitse suoraan kaksi tai kolme ankkuripistettä tai anna `points`
@msg the path is straight there, so no circle matches its curvature polku on siinä kohdassa suora, joten mikään ympyrä ei vastaa sen kaarevuutta
@msg the path has a cusp there, so it has no single curvature polulla on siinä kohdassa kärki, joten sillä ei ole yksiselitteistä kaarevuutta
@msg the circle that matches the path there would reach past the canvas ympyrä, joka vastaa polkua siinä kohdassa, ylittäisi kankaan
@msg no circle passes through these points: two are the same or all three lie on one line näiden pisteiden kautta ei kulje ympyrää: kaksi pisteistä on samoja tai kaikki kolme ovat samalla suoralla
@msg no app to open files here täällä ei ole sovellusta tiedostojen avaamiseen
@msg no artboard ei piirtoalustaa
Can't render this file because it contains an unexpected character in line 2 and column 73.
+6
View File
@@ -481,6 +481,9 @@ font-technology Variable Variables
Choose… Choisir…
Circle Cercle
Circle Tool Outil Cercle
Curvature Circle Tool Outil Cercle de courbure
Cusp Point de rebroussement
Straight segment Segment droit
Circle too large Cercle trop grand
Classic Defaults Valeurs par défaut classiques
Clean Up… Nettoyer…
@@ -4985,6 +4988,9 @@ liquify-list-end {0}, {1} {0} et {1}
@msg no anchor points selected aucun point d’ancrage sélectionné
@msg `points` must be two or three [x, y] pairs of numbers `points` doit contenir deux ou trois paires de nombres [x, y]
@msg direct-select two or three anchor points, or give `points` sélectionnez deux ou trois points d’ancrage avec l’outil Sélection directe, ou indiquez `points`
@msg the path is straight there, so no circle matches its curvature le tracé est droit à cet endroit, donc aucun cercle ne correspond à sa courbure
@msg the path has a cusp there, so it has no single curvature le tracé a un point de rebroussement à cet endroit, donc il n’a pas de courbure unique
@msg the circle that matches the path there would reach past the canvas le cercle qui correspond au tracé à cet endroit dépasserait la zone de travail
@msg no circle passes through these points: two are the same or all three lie on one line aucun cercle ne passe par ces points : deux sont identiques ou les trois sont alignés
@msg no app to open files here aucune application pour ouvrir des fichiers ici
@msg no artboard aucun plan de travail
Can't render this file because it is too large.
+3
View File
@@ -561,6 +561,9 @@
Chop Design ચૉપ ડિઝાઇન
Chosen: {n} of {total} પસંદ કરેલ: {total} માંથી {n}
Chrome… ક્રોમ…
Curvature Circle Tool વક્રતા વર્તુળ ટૂલ
Cusp અણી
Straight segment સીધો સેગમેન્ટ
Circle વર્તુળ
Circle Tool વર્તુળ ટૂલ
Circle too large વર્તુળ ખૂબ મોટું છે
Can't render this file because it contains an unexpected character in line 72 and column 5.
+6
View File
@@ -821,6 +821,9 @@ antiAlias Sharp शार्प
Chrome… क्रोम…
Circle वृत्त
Circle Tool वृत्त टूल
Curvature Circle Tool वक्रता वृत्त टूल
Cusp नुकीला बिंदु
Straight segment सीधा सेगमेंट
Circle too large वृत्त बहुत बड़ा है
Circle (open) सर्किल (ओपन)
Circle: वृत्त:
@@ -7635,6 +7638,9 @@ liquify-list-end {0}, {1} {0} और {1}
@msg no anchor points selected कोई एंकर पॉइंट सिलेक्ट नहीं है
@msg `points` must be two or three [x, y] pairs of numbers `points` में संख्याओं के दो या तीन [x, y] जोड़े होने चाहिए
@msg direct-select two or three anchor points, or give `points` दो या तीन एंकर पॉइंट्स डायरेक्ट-सिलेक्ट करें, या `points` दें
@msg the path is straight there, so no circle matches its curvature वहाँ पाथ सीधा है, इसलिए कोई वृत्त उसकी वक्रता से मेल नहीं खाता
@msg the path has a cusp there, so it has no single curvature वहाँ पाथ में नुकीला बिंदु है, इसलिए उसकी कोई एक वक्रता नहीं है
@msg the circle that matches the path there would reach past the canvas वहाँ पाथ से मेल खाने वाला वृत्त कैनवास से बाहर चला जाएगा
@msg no circle passes through these points: two are the same or all three lie on one line इन पॉइंट्स से होकर कोई वृत्त नहीं गुज़रता: दो एक जैसे हैं या तीनों एक ही रेखा पर हैं
@msg no app to open files here यहां फ़ाइलों को ओपन करने के लिए कोई ऐप नहीं है
@msg no appearance item {index} कोई उपस्थिति आइटम {index}
Can't render this file because it is too large.
+6
View File
@@ -642,6 +642,9 @@ font-technology Variable Változó
Choose… Kiválasztás…
Circle Kör
Circle Tool Kör eszköz
Curvature Circle Tool Simulókör eszköz
Cusp Csúcspont
Straight segment Egyenes szakasz
Circle too large A kör túl nagy
Circle (open) Kör (nyitott)
Classic Defaults Klasszikus alapértékek
@@ -5686,6 +5689,9 @@ liquify-list-end {0}, {1} {0} és {1}
@msg no anchor points selected nincs kijelölt horgonypont
@msg `points` must be two or three [x, y] pairs of numbers a `points` két vagy három [x, y] számpár legyen
@msg direct-select two or three anchor points, or give `points` jelölj ki közvetlen kijelöléssel két vagy három horgonypontot, vagy add meg a `points` értéket
@msg the path is straight there, so no circle matches its curvature az útvonal ott egyenes, így egyetlen kör sem illeszkedik a görbületéhez
@msg the path has a cusp there, so it has no single curvature az útvonalnak ott csúcspontja van, így nincs egyértelmű görbülete
@msg the circle that matches the path there would reach past the canvas az útvonalhoz ott illeszkedő kör túlnyúlna a vásznon
@msg no circle passes through these points: two are the same or all three lie on one line ezeken a pontokon nem halad át kör: kettő egybeesik, vagy mindhárom egy egyenesen van
@msg no app to open files here itt nincs fájlmegnyitó alkalmazás
@msg no artboard nincs rajztábla
Can't render this file because it is too large.
+3
View File
@@ -4279,6 +4279,9 @@ font-technology Variable Variabel
Couldn't copy to the system clipboard: {e} Tidak dapat menyalin ke papan klip sistem: {e}
Couldn't paste from the clipboard: {e} Tidak dapat menempel dari papan klip: {e}
Channel Saluran
Curvature Circle Tool Alat Lingkaran kelengkungan
Cusp Titik tajam
Straight segment Segmen lurus
Circle Lingkaran
Circle Tool Alat lingkaran
Circle too large Lingkaran terlalu besar
Can't render this file because it contains an unexpected character in line 2511 and column 5.
+6
View File
@@ -482,6 +482,9 @@ font-technology Variable Variabili
Choose… Scegli…
Circle Cerchio
Circle Tool Strumento Cerchio
Curvature Circle Tool Strumento Cerchio di curvatura
Cusp Cuspide
Straight segment Segmento diritto
Circle too large Cerchio troppo grande
Classic Defaults Valori predefiniti classici
Clean Up… Pulisci…
@@ -5053,6 +5056,9 @@ liquify-list-end {0}, {1} {0} e {1}
@msg no anchor points selected nessun punto di ancoraggio selezionato
@msg `points` must be two or three [x, y] pairs of numbers `points` deve essere composto da due o tre coppie di numeri [x, y]
@msg direct-select two or three anchor points, or give `points` seleziona con Selezione diretta due o tre punti di ancoraggio oppure indica `points`
@msg the path is straight there, so no circle matches its curvature il tracciato è diritto in quel punto, quindi nessun cerchio corrisponde alla sua curvatura
@msg the path has a cusp there, so it has no single curvature il tracciato ha una cuspide in quel punto, quindi non ha un'unica curvatura
@msg the circle that matches the path there would reach past the canvas il cerchio che corrisponde al tracciato in quel punto supererebbe l'area di lavoro
@msg no circle passes through these points: two are the same or all three lie on one line nessun cerchio passa per questi punti: due coincidono oppure tutti e tre sono allineati
@msg no app to open files here nessuna app per aprire file qui
@msg no artboard nessuna tavola da disegno
Can't render this file because it is too large.
+6
View File
@@ -1298,6 +1298,9 @@ antiAlias Sharp シャープ
Choose… 選択…
Circle 円
Circle Tool 円ツール
Curvature Circle Tool 曲率円ツール
Cusp 尖点
Straight segment 直線セグメント
Circle too large 円が大きすぎます
Clear All Tabs すべてのタブを消去
Above Text テキストの上
@@ -4847,6 +4850,9 @@ swatch Bright Violet ビビッドバイオレット
@msg no anchor points selected アンカーポイントが選択されていません
@msg `points` must be two or three [x, y] pairs of numbers `points` は 2 組または 3 組の数値 [x, y] にしてください
@msg direct-select two or three anchor points, or give `points` アンカーポイントを 2 つまたは 3 つダイレクト選択するか、`points` を指定してください
@msg the path is straight there, so no circle matches its curvature パスはその位置で直線のため、曲率に合う円はありません
@msg the path has a cusp there, so it has no single curvature パスはその位置に尖点があるため、曲率が 1 つに定まりません
@msg the circle that matches the path there would reach past the canvas その位置でパスに合う円はキャンバスからはみ出します
@msg no circle passes through these points: two are the same or all three lie on one line これらの点を通る円はありません: 2 つの点が同じか、3 点すべてが一直線上にあります
@msg select at least two objects オブジェクトを 2 つ以上選択してください
@msg exit isolation mode first 先に分離モードを終了してください
Can't render this file because it is too large.
+6
View File
@@ -6347,6 +6347,9 @@ font-technology Variable ცვლადი
Channel არხი
Circle წრე
Circle Tool წრის ხელსაწყო
Curvature Circle Tool სიმრუდის წრის ხელსაწყო
Cusp წვეტი
Straight segment სწორი სეგმენტი
Circle too large წრე ზედმეტად დიდია
Clip to Art ნახატზე მოჭრა
Colorize გაფერადება
@@ -6832,6 +6835,9 @@ font-technology Variable ცვლადი
@msg no anchor points selected საყრდენი წერტილები მონიშნული არ არის
@msg `points` must be two or three [x, y] pairs of numbers `points` უნდა იყოს რიცხვების ორი ან სამი [x, y] წყვილი
@msg direct-select two or three anchor points, or give `points` პირდაპირი მონიშვნით მონიშნეთ ორი ან სამი საყრდენი წერტილი ან მიუთითეთ `points`
@msg the path is straight there, so no circle matches its curvature ტრაექტორია იქ სწორია, ამიტომ არცერთი წრეწირი არ შეესაბამება მის სიმრუდეს
@msg the path has a cusp there, so it has no single curvature ტრაექტორიას იქ წვეტი აქვს, ამიტომ მას ერთი სიმრუდე არ აქვს
@msg the circle that matches the path there would reach past the canvas წრეწირი, რომელიც იქ ტრაექტორიას შეესაბამება, ტილოს გასცდებოდა
@msg no circle passes through these points: two are the same or all three lie on one line ამ წერტილებზე წრეწირი არ გადის: ორი ერთნაირია ან სამივე ერთ წრფეზე მდებარეობს
@msg no app to open files here აქ ფაილების გასახსნელი აპი არ არის
@msg no artboard სამუშაო დაფა არ არის
Can't render this file because it is too large.
+6
View File
@@ -1288,6 +1288,9 @@ antiAlias Sharp 날카롭게
Choose… 선택…
Circle 원
Circle Tool 점 기준 원 도구
Curvature Circle Tool 곡률원 도구
Cusp 뾰족점
Straight segment 직선 세그먼트
Circle too large 원이 너무 큽니다
Clear All Tabs 모든 탭 지우기
Above Text 문자 위
@@ -4774,6 +4777,9 @@ theme Appearance 외관
@msg no anchor points selected 선택한 앵커 포인트가 없습니다
@msg `points` must be two or three [x, y] pairs of numbers `points`는 숫자 쌍 [x, y] 두 개 또는 세 개여야 합니다
@msg direct-select two or three anchor points, or give `points` 앵커 포인트 두 개 또는 세 개를 직접 선택하거나 `points`를 지정하세요
@msg the path is straight there, so no circle matches its curvature 패스가 그 위치에서 직선이므로 곡률에 맞는 원이 없습니다
@msg the path has a cusp there, so it has no single curvature 패스가 그 위치에서 뾰족하므로 곡률이 하나로 정해지지 않습니다
@msg the circle that matches the path there would reach past the canvas 그 위치에서 패스에 맞는 원이 캔버스를 벗어납니다
@msg no circle passes through these points: two are the same or all three lie on one line 이 점들을 지나는 원이 없습니다: 두 점이 같거나 세 점이 모두 한 직선 위에 있습니다
@msg select at least two objects 개체를 두 개 이상 선택하세요
@msg exit isolation mode first 먼저 격리 모드를 종료하세요
Can't render this file because it is too large.
+6
View File
@@ -4903,6 +4903,9 @@ font-technology Variable Variabel
Channel Kanaal
Circle Cirkel
Circle Tool Cirkelgereedschap
Curvature Circle Tool Krommingscirkelgereedschap
Cusp Keerpunt
Straight segment Recht segment
Circle too large Cirkel te groot
Clip to Art Clippen op artwork
Colorize Inkleuren
@@ -5380,6 +5383,9 @@ imageTrace Outline Contour
@msg no anchor points selected geen ankerpunten geselecteerd
@msg `points` must be two or three [x, y] pairs of numbers `points` moet uit twee of drie getallenparen [x, y] bestaan
@msg direct-select two or three anchor points, or give `points` selecteer met directe selectie twee of drie ankerpunten of geef `points` op
@msg the path is straight there, so no circle matches its curvature het pad is daar recht, dus geen cirkel komt overeen met de kromming ervan
@msg the path has a cusp there, so it has no single curvature het pad heeft daar een keerpunt en dus geen eenduidige kromming
@msg the circle that matches the path there would reach past the canvas de cirkel die daar bij het pad past, zou voorbij het canvas reiken
@msg no circle passes through these points: two are the same or all three lie on one line er gaat geen cirkel door deze punten: twee zijn gelijk of alle drie liggen op één lijn
@msg no app to open files here hier is geen app om bestanden mee te openen
@msg no artboard geen tekengebied
Can't render this file because it is too large.
+6
View File
@@ -4471,6 +4471,9 @@ font-technology Variable Zmienne
Channel Kanał
Circle Okrąg
Circle Tool Narzędzie Okrąg
Curvature Circle Tool Narzędzie Okrąg krzywizny
Cusp Ostrze
Straight segment Prosty segment
Circle too large Okrąg jest za duży
Clip to Art Przytnij do kompozycji
Colorize Koloruj
@@ -5141,6 +5144,9 @@ liquify-list-end {0}, {1} {0} i {1}
@msg no anchor points selected nie zaznaczono punktów kontrolnych
@msg `points` must be two or three [x, y] pairs of numbers `points` musi zawierać dwie lub trzy pary liczb [x, y]
@msg direct-select two or three anchor points, or give `points` zaznacz bezpośrednio dwa lub trzy punkty kontrolne lub podaj `points`
@msg the path is straight there, so no circle matches its curvature ścieżka jest w tym miejscu prosta, więc żaden okrąg nie pasuje do jej krzywizny
@msg the path has a cusp there, so it has no single curvature ścieżka ma w tym miejscu ostrze, więc nie ma jednej krzywizny
@msg the circle that matches the path there would reach past the canvas okrąg pasujący w tym miejscu do ścieżki wykroczyłby poza płótno
@msg no circle passes through these points: two are the same or all three lie on one line przez te punkty nie przechodzi żaden okrąg: dwa są takie same albo wszystkie trzy leżą na jednej prostej
@msg no app to open files here brak aplikacji do otwierania plików
@msg no artboard brak obszaru kompozycji
Can't render this file because it is too large.
+6
View File
@@ -447,6 +447,9 @@ antiAlias Sharp Nítido
Choose… Escolher…
Circle Círculo
Circle Tool Ferramenta Círculo
Curvature Circle Tool Ferramenta Círculo de curvatura
Cusp Cúspide
Straight segment Segmento reto
Circle too large Círculo grande demais
Clean Up… Limpar…
Clear Limpar
@@ -4327,6 +4330,9 @@ axis Both Ambos
@msg no anchor points selected nenhum ponto de ancoragem selecionado
@msg `points` must be two or three [x, y] pairs of numbers `points` deve ter dois ou três pares de números [x, y]
@msg direct-select two or three anchor points, or give `points` selecione diretamente dois ou três pontos de ancoragem ou informe `points`
@msg the path is straight there, so no circle matches its curvature o caminho é reto nesse ponto, então nenhum círculo corresponde à sua curvatura
@msg the path has a cusp there, so it has no single curvature o caminho tem uma cúspide nesse ponto, então não tem uma curvatura única
@msg the circle that matches the path there would reach past the canvas o círculo que corresponde ao caminho nesse ponto ultrapassaria a tela
@msg no circle passes through these points: two are the same or all three lie on one line nenhum círculo passa por esses pontos: dois são iguais ou os três estão na mesma reta
@msg no app to open files here nenhum aplicativo para abrir arquivos aqui
@msg no artboard nenhuma prancheta
Can't render this file because it is too large.
+6
View File
@@ -478,6 +478,9 @@ font-technology Variable Вариативные
Choose… Выбрать…
Circle Круг
Circle Tool Инструмент «Круг»
Curvature Circle Tool Инструмент «Круг кривизны»
Cusp Точка возврата
Straight segment Прямой сегмент
Circle too large Круг слишком большой
Classic Defaults Классические значения по умолчанию
Clean Up… Очистить…
@@ -5047,6 +5050,9 @@ liquify-list-end {0}, {1} {0} и {1}
@msg no anchor points selected опорные точки не выделены
@msg `points` must be two or three [x, y] pairs of numbers `points` должен содержать две или три пары чисел [x, y]
@msg direct-select two or three anchor points, or give `points` выделите прямым выделением две или три опорные точки или задайте `points`
@msg the path is straight there, so no circle matches its curvature контур в этом месте прямой, поэтому его кривизне не соответствует ни одна окружность
@msg the path has a cusp there, so it has no single curvature у контура в этом месте точка возврата, поэтому у него нет единой кривизны
@msg the circle that matches the path there would reach past the canvas окружность, соответствующая контуру в этом месте, вышла бы за пределы холста
@msg no circle passes through these points: two are the same or all three lie on one line через эти точки не проходит ни одна окружность: две точки совпадают или все три лежат на одной прямой
@msg no app to open files here здесь нет приложения для открытия файлов
@msg no artboard нет монтажной области
Can't render this file because it is too large.
+6
View File
@@ -468,6 +468,9 @@ font-technology Variable Variabla
Choose… Välj…
Circle Cirkel
Circle Tool Cirkelverktyg
Curvature Circle Tool Krökningscirkelverktyg
Cusp Spets
Straight segment Rakt segment
Circle too large Cirkeln är för stor
Classic Defaults Klassiska standardvärden
Clean Up… Rensa upp…
@@ -4920,6 +4923,9 @@ liquify-list-end {0}, {1} {0} och {1}
@msg no anchor points selected inga ankarpunkter är markerade
@msg `points` must be two or three [x, y] pairs of numbers `points` måste vara två eller tre talpar [x, y]
@msg direct-select two or three anchor points, or give `points` direktmarkera två eller tre ankarpunkter eller ange `points`
@msg the path is straight there, so no circle matches its curvature banan är rak där, så ingen cirkel matchar dess krökning
@msg the path has a cusp there, so it has no single curvature banan har en spets där, så den har ingen entydig krökning
@msg the circle that matches the path there would reach past the canvas cirkeln som matchar banan där skulle nå utanför arbetsytan
@msg no circle passes through these points: two are the same or all three lie on one line ingen cirkel går genom de här punkterna: två är samma punkt eller så ligger alla tre på en linje
@msg no app to open files here det finns ingen app för att öppna filer här
@msg no artboard ingen rityta
Can't render this file because it is too large.
+6
View File
@@ -462,6 +462,9 @@ font-technology Variable Değişken
Choose… Seç…
Circle daire
Circle Tool Daire Aracı
Curvature Circle Tool Eğrilik Çemberi Aracı
Cusp Sivri nokta
Straight segment Düz segment
Circle too large Daire çok büyük
Classic Defaults Klasik Varsayılanlar
Clean Up… Temizleme…
@@ -4740,6 +4743,9 @@ liquify-list-end {0}, {1} {0} ve {1}
@msg no anchor points selected bağlantı noktası seçilmedi
@msg `points` must be two or three [x, y] pairs of numbers `points` iki veya üç [x, y] sayı çifti olmalıdır
@msg direct-select two or three anchor points, or give `points` iki veya üç bağlantı noktasını doğrudan seçin veya `points` verin
@msg the path is straight there, so no circle matches its curvature yol orada düz, bu yüzden hiçbir çember eğriliğiyle eşleşmiyor
@msg the path has a cusp there, so it has no single curvature yolun orada sivri bir noktası var, bu yüzden tek bir eğriliği yok
@msg the circle that matches the path there would reach past the canvas yolla orada eşleşen çember tuvalin dışına taşardı
@msg no circle passes through these points: two are the same or all three lie on one line bu noktalardan geçen bir çember yok: ikisi aynı ya da üçü de aynı doğru üzerinde
@msg no app to open files here burada dosyaları açacak uygulama yok
@msg no artboard çalışma yüzeyi yok
Can't render this file because it is too large.
+6
View File
@@ -476,6 +476,9 @@ font-technology Variable Варіативні
Choose… Вибрати…
Circle Коло
Circle Tool Інструмент «Коло»
Curvature Circle Tool Інструмент «Коло кривини»
Cusp Точка звороту
Straight segment Прямий сегмент
Circle too large Коло завелике
Classic Defaults Класичні значення за промовчанням
Clean Up… Очистити…
@@ -5037,6 +5040,9 @@ liquify-list-end {0}, {1} {0} і {1}
@msg no anchor points selected опорні точки не виділені
@msg `points` must be two or three [x, y] pairs of numbers `points` має містити дві або три пари чисел [x, y]
@msg direct-select two or three anchor points, or give `points` виділіть дві або три опорні точки прямим виділенням або задайте `points`
@msg the path is straight there, so no circle matches its curvature контур у цьому місці прямий, тож його кривині не відповідає жодне коло
@msg the path has a cusp there, so it has no single curvature контур у цьому місці має точку звороту, тож не має єдиної кривини
@msg the circle that matches the path there would reach past the canvas коло, що відповідає контуру в цьому місці, вийшло б за межі полотна
@msg no circle passes through these points: two are the same or all three lie on one line через ці точки не проходить жодне коло: дві точки збігаються або всі три лежать на одній прямій
@msg no app to open files here тут немає програми для відкриття файлів
@msg no artboard немає монтажної області
Can't render this file because it is too large.
+6
View File
@@ -558,6 +558,9 @@ font-technology Variable Biến thiên
Choose… Chọn…
Circle Hình tròn
Circle Tool Công cụ Hình tròn
Curvature Circle Tool Công cụ Đường tròn mật tiếp
Cusp Điểm lùi
Straight segment Đoạn thẳng
Circle too large Hình tròn quá lớn
Classic Cổ điển
Classic Defaults Mặc định cổ điển
@@ -5369,6 +5372,9 @@ liquify-list-end {0}, {1} {0} và {1}
@msg no anchor points selected chưa chọn điểm neo
@msg `points` must be two or three [x, y] pairs of numbers `points` phải là hai hoặc ba cặp số [x, y]
@msg direct-select two or three anchor points, or give `points` hãy chọn trực tiếp hai hoặc ba điểm neo hoặc cung cấp `points`
@msg the path is straight there, so no circle matches its curvature đường dẫn thẳng tại đó, nên không có đường tròn nào khớp với độ cong của nó
@msg the path has a cusp there, so it has no single curvature đường dẫn có điểm lùi tại đó, nên không có một độ cong duy nhất
@msg the circle that matches the path there would reach past the canvas đường tròn khớp với đường dẫn tại đó sẽ vượt quá giới hạn vùng vẽ
@msg no circle passes through these points: two are the same or all three lie on one line không có đường tròn nào đi qua các điểm này: hai điểm trùng nhau hoặc cả ba điểm thẳng hàng
@msg no app to open files here không có ứng dụng để mở tệp ở đây
@msg no artboard không có bảng vẽ
Can't render this file because it contains an unexpected character in line 205 and column 5.
+6
View File
@@ -429,6 +429,9 @@ antiAlias Sharp 锐利
Choose… 选择…
Circle 圆形
Circle Tool 圆形工具
Curvature Circle Tool 曲率圆工具
Cusp 尖点
Straight segment 直线段
Circle too large 圆形过大
Classic Defaults 经典默认
Clean Up… 清理…
@@ -4545,6 +4548,9 @@ imageTrace Outline 轮廓
@msg no anchor points selected 未选择锚点
@msg `points` must be two or three [x, y] pairs of numbers `points` 必须是两对或三对数字 [x, y]
@msg direct-select two or three anchor points, or give `points` 请直接选择两个或三个锚点,或提供 `points`
@msg the path is straight there, so no circle matches its curvature 路径在该处是直的,因此没有圆与其曲率相符
@msg the path has a cusp there, so it has no single curvature 路径在该处有尖点,因此没有唯一的曲率
@msg the circle that matches the path there would reach past the canvas 在该处与路径曲率相符的圆会超出画布
@msg no circle passes through these points: two are the same or all three lie on one line 没有圆经过这些点:有两点相同,或三点共线
@msg select at least two objects 请至少选择两个对象
@msg exit isolation mode first 请先退出隔离模式
Can't render this file because it is too large.
+6
View File
@@ -444,6 +444,9 @@ font-technology Variable 可變
Choose… 選擇…
Circle 圓形
Circle Tool 圓形工具
Curvature Circle Tool 曲率圓工具
Cusp 尖點
Straight segment 直線段
Circle too large 圓形過大
Classic Defaults 經典預設值
Clean Up… 清除…
@@ -2078,6 +2081,9 @@ file-filter Templates 範本
@msg no anchor points selected 未選取錨點
@msg `points` must be two or three [x, y] pairs of numbers `points` 必須是兩組或三組數字 [x, y]
@msg direct-select two or three anchor points, or give `points` 請以直接選取方式選取兩個或三個錨點,或提供 `points`
@msg the path is straight there, so no circle matches its curvature 路徑在該處是直的,因此沒有圓與其曲率相符
@msg the path has a cusp there, so it has no single curvature 路徑在該處有尖點,因此沒有唯一的曲率
@msg the circle that matches the path there would reach past the canvas 在該處與路徑曲率相符的圓會超出畫布
@msg no circle passes through these points: two are the same or all three lie on one line 沒有圓通過這些點:有兩點相同,或三點共線
@msg select at least two objects 請選取至少兩個物件
@msg exit isolation mode first 請先結束隔離模式
Can't render this file because it is too large.
+1
View File
@@ -64,6 +64,7 @@ pub static ICONS: &[(&str, &[u8])] = &[
("dc-contour", include_bytes!("../../../assets/icons/dc-contour.svg")),
("dc-crystallize", include_bytes!("../../../assets/icons/dc-crystallize.svg")),
("dc-cube", include_bytes!("../../../assets/icons/dc-cube.svg")),
("dc-curvature-circle", include_bytes!("../../../assets/icons/dc-curvature-circle.svg")),
("dc-dash-align", include_bytes!("../../../assets/icons/dc-dash-align.svg")),
("dc-dash-exact", include_bytes!("../../../assets/icons/dc-dash-exact.svg")),
("dc-dimension", include_bytes!("../../../assets/icons/dc-dimension.svg")),
+1
View File
@@ -45,6 +45,7 @@ pub fn tool_icon(name: &str) -> &'static str {
"tool-rounded-rect" => "dc-rounded-rect",
"tool-ellipse" => "dc-ellipse",
"tool-circle" => "dc-circle-points",
"tool-curvature-circle" => "dc-curvature-circle",
"tool-polygon" => "dc-polygon",
"tool-star" => "star",
"tool-flare" => "dc-flare",
+1 -1
View File
@@ -38,7 +38,7 @@ pub const BASIC: &[(&str, &[&[&str]])] = &[
"Shapes",
&[
&["rectangle", "roundedRectangle", "star", "lineSegment", "arc", "spiral", "rectangularGrid", "polarGrid", "flare"],
&["ellipse", "circle"],
&["ellipse", "circle", "curvatureCircle"],
&["polygon"],
&["shaper"],
],
+29
View File
@@ -6214,6 +6214,35 @@ perspective grid shows with an active plane, a Shift-click opens the size dialog
{"name":"run_command","arguments":{"command":"shape.circleThroughPoints","params":{"points":[[0,0],[80,0],[0,60]]}}}
```
## Curvature circle
`shape.curvatureCircle {id, subpath?, segment, t, convex?}` draws the circle that touches path `id` at `t` (0 to 1) on
segment `segment` of subpath `subpath` (0 when left out) and bends as the path bends there (its circle of curvature),
as a live ellipse with the current paint, and selects it. The circle goes on the side the path bends toward; with
`convex: true` it goes on the other side. A segment that is the usual cubic of a circular arc of 90° or less (its two
ends the same distance from the center, and each handle 4/3 · tan(θ/4) of the radius long for an arc of θ) gives a
circle with the arc's own radius, and on a circle drawn with the Ellipse tool the result is the circle itself. The
result is `{id, cx, cy, radius, nominal}`, where `nominal` is true for such an arc, and one undo removes the circle.
The circle is not pixel-aligned, even while [Align New Objects to Pixel Grid](#align-new-objects-to-pixel-grid) is on.
The command returns an error and draws nothing on a straight segment or the turning point of an S curve, at a cusp,
at an anchor whose handle is drawn back onto it, at a corner anchor (`t` 0 or 1 where two segments meet at an angle
of more than half a degree and the anchor is not marked smooth; segments of no length between them are passed over),
when the circle would reach past the canvas (4,000,000 pt from the origin), when `t` is not from 0 to 1, when `id` is
a guide, and when the path, subpath or segment does not exist.
The Curvature Circle tool, after the Circle tool in the Ellipse tool's toolbar group, draws with this command. The
pointer snaps to the nearest path that is not a guide within 5 screen points, or within Smart Guides › Snapping
Tolerance when that is larger, and the tool shows the circle that matches the path there as a dashed outline (solid
once it is more than 50,000 screen points around), a small cross at its center, a line from the center to the point
it touches and, with Measurement Labels on, its radius by the pointer, followed by an asterisk for an arc's own
radius. A click draws the circle, and a press dragged 2 screen points or more, or canceled with Escape, draws nothing;
Shift held at the press puts the circle on the other side of the path. On a straight segment, at a cusp or a corner, or where the circle would
reach past the canvas, the pointer shows "Straight segment", "Cusp" or "Circle too large", and a click draws nothing.
```json
{"name":"run_command","arguments":{"command":"shape.curvatureCircle","params":{"id":12,"segment":0,"t":0.5}}}
```
## Editing a path with the Curvature tool
The Curvature tool edits any selected path, whatever drew it, keeping its shape except where edited (#798). Each edit