mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-29 01:34:29 +01:00
Docs: path.smoothRegion states its sampling limits and acceptance test
docs/mcp.md now says the measuring spacing is a target (at least 4 and at most 1,024 pieces per curved segment, fewer on subpaths of more than 256 segments) and gives the acceptance test as formulas: t1 <= t0 + 0.001 * s and fewer anchors, t0 - t1 >= 0.000001 * s, or b0 - b1 > 0.0001 * b0, with s the larger of t0 and 1. The roughness doc comment says the points are about `step` apart.
This commit is contained in:
1 parent
f312abf05a
commit
cd03842fb1
2 files changed
+11
-6
No files matched your search
@@ -686,7 +686,7 @@ const ROUGHNESS_SEGMENT_PIECES: usize = 1024;
|
||||
const ROUGHNESS_PIECES: usize = 1 << 18;
|
||||
|
||||
/// How rough the subpath `sp` is, measured along the lines between points on each curved segment
|
||||
/// no more than `step` apart along its control polygon (at least 4 and at most
|
||||
/// about `step` apart along its control polygon (at least 4 and at most
|
||||
/// [`ROUGHNESS_SEGMENT_PIECES`] pieces a segment, fewer on a subpath of very many segments): how
|
||||
/// much it turns along its length in radians, from the direction each segment leaves its first anchor
|
||||
/// along to the one it arrives at its last anchor along, with each turn at an anchor counted twice;
|
||||
|
||||
+10
-5
@@ -7234,11 +7234,16 @@ own, and the corner keeps its place and the directions the path arrives and leav
|
||||
`fidelity`. A call that changes no anchor returns `{ids: [], before: 0, after: 0}` and adds no undo step. The 57.5°
|
||||
threshold is VectorCraft's own value.
|
||||
|
||||
`path.smoothRegion` keeps a subpath's result only when it is smoother. Measured along lines between points no more
|
||||
than an eighth of `radius` apart (or 1/512 of the subpath's size when that is smaller), the result must turn no more
|
||||
than a thousandth more than the subpath did, with each turn at an anchor counted twice, and it must have fewer
|
||||
anchors, turn less, or bend more than a ten-thousandth less (the sum of each turn squared over the length it is taken
|
||||
over). Any other result is dropped and the subpath stays as it was. A path none of whose subpaths is kept stays a Live
|
||||
`path.smoothRegion` keeps a subpath's result only when it is smoother. It measures the subpath and the result along
|
||||
lines between points on each curved segment, spaced about `step` apart along the segment's control polygon, where
|
||||
`step` is an eighth of `radius` or 1/512 of the diagonal of the box around the subpath's anchors and handles,
|
||||
whichever is smaller. The spacing is a target: each curved segment is cut into at least 4 and at most 1,024 pieces,
|
||||
and on a subpath of more than 256 segments into at most 262,144 divided by the number of segments (but never fewer
|
||||
than 4). The turning `t` is how far the path's direction turns along its length, in radians, with each turn at an
|
||||
anchor counted twice; the bending `b` is the sum of each turn between two pieces squared over their mean length.
|
||||
With `t0` and `b0` measured on the subpath, `t1` and `b1` on the result, and `s` the larger of `t0` and 1, the result
|
||||
is kept when `t1 <= t0 + 0.001 * s` and at least one of these holds: it has fewer anchors, `t0 - t1 >= 0.000001 * s`,
|
||||
or `b0 - b1 > 0.0001 * b0`. Any other result is dropped and the subpath stays as it was. A path none of whose subpaths is kept stays a Live
|
||||
Shape if it was one, is left out of `ids` and is not counted in `before` or `after`. The measure and both thresholds
|
||||
are VectorCraft's own.
|
||||
|
||||
|
||||
Reference in new issue
Block a user