@retikz/core 0.3.0-alpha.3 → 0.3.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -41
- package/dist/es/compile/anchor-cache.d.ts +5 -3
- package/dist/es/compile/anchor-cache.d.ts.map +1 -1
- package/dist/es/compile/anchor-cache.js +14 -10
- package/dist/es/compile/boundary.d.ts +19 -0
- package/dist/es/compile/boundary.d.ts.map +1 -0
- package/dist/es/compile/boundary.js +64 -0
- package/dist/es/compile/compile.d.ts.map +1 -1
- package/dist/es/compile/compile.js +14 -2
- package/dist/es/compile/node.d.ts +24 -8
- package/dist/es/compile/node.d.ts.map +1 -1
- package/dist/es/compile/node.js +100 -16
- package/dist/es/compile/path/anchor.d.ts.map +1 -1
- package/dist/es/compile/path/anchor.js +7 -6
- package/dist/es/compile/path/index.d.ts.map +1 -1
- package/dist/es/compile/path/index.js +5 -3
- package/dist/es/compile/path/relative.js +1 -1
- package/dist/es/compile/scope.d.ts.map +1 -1
- package/dist/es/compile/scope.js +2 -1
- package/dist/es/geometry/arc.d.ts +14 -0
- package/dist/es/geometry/arc.d.ts.map +1 -1
- package/dist/es/geometry/arc.js +65 -9
- package/dist/es/geometry/index.d.ts +1 -0
- package/dist/es/geometry/index.d.ts.map +1 -1
- package/dist/es/geometry/rect.d.ts +2 -2
- package/dist/es/geometry/rect.d.ts.map +1 -1
- package/dist/es/geometry/rect.js +3 -3
- package/dist/es/geometry/roundedContour.d.ts +88 -0
- package/dist/es/geometry/roundedContour.d.ts.map +1 -0
- package/dist/es/geometry/roundedContour.js +417 -0
- package/dist/es/index.d.ts +6 -5
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +9 -6
- package/dist/es/ir/boundary.d.ts +25 -0
- package/dist/es/ir/boundary.d.ts.map +1 -0
- package/dist/es/ir/boundary.js +14 -0
- package/dist/es/ir/index.d.ts +2 -0
- package/dist/es/ir/index.d.ts.map +1 -1
- package/dist/es/ir/node.d.ts +43 -7
- package/dist/es/ir/node.d.ts.map +1 -1
- package/dist/es/ir/node.js +8 -3
- package/dist/es/ir/path/arrow.d.ts +12 -12
- package/dist/es/ir/path/path.d.ts +490 -147
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +2 -0
- package/dist/es/ir/path/step.d.ts +674 -154
- package/dist/es/ir/path/step.d.ts.map +1 -1
- package/dist/es/ir/path/step.js +2 -2
- package/dist/es/ir/path/target.d.ts +43 -8
- package/dist/es/ir/path/target.d.ts.map +1 -1
- package/dist/es/ir/path/target.js +4 -5
- package/dist/es/ir/scope.d.ts +843 -234
- package/dist/es/ir/scope.d.ts.map +1 -1
- package/dist/es/ir/scope.js +6 -2
- package/dist/es/ir/shape.d.ts +14 -0
- package/dist/es/ir/shape.d.ts.map +1 -0
- package/dist/es/ir/shape.js +9 -0
- package/dist/es/parsers/parseNodeTarget.d.ts.map +1 -1
- package/dist/es/parsers/parseNodeTarget.js +4 -2
- package/dist/es/primitive/ellipse.d.ts +3 -0
- package/dist/es/primitive/ellipse.d.ts.map +1 -1
- package/dist/es/primitive/group.d.ts +3 -0
- package/dist/es/primitive/group.d.ts.map +1 -1
- package/dist/es/primitive/path.d.ts +3 -0
- package/dist/es/primitive/path.d.ts.map +1 -1
- package/dist/es/primitive/rect.d.ts +3 -0
- package/dist/es/primitive/rect.d.ts.map +1 -1
- package/dist/es/primitive/text.d.ts +3 -0
- package/dist/es/primitive/text.d.ts.map +1 -1
- package/dist/es/shapes/_contour.d.ts +19 -0
- package/dist/es/shapes/_contour.d.ts.map +1 -0
- package/dist/es/shapes/_contour.js +60 -0
- package/dist/es/shapes/_shared.d.ts +54 -0
- package/dist/es/shapes/_shared.d.ts.map +1 -1
- package/dist/es/shapes/_shared.js +68 -1
- package/dist/es/shapes/arc.d.ts +8 -0
- package/dist/es/shapes/arc.d.ts.map +1 -0
- package/dist/es/shapes/arc.js +104 -0
- package/dist/es/shapes/define.d.ts +13 -0
- package/dist/es/shapes/define.d.ts.map +1 -0
- package/dist/es/shapes/define.js +13 -0
- package/dist/es/shapes/ellipse.d.ts +5 -4
- package/dist/es/shapes/ellipse.d.ts.map +1 -1
- package/dist/es/shapes/ellipse.js +15 -7
- package/dist/es/shapes/index.d.ts +9 -6
- package/dist/es/shapes/index.d.ts.map +1 -1
- package/dist/es/shapes/index.js +10 -5
- package/dist/es/shapes/polygon.d.ts +13 -0
- package/dist/es/shapes/polygon.d.ts.map +1 -0
- package/dist/es/shapes/polygon.js +104 -0
- package/dist/es/shapes/rectangle.d.ts +7 -5
- package/dist/es/shapes/rectangle.d.ts.map +1 -1
- package/dist/es/shapes/rectangle.js +37 -8
- package/dist/es/shapes/sector.d.ts +9 -0
- package/dist/es/shapes/sector.d.ts.map +1 -0
- package/dist/es/shapes/sector.js +143 -0
- package/dist/es/shapes/star.d.ts +15 -0
- package/dist/es/shapes/star.d.ts.map +1 -0
- package/dist/es/shapes/star.js +113 -0
- package/dist/es/shapes/types.d.ts +47 -14
- package/dist/es/shapes/types.d.ts.map +1 -1
- package/dist/lib/compile/anchor-cache.cjs +14 -10
- package/dist/lib/compile/anchor-cache.d.ts +5 -3
- package/dist/lib/compile/anchor-cache.d.ts.map +1 -1
- package/dist/lib/compile/boundary.cjs +65 -0
- package/dist/lib/compile/boundary.d.ts +19 -0
- package/dist/lib/compile/boundary.d.ts.map +1 -0
- package/dist/lib/compile/compile.cjs +14 -2
- package/dist/lib/compile/compile.d.ts.map +1 -1
- package/dist/lib/compile/node.cjs +100 -16
- package/dist/lib/compile/node.d.ts +24 -8
- package/dist/lib/compile/node.d.ts.map +1 -1
- package/dist/lib/compile/path/anchor.cjs +7 -6
- package/dist/lib/compile/path/anchor.d.ts.map +1 -1
- package/dist/lib/compile/path/index.cjs +5 -3
- package/dist/lib/compile/path/index.d.ts.map +1 -1
- package/dist/lib/compile/path/relative.cjs +1 -1
- package/dist/lib/compile/scope.cjs +2 -1
- package/dist/lib/compile/scope.d.ts.map +1 -1
- package/dist/lib/geometry/arc.cjs +66 -8
- package/dist/lib/geometry/arc.d.ts +14 -0
- package/dist/lib/geometry/arc.d.ts.map +1 -1
- package/dist/lib/geometry/index.d.ts +1 -0
- package/dist/lib/geometry/index.d.ts.map +1 -1
- package/dist/lib/geometry/rect.cjs +3 -3
- package/dist/lib/geometry/rect.d.ts +2 -2
- package/dist/lib/geometry/rect.d.ts.map +1 -1
- package/dist/lib/geometry/roundedContour.cjs +418 -0
- package/dist/lib/geometry/roundedContour.d.ts +88 -0
- package/dist/lib/geometry/roundedContour.d.ts.map +1 -0
- package/dist/lib/index.cjs +14 -7
- package/dist/lib/index.d.ts +6 -5
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/boundary.cjs +15 -0
- package/dist/lib/ir/boundary.d.ts +25 -0
- package/dist/lib/ir/boundary.d.ts.map +1 -0
- package/dist/lib/ir/index.d.ts +2 -0
- package/dist/lib/ir/index.d.ts.map +1 -1
- package/dist/lib/ir/node.cjs +8 -3
- package/dist/lib/ir/node.d.ts +43 -7
- package/dist/lib/ir/node.d.ts.map +1 -1
- package/dist/lib/ir/path/arrow.d.ts +12 -12
- package/dist/lib/ir/path/path.cjs +2 -0
- package/dist/lib/ir/path/path.d.ts +490 -147
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/path/step.cjs +2 -2
- package/dist/lib/ir/path/step.d.ts +674 -154
- package/dist/lib/ir/path/step.d.ts.map +1 -1
- package/dist/lib/ir/path/target.cjs +4 -5
- package/dist/lib/ir/path/target.d.ts +43 -8
- package/dist/lib/ir/path/target.d.ts.map +1 -1
- package/dist/lib/ir/scope.cjs +6 -2
- package/dist/lib/ir/scope.d.ts +843 -234
- package/dist/lib/ir/scope.d.ts.map +1 -1
- package/dist/lib/ir/shape.cjs +9 -0
- package/dist/lib/ir/shape.d.ts +14 -0
- package/dist/lib/ir/shape.d.ts.map +1 -0
- package/dist/lib/parsers/parseNodeTarget.cjs +4 -2
- package/dist/lib/parsers/parseNodeTarget.d.ts.map +1 -1
- package/dist/lib/primitive/ellipse.d.ts +3 -0
- package/dist/lib/primitive/ellipse.d.ts.map +1 -1
- package/dist/lib/primitive/group.d.ts +3 -0
- package/dist/lib/primitive/group.d.ts.map +1 -1
- package/dist/lib/primitive/path.d.ts +3 -0
- package/dist/lib/primitive/path.d.ts.map +1 -1
- package/dist/lib/primitive/rect.d.ts +3 -0
- package/dist/lib/primitive/rect.d.ts.map +1 -1
- package/dist/lib/primitive/text.d.ts +3 -0
- package/dist/lib/primitive/text.d.ts.map +1 -1
- package/dist/lib/shapes/_contour.cjs +61 -0
- package/dist/lib/shapes/_contour.d.ts +19 -0
- package/dist/lib/shapes/_contour.d.ts.map +1 -0
- package/dist/lib/shapes/_shared.cjs +70 -0
- package/dist/lib/shapes/_shared.d.ts +54 -0
- package/dist/lib/shapes/_shared.d.ts.map +1 -1
- package/dist/lib/shapes/arc.cjs +104 -0
- package/dist/lib/shapes/arc.d.ts +8 -0
- package/dist/lib/shapes/arc.d.ts.map +1 -0
- package/dist/lib/shapes/define.cjs +13 -0
- package/dist/lib/shapes/define.d.ts +13 -0
- package/dist/lib/shapes/define.d.ts.map +1 -0
- package/dist/lib/shapes/ellipse.cjs +15 -7
- package/dist/lib/shapes/ellipse.d.ts +5 -4
- package/dist/lib/shapes/ellipse.d.ts.map +1 -1
- package/dist/lib/shapes/index.cjs +12 -6
- package/dist/lib/shapes/index.d.ts +9 -6
- package/dist/lib/shapes/index.d.ts.map +1 -1
- package/dist/lib/shapes/polygon.cjs +104 -0
- package/dist/lib/shapes/polygon.d.ts +13 -0
- package/dist/lib/shapes/polygon.d.ts.map +1 -0
- package/dist/lib/shapes/rectangle.cjs +37 -8
- package/dist/lib/shapes/rectangle.d.ts +7 -5
- package/dist/lib/shapes/rectangle.d.ts.map +1 -1
- package/dist/lib/shapes/sector.cjs +143 -0
- package/dist/lib/shapes/sector.d.ts +9 -0
- package/dist/lib/shapes/sector.d.ts.map +1 -0
- package/dist/lib/shapes/star.cjs +113 -0
- package/dist/lib/shapes/star.d.ts +15 -0
- package/dist/lib/shapes/star.d.ts.map +1 -0
- package/dist/lib/shapes/types.d.ts +47 -14
- package/dist/lib/shapes/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/es/shapes/circle.d.ts +0 -8
- package/dist/es/shapes/circle.d.ts.map +0 -1
- package/dist/es/shapes/circle.js +0 -34
- package/dist/es/shapes/diamond.d.ts +0 -8
- package/dist/es/shapes/diamond.d.ts.map +0 -1
- package/dist/es/shapes/diamond.js +0 -66
- package/dist/lib/shapes/circle.cjs +0 -34
- package/dist/lib/shapes/circle.d.ts +0 -8
- package/dist/lib/shapes/circle.d.ts.map +0 -1
- package/dist/lib/shapes/diamond.cjs +0 -66
- package/dist/lib/shapes/diamond.d.ts +0 -8
- package/dist/lib/shapes/diamond.d.ts.map +0 -1
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { arcAngleInRange, rayArc } from "./arc.js";
|
|
2
|
+
//#region src/geometry/roundedContour.ts
|
|
3
|
+
var DEG_TO_RAD = Math.PI / 180;
|
|
4
|
+
var RAD_TO_DEG = 180 / Math.PI;
|
|
5
|
+
var EPSILON = 1e-9;
|
|
6
|
+
/** 向量长度 */
|
|
7
|
+
var length = (v) => Math.hypot(v[0], v[1]);
|
|
8
|
+
/** 归一化(零向量回退 [1, 0]) */
|
|
9
|
+
var normalize = (v) => {
|
|
10
|
+
const len = length(v);
|
|
11
|
+
if (len < EPSILON) return [1, 0];
|
|
12
|
+
return [v[0] / len, v[1] / len];
|
|
13
|
+
};
|
|
14
|
+
/** 二维叉积 a × b */
|
|
15
|
+
var cross = (a, b) => a[0] * b[1] - a[1] * b[0];
|
|
16
|
+
/** 点 + 角度(度)→ 圆周点 */
|
|
17
|
+
var arcPoint = (center, radius, angleDeg) => {
|
|
18
|
+
const rad = angleDeg * DEG_TO_RAD;
|
|
19
|
+
return [center[0] + Math.cos(rad) * radius, center[1] + Math.sin(rad) * radius];
|
|
20
|
+
};
|
|
21
|
+
/** 段起点 */
|
|
22
|
+
var segmentStart = (seg) => seg.kind === "line" ? seg.from : arcPoint(seg.center, seg.radius, seg.startAngle);
|
|
23
|
+
/** 段终点 */
|
|
24
|
+
var segmentEnd = (seg) => seg.kind === "line" ? seg.to : arcPoint(seg.center, seg.radius, seg.endAngle);
|
|
25
|
+
/**
|
|
26
|
+
* 段在某端的「行进切线」单位向量
|
|
27
|
+
* @description atStart=true 取起点处沿行进方向的切线,否则取终点处。line 两端切线相同;
|
|
28
|
+
* arc 切线垂直于半径,方向随 counterClockwise 翻转(CW: (-sinθ, cosθ),CCW: (sinθ, -cosθ))。
|
|
29
|
+
*/
|
|
30
|
+
var tangentAt = (seg, atStart) => {
|
|
31
|
+
if (seg.kind === "line") return normalize([seg.to[0] - seg.from[0], seg.to[1] - seg.from[1]]);
|
|
32
|
+
const rad = (atStart ? seg.startAngle : seg.endAngle) * DEG_TO_RAD;
|
|
33
|
+
const sign = seg.counterClockwise ? -1 : 1;
|
|
34
|
+
return normalize([-Math.sin(rad) * sign, Math.cos(rad) * sign]);
|
|
35
|
+
};
|
|
36
|
+
/** arc 段的角跨度(带符号:CW 为正递增、CCW 为负),单位度 */
|
|
37
|
+
var arcSpan = (seg) => seg.endAngle - seg.startAngle;
|
|
38
|
+
/**
|
|
39
|
+
* 把一个点投影到段上、返回沿段的「已走比例」(line: t∈[0,1];arc: 已扫角 / 总跨度)
|
|
40
|
+
* @description 用于逐角夹紧:校验切点是否落在该段长度(弧用角度)内。返回 fraction 可能 <0 或 >1 表示越界。
|
|
41
|
+
*/
|
|
42
|
+
var fractionAlong = (seg, p, fromStart) => {
|
|
43
|
+
if (seg.kind === "line") {
|
|
44
|
+
const ex = seg.to[0] - seg.from[0];
|
|
45
|
+
const ey = seg.to[1] - seg.from[1];
|
|
46
|
+
const len2 = ex * ex + ey * ey;
|
|
47
|
+
if (len2 < EPSILON) return 0;
|
|
48
|
+
const t = ((p[0] - seg.from[0]) * ex + (p[1] - seg.from[1]) * ey) / len2;
|
|
49
|
+
return fromStart ? t : 1 - t;
|
|
50
|
+
}
|
|
51
|
+
const angle = Math.atan2(p[1] - seg.center[1], p[0] - seg.center[0]) * RAD_TO_DEG;
|
|
52
|
+
const span = Math.abs(arcSpan(seg));
|
|
53
|
+
if (span < EPSILON) return 0;
|
|
54
|
+
const ccw = seg.counterClockwise ?? false;
|
|
55
|
+
const ref = fromStart ? seg.startAngle : seg.endAngle;
|
|
56
|
+
let swept = ((fromStart ? ccw : !ccw) ? ref - angle : angle - ref) % 360;
|
|
57
|
+
if (swept < 0) swept += 360;
|
|
58
|
+
if (swept > 180) swept -= 360;
|
|
59
|
+
return swept / span;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* 段朝 fillet 圆心侧偏移 r:line→平行线、arc→同心圆。
|
|
63
|
+
* @description fillet 圆心所在侧由接缝转向 turnSign 决定(叉积 tIn×tOut):凸角圆心在轮廓内侧、
|
|
64
|
+
* 凹角(反向转)圆心在外侧(弧仍嵌入凹槽)。故偏移侧 = 行进方向左手 (-dy, dx) 乘 turnSign 符号。
|
|
65
|
+
* arc 同心偏移返回 radius−r 主候选;±r 两候选由 offsetSegmentAlt 补齐、求交后按真实距离校验择优。
|
|
66
|
+
*/
|
|
67
|
+
var offsetSegment = (seg, r, turnSign, atEnd) => {
|
|
68
|
+
if (seg.kind === "line") {
|
|
69
|
+
const dir = tangentAt(seg, true);
|
|
70
|
+
const sign = turnSign >= 0 ? 1 : -1;
|
|
71
|
+
const normal = [-dir[1] * sign, dir[0] * sign];
|
|
72
|
+
const base = atEnd ? seg.to : seg.from;
|
|
73
|
+
return {
|
|
74
|
+
kind: "line",
|
|
75
|
+
point: [base[0] + normal[0] * r, base[1] + normal[1] * r],
|
|
76
|
+
dir
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
kind: "circle",
|
|
81
|
+
center: seg.center,
|
|
82
|
+
radius: seg.radius - r
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
/** arc 段内侧偏移的另一候选(radius + r),与 offsetSegment 配合枚举 */
|
|
86
|
+
var offsetSegmentAlt = (seg, r) => ({
|
|
87
|
+
kind: "circle",
|
|
88
|
+
center: seg.center,
|
|
89
|
+
radius: seg.radius + r
|
|
90
|
+
});
|
|
91
|
+
/** 直线 ∩ 直线(各以 point + dir 表示),返回交点或 undefined(平行) */
|
|
92
|
+
var intersectLineLine = (a, b) => {
|
|
93
|
+
const det = cross(a.dir, b.dir);
|
|
94
|
+
if (Math.abs(det) < EPSILON) return void 0;
|
|
95
|
+
const dx = b.point[0] - a.point[0];
|
|
96
|
+
const dy = b.point[1] - a.point[1];
|
|
97
|
+
const t = (dx * b.dir[1] - dy * b.dir[0]) / det;
|
|
98
|
+
return [a.point[0] + a.dir[0] * t, a.point[1] + a.dir[1] * t];
|
|
99
|
+
};
|
|
100
|
+
/** 直线(point+dir)∩ 圆(center,radius),返回交点列(0/1/2 个) */
|
|
101
|
+
var intersectLineCircle = (line, circle) => {
|
|
102
|
+
const ox = line.point[0] - circle.center[0];
|
|
103
|
+
const oy = line.point[1] - circle.center[1];
|
|
104
|
+
const ux = line.dir[0];
|
|
105
|
+
const uy = line.dir[1];
|
|
106
|
+
const b = 2 * (ox * ux + oy * uy);
|
|
107
|
+
const c = ox * ox + oy * oy - circle.radius * circle.radius;
|
|
108
|
+
const disc = b * b - 4 * c;
|
|
109
|
+
if (disc < 0) return [];
|
|
110
|
+
const sq = Math.sqrt(disc);
|
|
111
|
+
const out = [];
|
|
112
|
+
for (const t of [(-b - sq) / 2, (-b + sq) / 2]) out.push([line.point[0] + ux * t, line.point[1] + uy * t]);
|
|
113
|
+
return out;
|
|
114
|
+
};
|
|
115
|
+
/** 圆 ∩ 圆,返回交点列(0/1/2 个) */
|
|
116
|
+
var intersectCircleCircle = (a, b) => {
|
|
117
|
+
const dx = b.center[0] - a.center[0];
|
|
118
|
+
const dy = b.center[1] - a.center[1];
|
|
119
|
+
const d = Math.hypot(dx, dy);
|
|
120
|
+
if (d < EPSILON || d > a.radius + b.radius + EPSILON || d < Math.abs(a.radius - b.radius) - EPSILON) return [];
|
|
121
|
+
const aa = (a.radius * a.radius - b.radius * b.radius + d * d) / (2 * d);
|
|
122
|
+
const h2 = a.radius * a.radius - aa * aa;
|
|
123
|
+
const h = h2 > 0 ? Math.sqrt(h2) : 0;
|
|
124
|
+
const mx = a.center[0] + aa * dx / d;
|
|
125
|
+
const my = a.center[1] + aa * dy / d;
|
|
126
|
+
const rx = -dy * h / d;
|
|
127
|
+
const ry = dx * h / d;
|
|
128
|
+
return [[mx + rx, my + ry], [mx - rx, my - ry]];
|
|
129
|
+
};
|
|
130
|
+
/** 点到直线(无限延长)的有符号垂足点 */
|
|
131
|
+
var footOnLine = (p, base, dir) => {
|
|
132
|
+
const t = (p[0] - base[0]) * dir[0] + (p[1] - base[1]) * dir[1];
|
|
133
|
+
return [base[0] + dir[0] * t, base[1] + dir[1] * t];
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* 解算一个接缝(segA 终点 = segB 起点)的 fillet
|
|
137
|
+
* @description segA / segB 至少一为 line(arc-arc 由调用方提前拒绝)。流程:
|
|
138
|
+
* 1. 取接缝点 corner、前段到达切线 tIn、后段离开切线 tOut,叉积 turnSign 定转向(含内侧)。
|
|
139
|
+
* 2. 由两段「内侧偏移 r」求 fillet 圆心:候选交点中挑离两段距离均≈r、且落在 corner 内侧的那个。
|
|
140
|
+
* 3. 圆心到两段的垂足 / 投影点 = 两切点。
|
|
141
|
+
* 4. 逐角夹紧:切点须落在两段剩余长度内(fraction∈[0,1]),越界则缩 r 重解;r→0 标记不倒。
|
|
142
|
+
*/
|
|
143
|
+
var solveFillet = (segA, segB, r) => {
|
|
144
|
+
if (segA.kind === "arc" && segB.kind === "arc") throw new Error("filletContour: arc-arc seam fillet is not supported");
|
|
145
|
+
const corner = segmentEnd(segA);
|
|
146
|
+
const turnSign = cross(tangentAt(segA, false), tangentAt(segB, true));
|
|
147
|
+
const attempt = (radius) => {
|
|
148
|
+
if (radius <= EPSILON) return void 0;
|
|
149
|
+
const offA = offsetSegment(segA, radius, turnSign, true);
|
|
150
|
+
const offB = offsetSegment(segB, radius, turnSign, false);
|
|
151
|
+
const candidates = [];
|
|
152
|
+
const pushIntersections = (oa, ob) => {
|
|
153
|
+
if (oa.kind === "line" && ob.kind === "line") {
|
|
154
|
+
const p = intersectLineLine(oa, ob);
|
|
155
|
+
if (p) candidates.push(p);
|
|
156
|
+
} else if (oa.kind === "line" && ob.kind === "circle") candidates.push(...intersectLineCircle(oa, ob));
|
|
157
|
+
else if (oa.kind === "circle" && ob.kind === "line") candidates.push(...intersectLineCircle(ob, oa));
|
|
158
|
+
else if (oa.kind === "circle" && ob.kind === "circle") candidates.push(...intersectCircleCircle(oa, ob));
|
|
159
|
+
};
|
|
160
|
+
pushIntersections(offA, offB);
|
|
161
|
+
if (segA.kind === "arc") pushIntersections(offsetSegmentAlt(segA, radius), offB);
|
|
162
|
+
if (segB.kind === "arc") pushIntersections(offA, offsetSegmentAlt(segB, radius));
|
|
163
|
+
if (segA.kind === "arc" && segB.kind === "arc") pushIntersections(offsetSegmentAlt(segA, radius), offsetSegmentAlt(segB, radius));
|
|
164
|
+
let best;
|
|
165
|
+
let bestDist = Infinity;
|
|
166
|
+
for (const cand of candidates) {
|
|
167
|
+
const tInPt = tangentPointOn(segA, cand, radius);
|
|
168
|
+
const tOutPt = tangentPointOn(segB, cand, radius);
|
|
169
|
+
if (!tInPt || !tOutPt) continue;
|
|
170
|
+
const dA = distanceToAny(segA, cand);
|
|
171
|
+
const dB = distanceToAny(segB, cand);
|
|
172
|
+
if (Math.abs(dA - radius) > 1e-6 || Math.abs(dB - radius) > 1e-6) continue;
|
|
173
|
+
const inFrac = fractionAlong(segA, tInPt, false);
|
|
174
|
+
const outFrac = fractionAlong(segB, tOutPt, true);
|
|
175
|
+
if (inFrac < -1e-7 || inFrac > .5000001 || outFrac < -1e-7 || outFrac > .5000001) continue;
|
|
176
|
+
const d = Math.hypot(cand[0] - corner[0], cand[1] - corner[1]);
|
|
177
|
+
if (d < bestDist) {
|
|
178
|
+
bestDist = d;
|
|
179
|
+
best = {
|
|
180
|
+
center: cand,
|
|
181
|
+
tInPt,
|
|
182
|
+
tOutPt,
|
|
183
|
+
inFrac,
|
|
184
|
+
outFrac
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (!best) return void 0;
|
|
189
|
+
const startAngle = Math.atan2(best.tInPt[1] - best.center[1], best.tInPt[0] - best.center[0]) * RAD_TO_DEG;
|
|
190
|
+
const endAngle = Math.atan2(best.tOutPt[1] - best.center[1], best.tOutPt[0] - best.center[0]) * RAD_TO_DEG;
|
|
191
|
+
const counterClockwise = turnSign < 0;
|
|
192
|
+
const adjusted = alignSweep(startAngle, endAngle, counterClockwise);
|
|
193
|
+
return {
|
|
194
|
+
tangentInPoint: best.tInPt,
|
|
195
|
+
tangentOutPoint: best.tOutPt,
|
|
196
|
+
center: best.center,
|
|
197
|
+
radius,
|
|
198
|
+
startAngle: adjusted.start,
|
|
199
|
+
endAngle: adjusted.end,
|
|
200
|
+
counterClockwise,
|
|
201
|
+
clampedToZero: false
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
const direct = attempt(r);
|
|
205
|
+
if (direct) return direct;
|
|
206
|
+
let lo = 0;
|
|
207
|
+
let hi = r;
|
|
208
|
+
let bestSolution;
|
|
209
|
+
for (let iter = 0; iter < 48; iter++) {
|
|
210
|
+
const mid = (lo + hi) / 2;
|
|
211
|
+
const sol = attempt(mid);
|
|
212
|
+
if (sol) {
|
|
213
|
+
bestSolution = sol;
|
|
214
|
+
lo = mid;
|
|
215
|
+
} else hi = mid;
|
|
216
|
+
}
|
|
217
|
+
if (bestSolution) return bestSolution;
|
|
218
|
+
return {
|
|
219
|
+
tangentInPoint: corner,
|
|
220
|
+
tangentOutPoint: corner,
|
|
221
|
+
center: corner,
|
|
222
|
+
radius: 0,
|
|
223
|
+
startAngle: 0,
|
|
224
|
+
endAngle: 0,
|
|
225
|
+
counterClockwise: false,
|
|
226
|
+
clampedToZero: true
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
/** 点到段(line / arc 所在直线 / 圆)的距离 */
|
|
230
|
+
var distanceToAny = (seg, p) => {
|
|
231
|
+
if (seg.kind === "line") {
|
|
232
|
+
const dir = tangentAt(seg, true);
|
|
233
|
+
const foot = footOnLine(p, seg.from, dir);
|
|
234
|
+
return Math.hypot(p[0] - foot[0], p[1] - foot[1]);
|
|
235
|
+
}
|
|
236
|
+
const d = Math.hypot(p[0] - seg.center[0], p[1] - seg.center[1]);
|
|
237
|
+
return Math.abs(d - seg.radius);
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* fillet 圆心 → 段上切点
|
|
241
|
+
* @description line:圆心在直线上的垂足。arc:圆心与 arc 圆心连线 ∩ arc 圆周(朝 fillet 圆心一侧)。
|
|
242
|
+
* 切点须落在段几何上(line 在线上、arc 在弧角度区间内)才有效,否则返回 undefined。
|
|
243
|
+
*/
|
|
244
|
+
var tangentPointOn = (seg, filletCenter, radius) => {
|
|
245
|
+
if (seg.kind === "line") {
|
|
246
|
+
const dir = tangentAt(seg, true);
|
|
247
|
+
return footOnLine(filletCenter, seg.from, dir);
|
|
248
|
+
}
|
|
249
|
+
const vx = filletCenter[0] - seg.center[0];
|
|
250
|
+
const vy = filletCenter[1] - seg.center[1];
|
|
251
|
+
const d = Math.hypot(vx, vy);
|
|
252
|
+
if (d < EPSILON) return void 0;
|
|
253
|
+
const ux = vx / d;
|
|
254
|
+
const uy = vy / d;
|
|
255
|
+
const candidates = [[seg.center[0] + ux * seg.radius, seg.center[1] + uy * seg.radius], [seg.center[0] - ux * seg.radius, seg.center[1] - uy * seg.radius]];
|
|
256
|
+
let best;
|
|
257
|
+
let bestErr = Infinity;
|
|
258
|
+
for (const cand of candidates) {
|
|
259
|
+
const angle = Math.atan2(cand[1] - seg.center[1], cand[0] - seg.center[0]) * RAD_TO_DEG;
|
|
260
|
+
if (!arcAngleInRange(seg.startAngle, seg.endAngle, angle, 1e-6)) continue;
|
|
261
|
+
const err = Math.abs(Math.hypot(cand[0] - filletCenter[0], cand[1] - filletCenter[1]) - radius);
|
|
262
|
+
if (err < bestErr) {
|
|
263
|
+
bestErr = err;
|
|
264
|
+
best = cand;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return bestErr <= 1e-6 ? best : void 0;
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* 对闭合轮廓的每个接缝做 fillet,返回 fillet 解算列表(与接缝一一对应,下标 i = 段 i 终点接段 (i+1)%n 起点)
|
|
271
|
+
* @description cornerRadius 省略 / ≤0 → 返回空数组(调用方据此 passthrough 原段序列)。arc-arc 接缝抛错。
|
|
272
|
+
*/
|
|
273
|
+
var filletContour = (segments, cornerRadius) => {
|
|
274
|
+
if (cornerRadius === void 0 || cornerRadius <= 0 || segments.length < 2) return [];
|
|
275
|
+
const n = segments.length;
|
|
276
|
+
const out = [];
|
|
277
|
+
for (let i = 0; i < n; i++) {
|
|
278
|
+
const segA = segments[i];
|
|
279
|
+
const segB = segments[(i + 1) % n];
|
|
280
|
+
out.push(solveFillet(segA, segB, cornerRadius));
|
|
281
|
+
}
|
|
282
|
+
return out;
|
|
283
|
+
};
|
|
284
|
+
/**
|
|
285
|
+
* 把闭合轮廓 + cornerRadius emit 成路径命令(move + 缩短 line + 裁剪原 arc + fillet arc + close)
|
|
286
|
+
* @description cornerRadius 省略 / ≤0 → 直接 emit 原始尖角轮廓(passthrough)。否则每段从「上一接缝的
|
|
287
|
+
* fillet 出点」走到「本接缝的 fillet 入点」(line 缩短 / arc 裁剪角度),接缝处插 fillet 弧。
|
|
288
|
+
* 夹紧到 0 的角不插弧、按原尖角连接。
|
|
289
|
+
*/
|
|
290
|
+
var contourCommands = (segments, cornerRadius) => {
|
|
291
|
+
const n = segments.length;
|
|
292
|
+
if (n === 0) return [];
|
|
293
|
+
const fillets = filletContour(segments, cornerRadius);
|
|
294
|
+
if (fillets.length === 0) {
|
|
295
|
+
const cmds = [];
|
|
296
|
+
segments.forEach((seg, i) => {
|
|
297
|
+
if (i === 0) cmds.push({
|
|
298
|
+
kind: "move",
|
|
299
|
+
to: segmentStart(seg)
|
|
300
|
+
});
|
|
301
|
+
emitSegmentBody(seg, segmentStart(seg), segmentEnd(seg), cmds);
|
|
302
|
+
});
|
|
303
|
+
cmds.push({ kind: "close" });
|
|
304
|
+
return cmds;
|
|
305
|
+
}
|
|
306
|
+
const cmds = [];
|
|
307
|
+
for (let i = 0; i < n; i++) {
|
|
308
|
+
const seg = segments[i];
|
|
309
|
+
const prevFillet = fillets[(i - 1 + n) % n];
|
|
310
|
+
const thisFillet = fillets[i];
|
|
311
|
+
const start = prevFillet.clampedToZero ? segmentStart(seg) : prevFillet.tangentOutPoint;
|
|
312
|
+
const end = thisFillet.clampedToZero ? segmentEnd(seg) : thisFillet.tangentInPoint;
|
|
313
|
+
if (i === 0) cmds.push({
|
|
314
|
+
kind: "move",
|
|
315
|
+
to: start
|
|
316
|
+
});
|
|
317
|
+
emitSegmentBody(seg, start, end, cmds);
|
|
318
|
+
if (!thisFillet.clampedToZero) cmds.push({
|
|
319
|
+
kind: "arc",
|
|
320
|
+
center: thisFillet.center,
|
|
321
|
+
radius: thisFillet.radius,
|
|
322
|
+
startAngle: thisFillet.startAngle,
|
|
323
|
+
endAngle: thisFillet.endAngle,
|
|
324
|
+
counterClockwise: thisFillet.counterClockwise
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
cmds.push({ kind: "close" });
|
|
328
|
+
return cmds;
|
|
329
|
+
};
|
|
330
|
+
/** emit 单段主体(line → line 命令到 end;arc → 裁剪角度的 arc 命令到 end),起点由调用方先 move/前段给出 */
|
|
331
|
+
var emitSegmentBody = (seg, start, end, cmds) => {
|
|
332
|
+
if (seg.kind === "line") {
|
|
333
|
+
cmds.push({
|
|
334
|
+
kind: "line",
|
|
335
|
+
to: end
|
|
336
|
+
});
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const adjusted = alignSweep(Math.atan2(start[1] - seg.center[1], start[0] - seg.center[0]) * RAD_TO_DEG, Math.atan2(end[1] - seg.center[1], end[0] - seg.center[0]) * RAD_TO_DEG, seg.counterClockwise ?? false);
|
|
340
|
+
cmds.push({
|
|
341
|
+
kind: "arc",
|
|
342
|
+
center: seg.center,
|
|
343
|
+
radius: seg.radius,
|
|
344
|
+
startAngle: adjusted.start,
|
|
345
|
+
endAngle: adjusted.end,
|
|
346
|
+
counterClockwise: seg.counterClockwise
|
|
347
|
+
});
|
|
348
|
+
};
|
|
349
|
+
/** 调整 endAngle 使「start→end」沿给定扫描方向(ccw: 递减 / 否则递增),保持裁剪后弧方向不变 */
|
|
350
|
+
var alignSweep = (start, end, ccw) => {
|
|
351
|
+
let e = end;
|
|
352
|
+
if (ccw) {
|
|
353
|
+
while (e > start) e -= 360;
|
|
354
|
+
while (e <= start - 360) e += 360;
|
|
355
|
+
} else {
|
|
356
|
+
while (e < start) e += 360;
|
|
357
|
+
while (e >= start + 360) e -= 360;
|
|
358
|
+
}
|
|
359
|
+
return {
|
|
360
|
+
start,
|
|
361
|
+
end: e
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* 从 rayOrigin 朝 toward 射线 ∩ fillet 后轮廓全部段,返回最近正向交点
|
|
366
|
+
* @description rayOrigin 显式传(不假设中心);toward 是射线指向的目标点(方向 = toward − rayOrigin)。
|
|
367
|
+
* 遍历 fillet 后的有效段(缩短 line / 裁剪 arc / fillet arc),对每段求 ray∩段、取最小正参数命中点。
|
|
368
|
+
* cornerRadius 省略 / ≤0 → 走原尖角轮廓。无命中返回 undefined(调用方兜底)。
|
|
369
|
+
*/
|
|
370
|
+
var boundaryFromContour = (segments, cornerRadius, rayOrigin, toward) => {
|
|
371
|
+
const dirRaw = [toward[0] - rayOrigin[0], toward[1] - rayOrigin[1]];
|
|
372
|
+
const dl = length(dirRaw);
|
|
373
|
+
if (dl < 1e-12) return void 0;
|
|
374
|
+
const dir = [dirRaw[0] / dl, dirRaw[1] / dl];
|
|
375
|
+
const n = segments.length;
|
|
376
|
+
const fillets = filletContour(segments, cornerRadius);
|
|
377
|
+
let best = Infinity;
|
|
378
|
+
const considerLine = (a, b) => {
|
|
379
|
+
const ex = b[0] - a[0];
|
|
380
|
+
const ey = b[1] - a[1];
|
|
381
|
+
const det = dir[0] * -ey - -ex * dir[1];
|
|
382
|
+
if (Math.abs(det) < 1e-12) return;
|
|
383
|
+
const ax = a[0] - rayOrigin[0];
|
|
384
|
+
const ay = a[1] - rayOrigin[1];
|
|
385
|
+
const s = (ax * -ey - -ex * ay) / det;
|
|
386
|
+
const t = (dir[0] * ay - ax * dir[1]) / det;
|
|
387
|
+
if (s <= 1e-9 || s >= best) return;
|
|
388
|
+
if (t >= -1e-9 && t <= 1.000000001) best = s;
|
|
389
|
+
};
|
|
390
|
+
const considerArc = (center, radius, startAngle, endAngle, ccw) => {
|
|
391
|
+
const aligned = alignSweep(startAngle, endAngle, ccw);
|
|
392
|
+
const hits = rayArc(rayOrigin, dir, center, radius, aligned.start, aligned.end);
|
|
393
|
+
for (const s of hits) if (s > 1e-9 && s < best) best = s;
|
|
394
|
+
};
|
|
395
|
+
if (fillets.length === 0) for (let i = 0; i < n; i++) {
|
|
396
|
+
const seg = segments[i];
|
|
397
|
+
if (seg.kind === "line") considerLine(seg.from, seg.to);
|
|
398
|
+
else considerArc(seg.center, seg.radius, seg.startAngle, seg.endAngle, seg.counterClockwise ?? false);
|
|
399
|
+
}
|
|
400
|
+
else for (let i = 0; i < n; i++) {
|
|
401
|
+
const seg = segments[i];
|
|
402
|
+
const prevFillet = fillets[(i - 1 + n) % n];
|
|
403
|
+
const thisFillet = fillets[i];
|
|
404
|
+
const start = prevFillet.clampedToZero ? segmentStart(seg) : prevFillet.tangentOutPoint;
|
|
405
|
+
const end = thisFillet.clampedToZero ? segmentEnd(seg) : thisFillet.tangentInPoint;
|
|
406
|
+
if (seg.kind === "line") considerLine(start, end);
|
|
407
|
+
else {
|
|
408
|
+
const aligned = alignSweep(Math.atan2(start[1] - seg.center[1], start[0] - seg.center[0]) * RAD_TO_DEG, Math.atan2(end[1] - seg.center[1], end[0] - seg.center[0]) * RAD_TO_DEG, seg.counterClockwise ?? false);
|
|
409
|
+
considerArc(seg.center, seg.radius, aligned.start, aligned.end, seg.counterClockwise ?? false);
|
|
410
|
+
}
|
|
411
|
+
if (!thisFillet.clampedToZero) considerArc(thisFillet.center, thisFillet.radius, thisFillet.startAngle, thisFillet.endAngle, thisFillet.counterClockwise);
|
|
412
|
+
}
|
|
413
|
+
if (!Number.isFinite(best)) return void 0;
|
|
414
|
+
return [rayOrigin[0] + dir[0] * best, rayOrigin[1] + dir[1] * best];
|
|
415
|
+
};
|
|
416
|
+
//#endregion
|
|
417
|
+
export { boundaryFromContour, contourCommands };
|
package/dist/es/index.d.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* @retikz/core 公开 API
|
|
3
3
|
* @description 任何 framework adapter(@retikz/react、@retikz/vue、@retikz/render/canvas、@retikz/ssr)只能 import 本文件导出内容,不准走子路径。本包零 React/零 DOM 依赖
|
|
4
4
|
*/
|
|
5
|
-
export { PositionSchema, PolarPositionSchema, AtPositionSchema, OffsetPositionSchema, AT_DIRECTIONS, TargetSchema, AnchorRefSchema, NodeTargetSchema, RelativeTargetSchema, RelativeAccumulateTargetSchema, AbsoluteTargetSchema, BetweenPositionSchema, MoveStepSchema, LineStepSchema, FoldStepSchema, CycleStepSchema, CurveStepSchema, CubicStepSchema, BendStepSchema, ArcStepSchema, CirclePathStepSchema, EllipsePathStepSchema, RectangleStepSchema, GeneratorStepSchema, ControlPointSchema, StepLabelSchema, StepSchema, NodeSchema, NodeLabelSchema, CoordinateSchema, FontSchema, TextBlockSchema, LineSpecSchema, PathSchema, ArrowDetailSchema, ArrowEndDetailSchema, ScopeSchema, CompositeBaseSchema, NodeDefaultSchema, PathDefaultSchema, LabelDefaultSchema, ArrowDefaultSchema, TransformSchema, ChildSchema, SceneSchema, CURRENT_IR_VERSION, PaintSpecSchema, GradientStopSchema, JsonValueSchema, JsonObjectSchema, ClipSpecSchema, ViewBoxSchema, } from './ir';
|
|
6
|
-
export type { IRPosition, IRAtPosition, IROffsetPosition, AtDirection, IRTarget, IRAnchorRef, IRNodeTarget, IRRelativeTarget, IRRelativeAccumulateTarget, IRAbsoluteTarget, IRBetweenPosition, IRMoveStep, IRLineStep, IRFoldStep, IRCycleStep, IRCurveStep, IRCubicStep, IRBendStep, IRArcStep, IRCirclePathStep, IREllipsePathStep, IRRectangleStep, IRGeneratorStep, IRControlPoint, IRStepLabel, IRStep, IRNode, IRNodeLabel, IRCoordinate, IRFont, IRLineSpec, IRTextBlock, IRPath, IRScope, IRComposite, IRNodeDefault, IRPathDefault, IRLabelDefault, IRArrowDefault, StyleChannel, IRTransform, IRTranslateTransform, IRPolarTranslateTransform, IRAtTranslateTransform, IROffsetTranslateTransform, IRRotateTransform, IRScaleTransform, IRChild, IR, ArrowShape, BuiltinArrowName, ArrowShapeName, IRArrowDetail, IRArrowEndDetail, NodeShape, BuiltinShapeName, NodeTextAlign, PatternShapeName, BuiltinPatternName, IRPaintSpec, IRGradientStop, JsonValue, IRJsonObject, IRClipSpec, IRViewBox, } from './ir';
|
|
7
|
-
export { ARROW_SHAPES, DEFAULT_ARROW_SHAPE, HOLLOW_ARROW_SHAPES, ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, NODE_SHAPES, NODE_TEXT_ALIGNS, PATTERN_SHAPES, } from './ir';
|
|
5
|
+
export { PositionSchema, PolarPositionSchema, AtPositionSchema, OffsetPositionSchema, AT_DIRECTIONS, TargetSchema, AnchorRefSchema, NodeTargetSchema, RelativeTargetSchema, RelativeAccumulateTargetSchema, AbsoluteTargetSchema, BetweenPositionSchema, MoveStepSchema, LineStepSchema, FoldStepSchema, CycleStepSchema, CurveStepSchema, CubicStepSchema, BendStepSchema, ArcStepSchema, CirclePathStepSchema, EllipsePathStepSchema, RectangleStepSchema, GeneratorStepSchema, ControlPointSchema, StepLabelSchema, StepSchema, NodeSchema, NodeLabelSchema, ShapeRefSchema, CoordinateSchema, FontSchema, TextBlockSchema, LineSpecSchema, PathSchema, ArrowDetailSchema, ArrowEndDetailSchema, ScopeSchema, CompositeBaseSchema, NodeDefaultSchema, PathDefaultSchema, LabelDefaultSchema, ArrowDefaultSchema, TransformSchema, ChildSchema, SceneSchema, CURRENT_IR_VERSION, PaintSpecSchema, GradientStopSchema, JsonValueSchema, JsonObjectSchema, ClipSpecSchema, ViewBoxSchema, } from './ir';
|
|
6
|
+
export type { IRPosition, IRAtPosition, IROffsetPosition, AtDirection, IRTarget, IRAnchorRef, IRNodeTarget, IRRelativeTarget, IRRelativeAccumulateTarget, IRAbsoluteTarget, IRBetweenPosition, IRMoveStep, IRLineStep, IRFoldStep, IRCycleStep, IRCurveStep, IRCubicStep, IRBendStep, IRArcStep, IRCirclePathStep, IREllipsePathStep, IRRectangleStep, IRGeneratorStep, IRControlPoint, IRStepLabel, IRStep, IRNode, IRNodeLabel, IRShapeRef, IRCoordinate, IRFont, IRLineSpec, IRTextBlock, IRPath, IRScope, IRComposite, IRNodeDefault, IRPathDefault, IRLabelDefault, IRArrowDefault, StyleChannel, IRTransform, IRTranslateTransform, IRPolarTranslateTransform, IRAtTranslateTransform, IROffsetTranslateTransform, IRRotateTransform, IRScaleTransform, IRChild, IR, ArrowShape, BuiltinArrowName, ArrowShapeName, IRArrowDetail, IRArrowEndDetail, NodeShape, BuiltinShapeName, NodeTextAlign, PatternShapeName, BuiltinPatternName, IRPaintSpec, IRGradientStop, JsonValue, IRJsonObject, IRClipSpec, IRViewBox, } from './ir';
|
|
7
|
+
export { ARROW_SHAPES, DEFAULT_ARROW_SHAPE, HOLLOW_ARROW_SHAPES, ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, NODE_SHAPES, NODE_TEXT_ALIGNS, PATTERN_SHAPES, Boundary, BoundarySchema, } from './ir';
|
|
8
|
+
export type { BoundaryKeyword, IRBoundary } from './ir';
|
|
8
9
|
export type { ScenePrimitive, RectPrim, EllipsePrim, TextPrim, TextLine, PathPrim, PathCommand,
|
|
9
10
|
/** 7 个 named PathCommand 分支(便于 wrapper / Pick<>) */
|
|
10
11
|
MovePathCommand, LinePathCommand, QuadPathCommand, CubicPathCommand, ArcPathCommand, EllipseArcPathCommand, ClosePathCommand, ArrowEndSpec, GroupPrim, Transform,
|
|
@@ -22,8 +23,8 @@ export type { WayItem, WayDSL, WayCycle, WayVia, WayRelativeItem, WayLabel, WayL
|
|
|
22
23
|
export { parseWay, DrawWay, parseTargetSugar, parseNodeTarget } from './parsers';
|
|
23
24
|
export type { Position, Rect, RectAnchor, Circle, Ellipse, Diamond, PolarPosition, } from './geometry';
|
|
24
25
|
export { point, rect, circle, ellipse, diamond, RECT_ANCHORS, polar } from './geometry';
|
|
25
|
-
export type { ShapeDefinition, ShapeStyle } from './shapes';
|
|
26
|
-
export { BUILTIN_SHAPES, worldToLocal, localToWorld } from './shapes';
|
|
26
|
+
export type { ShapeDefinition, ShapeDefinitionInput, ShapeStyle } from './shapes';
|
|
27
|
+
export { BUILTIN_SHAPES, defineShape, worldToLocal, localToWorld } from './shapes';
|
|
27
28
|
export type { ArrowDefinition, ArrowEmitContext } from './arrows';
|
|
28
29
|
export { BUILTIN_ARROWS } from './arrows';
|
|
29
30
|
export type { PatternDefinition, PatternEmitContext } from './patterns';
|
package/dist/es/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,8BAA8B,EAC9B,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,aAAa,GACd,MAAM,MAAM,CAAC;AACd,YAAY,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,cAAc,EACd,WAAW,EACX,MAAM,EACN,MAAM,EACN,WAAW,EACX,YAAY,EACZ,MAAM,EACN,UAAU,EACV,WAAW,EACX,MAAM,EACN,OAAO,EACP,WAAW,EACX,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,EAAE,EACF,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,SAAS,EACT,YAAY,EACZ,UAAU,EACV,SAAS,GACV,MAAM,MAAM,CAAC;AACd,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,sCAAsC,EACtC,WAAW,EACX,gBAAgB,EAChB,cAAc,GACf,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"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"}
|
package/dist/es/index.js
CHANGED
|
@@ -2,12 +2,12 @@ import { PositionSchema } from "./ir/position/position.js";
|
|
|
2
2
|
import { PolarPositionSchema } from "./ir/position/polar-position.js";
|
|
3
3
|
import { AT_DIRECTIONS, AtPositionSchema } from "./ir/position/at-position.js";
|
|
4
4
|
import { OffsetPositionSchema } from "./ir/position/offset-position.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { JsonObjectSchema, JsonValueSchema } from "./ir/json.js";
|
|
6
|
+
import { ShapeRefSchema } from "./ir/shape.js";
|
|
7
|
+
import { Boundary, BoundarySchema } from "./ir/boundary.js";
|
|
7
8
|
import { AnchorRefSchema, NodeTargetSchema, RelativeAccumulateTargetSchema, RelativeTargetSchema, TargetSchema } from "./ir/path/target.js";
|
|
8
9
|
import { AbsoluteTargetSchema, BetweenPositionSchema } from "./ir/position/between-position.js";
|
|
9
10
|
import { FontSchema } from "./ir/font.js";
|
|
10
|
-
import { JsonObjectSchema, JsonValueSchema } from "./ir/json.js";
|
|
11
11
|
import { GradientStopSchema, PATTERN_SHAPES, PaintSpecSchema } from "./ir/paint.js";
|
|
12
12
|
import { ClipSpecSchema } from "./ir/clip.js";
|
|
13
13
|
import { LineSpecSchema, TextBlockSchema } from "./ir/text.js";
|
|
@@ -20,9 +20,10 @@ import { TransformSchema } from "./ir/transform.js";
|
|
|
20
20
|
import { ArrowDefaultSchema, LabelDefaultSchema, NodeDefaultSchema, PathDefaultSchema, ScopeSchema } from "./ir/scope.js";
|
|
21
21
|
import { CompositeBaseSchema } from "./ir/composite.js";
|
|
22
22
|
import { CURRENT_IR_VERSION, ChildSchema, SceneSchema, ViewBoxSchema } from "./ir/scene.js";
|
|
23
|
-
import {
|
|
23
|
+
import { localToWorld, worldToLocal } from "./geometry/_transform.js";
|
|
24
|
+
import { RECT_ANCHORS, rect } from "./geometry/rect.js";
|
|
25
|
+
import { defineShape } from "./shapes/define.js";
|
|
24
26
|
import { ellipse } from "./geometry/ellipse.js";
|
|
25
|
-
import { diamond } from "./geometry/diamond.js";
|
|
26
27
|
import { BUILTIN_SHAPES } from "./shapes/index.js";
|
|
27
28
|
import { BUILTIN_ARROWS } from "./arrows/index.js";
|
|
28
29
|
import { BUILTIN_PATTERNS } from "./patterns/index.js";
|
|
@@ -34,6 +35,8 @@ import { parseTargetSugar } from "./parsers/parseTargetSugar.js";
|
|
|
34
35
|
import { DrawWay, parseWay } from "./parsers/parseWay.js";
|
|
35
36
|
import { polar } from "./geometry/polar.js";
|
|
36
37
|
import { point } from "./geometry/point.js";
|
|
38
|
+
import { circle } from "./geometry/circle.js";
|
|
39
|
+
import { diamond } from "./geometry/diamond.js";
|
|
37
40
|
import { definePathGenerator } from "./pathGenerators/define.js";
|
|
38
41
|
import { defineComposite } from "./composites/types.js";
|
|
39
|
-
export { ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, ARROW_SHAPES, AT_DIRECTIONS, AbsoluteTargetSchema, AnchorRefSchema, ArcStepSchema, ArrowDefaultSchema, ArrowDetailSchema, ArrowEndDetailSchema, AtPositionSchema, BUILTIN_ARROWS, BUILTIN_PATTERNS, BUILTIN_SHAPES, BendStepSchema, BetweenPositionSchema, CURRENT_IR_VERSION, ChildSchema, CirclePathStepSchema, ClipSpecSchema, CompositeBaseSchema, ControlPointSchema, CoordinateSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, DEFAULT_ARROW_SHAPE, DrawWay, EllipsePathStepSchema, FoldStepSchema, FontSchema, GeneratorStepSchema, GradientStopSchema, HOLLOW_ARROW_SHAPES, JsonObjectSchema, JsonValueSchema, LabelDefaultSchema, LineSpecSchema, LineStepSchema, MoveStepSchema, NODE_SHAPES, NODE_TEXT_ALIGNS, NodeDefaultSchema, NodeLabelSchema, NodeSchema, NodeTargetSchema, OffsetPositionSchema, PATTERN_SHAPES, PaintSpecSchema, PathDefaultSchema, PathSchema, PolarPositionSchema, PositionSchema, RECT_ANCHORS, RectangleStepSchema, RelativeAccumulateTargetSchema, RelativeTargetSchema, SceneSchema, ScopeSchema, StepLabelSchema, StepSchema, TargetSchema, TextBlockSchema, TransformSchema, ViewBoxSchema, circle, compileToScene, computeLayout, defineComposite, definePathGenerator, diamond, ellipse, fallbackMeasurer, localToWorld, parseNodeTarget, parseTargetSugar, parseWay, point, polar, rect, worldToLocal };
|
|
42
|
+
export { ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, ARROW_SHAPES, AT_DIRECTIONS, AbsoluteTargetSchema, AnchorRefSchema, ArcStepSchema, ArrowDefaultSchema, ArrowDetailSchema, ArrowEndDetailSchema, AtPositionSchema, BUILTIN_ARROWS, BUILTIN_PATTERNS, BUILTIN_SHAPES, BendStepSchema, BetweenPositionSchema, Boundary, BoundarySchema, CURRENT_IR_VERSION, ChildSchema, CirclePathStepSchema, ClipSpecSchema, CompositeBaseSchema, ControlPointSchema, CoordinateSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, DEFAULT_ARROW_SHAPE, DrawWay, EllipsePathStepSchema, FoldStepSchema, FontSchema, GeneratorStepSchema, GradientStopSchema, HOLLOW_ARROW_SHAPES, JsonObjectSchema, JsonValueSchema, LabelDefaultSchema, LineSpecSchema, LineStepSchema, MoveStepSchema, NODE_SHAPES, NODE_TEXT_ALIGNS, NodeDefaultSchema, NodeLabelSchema, NodeSchema, NodeTargetSchema, OffsetPositionSchema, PATTERN_SHAPES, PaintSpecSchema, PathDefaultSchema, PathSchema, PolarPositionSchema, PositionSchema, RECT_ANCHORS, RectangleStepSchema, RelativeAccumulateTargetSchema, RelativeTargetSchema, SceneSchema, ScopeSchema, ShapeRefSchema, StepLabelSchema, StepSchema, TargetSchema, TextBlockSchema, TransformSchema, ViewBoxSchema, circle, compileToScene, computeLayout, defineComposite, definePathGenerator, defineShape, diamond, ellipse, fallbackMeasurer, localToWorld, parseNodeTarget, parseTargetSugar, parseWay, point, polar, rect, worldToLocal };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ValueOf } from '../types';
|
|
3
|
+
/** 连接面引用:保留字 'shape'/'circle' 或借用已注册 shape(裸名 / {type, params}) */
|
|
4
|
+
export declare const BoundarySchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
5
|
+
type: z.ZodString;
|
|
6
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import('./json').JsonValue, z.ZodTypeDef, import('./json').JsonValue>>>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
type: string;
|
|
9
|
+
params?: Record<string, import('./json').JsonValue> | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
type: string;
|
|
12
|
+
params?: Record<string, import('./json').JsonValue> | undefined;
|
|
13
|
+
}>]>;
|
|
14
|
+
/** 连接面引用类型('shape' | 'circle' | 其它 shape 名 | {type, params}) */
|
|
15
|
+
export type IRBoundary = z.infer<typeof BoundarySchema>;
|
|
16
|
+
/** 连接面保留关键字:非「借用已注册 shape」的两个内置语义(编译期消解) */
|
|
17
|
+
export declare const Boundary: {
|
|
18
|
+
/** 连接面 = 节点自身视觉形状(默认) */
|
|
19
|
+
readonly Self: "shape";
|
|
20
|
+
/** 真圆:半径 = 节点 AABB 较长半轴 max(halfWidth, halfHeight) */
|
|
21
|
+
readonly Circle: "circle";
|
|
22
|
+
};
|
|
23
|
+
/** 连接面保留关键字联合('shape' | 'circle';其余取值为借用的 shape 引用) */
|
|
24
|
+
export type BoundaryKeyword = ValueOf<typeof Boundary>;
|
|
25
|
+
//# sourceMappingURL=boundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../../src/ir/boundary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGxC,mEAAmE;AACnE,eAAO,MAAM,cAAc;;;;;;;;;IAIxB,CAAC;AAEJ,gEAAgE;AAChE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAExD,4CAA4C;AAC5C,eAAO,MAAM,QAAQ;IACnB,yBAAyB;;IAEzB,sDAAsD;;CAE9C,CAAC;AAEX,uDAAuD;AACvD,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ShapeRefSchema } from "./shape.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/ir/boundary.ts
|
|
4
|
+
/** 连接面引用:保留字 'shape'/'circle' 或借用已注册 shape(裸名 / {type, params}) */
|
|
5
|
+
var BoundarySchema = z.union([z.string().min(1), ShapeRefSchema]).describe("Connection surface: how edges meet this node and how compass anchors resolve, independent of the visual `shape`. Reserved keywords: \"shape\" (default — the node's own visual shape) and \"circle\" (true circle, radius = larger AABB half-axis). Any other registered shape name (\"rectangle\" / \"ellipse\" / \"polygon\" / …) or `{ type, params }` borrows that shape's boundary over this node's bounding box. Layout-neutral: never changes the node footprint. Named shape-specific anchors and edge proportional points always resolve against the visual shape.");
|
|
6
|
+
/** 连接面保留关键字:非「借用已注册 shape」的两个内置语义(编译期消解) */
|
|
7
|
+
var Boundary = {
|
|
8
|
+
/** 连接面 = 节点自身视觉形状(默认) */
|
|
9
|
+
Self: "shape",
|
|
10
|
+
/** 真圆:半径 = 节点 AABB 较长半轴 max(halfWidth, halfHeight) */
|
|
11
|
+
Circle: "circle"
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Boundary, BoundarySchema };
|
package/dist/es/ir/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ir/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ir/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|