pantograph2d 0.4.0 → 0.6.0
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/dist/Diagram-ab93c8b7.cjs +11 -0
- package/dist/Diagram-ab93c8b7.cjs.map +1 -0
- package/dist/Diagram-d848c815.js +4252 -0
- package/dist/Diagram-d848c815.js.map +1 -0
- package/dist/draw-0f591ea4.cjs +2 -0
- package/dist/draw-0f591ea4.cjs.map +1 -0
- package/dist/draw-a830827a.js +288 -0
- package/dist/draw-a830827a.js.map +1 -0
- package/dist/pantograph/drawShape.cjs +1 -1
- package/dist/pantograph/drawShape.cjs.map +1 -1
- package/dist/pantograph/drawShape.js +13 -17
- package/dist/pantograph/drawShape.js.map +1 -1
- package/dist/pantograph/models.cjs +1 -1
- package/dist/pantograph/models.js +5 -5
- package/dist/pantograph.cjs +6 -6
- package/dist/pantograph.cjs.map +1 -1
- package/dist/pantograph.js +501 -294
- package/dist/pantograph.js.map +1 -1
- package/dist/types/algorithms/boolean/figureBooleans.d.ts +8 -0
- package/dist/types/algorithms/boolean/loopBooleans.d.ts +14 -0
- package/dist/types/algorithms/boolean/strandBoolean.d.ts +8 -0
- package/dist/types/algorithms/boolean/strandsBetweenIntersections.d.ts +4 -0
- package/dist/types/algorithms/distances/arcArcDistance.d.ts +2 -0
- package/dist/types/algorithms/distances/genericDistance.d.ts +6 -0
- package/dist/types/algorithms/distances/index.d.ts +2 -0
- package/dist/types/algorithms/distances/lineArcDistance.d.ts +3 -0
- package/dist/types/algorithms/distances/lineLineDistance.d.ts +2 -0
- package/dist/types/algorithms/filletSegments.d.ts +3 -0
- package/dist/types/algorithms/intersections/arcArcIntersection.d.ts +3 -0
- package/dist/types/algorithms/intersections/arcEllipseArcIntersection.d.ts +3 -0
- package/dist/types/algorithms/intersections/ellipseArcEllipseArcIntersection.d.ts +3 -0
- package/dist/types/algorithms/intersections/ellipseEllipseIntersection.d.ts +4 -0
- package/dist/types/algorithms/intersections/index.d.ts +8 -0
- package/dist/types/algorithms/intersections/lineArcIntersection.d.ts +4 -0
- package/dist/types/algorithms/intersections/lineEllipseArcIntersection.d.ts +4 -0
- package/dist/types/algorithms/intersections/lineLineIntersection.d.ts +28 -0
- package/dist/types/algorithms/intersections/rayIntersections.d.ts +3 -0
- package/dist/types/algorithms/offsets/offsetFigure.d.ts +4 -0
- package/dist/types/algorithms/offsets/offsetSegment.d.ts +12 -0
- package/dist/types/algorithms/offsets/offsetStroke.d.ts +9 -0
- package/dist/types/algorithms/optimisation/DiRect.d.ts +45 -0
- package/dist/types/algorithms/organiseLoops.d.ts +9 -0
- package/dist/types/algorithms/simplify.d.ts +3 -0
- package/dist/types/algorithms/solvers/solvePolynomials.d.ts +4 -0
- package/dist/types/algorithms/stitchSegments.d.ts +2 -0
- package/dist/types/api/drawShape.d.ts +2 -0
- package/dist/types/api/models.d.ts +1 -0
- package/dist/types/booleanOperations.d.ts +11 -0
- package/dist/types/definitions.d.ts +2 -0
- package/dist/types/draw.d.ts +47 -0
- package/dist/types/drawShape/drawCircle.d.ts +2 -0
- package/dist/types/drawShape/drawRect.d.ts +5 -0
- package/dist/types/export/json/exportJSON.d.ts +196 -0
- package/dist/types/export/json/jsonDiagram.d.ts +69 -0
- package/dist/types/export/json/jsonFigure.d.ts +66 -0
- package/dist/types/export/json/jsonLoop.d.ts +32 -0
- package/dist/types/export/json/jsonSegment.d.ts +29 -0
- package/dist/types/export/svg/exportSVG.d.ts +18 -0
- package/dist/types/export/svg/svgDiagram.d.ts +2 -0
- package/dist/types/export/svg/svgFigure.d.ts +2 -0
- package/dist/types/export/svg/svgLoop.d.ts +2 -0
- package/dist/types/export/svg/svgSegment.d.ts +2 -0
- package/dist/types/export/svg/svgStrand.d.ts +2 -0
- package/dist/types/export/svg/wrapSVG.d.ts +4 -0
- package/dist/types/import/json/importJSON.d.ts +7 -0
- package/dist/types/main.d.ts +12 -0
- package/dist/types/models/BoundingBox.d.ts +15 -0
- package/dist/types/models/Diagram.d.ts +25 -0
- package/dist/types/models/Figure.d.ts +23 -0
- package/dist/types/models/Loop.d.ts +18 -0
- package/dist/types/models/Strand.d.ts +10 -0
- package/dist/types/models/Stroke.d.ts +29 -0
- package/dist/types/models/TransformationMatrix.d.ts +31 -0
- package/dist/types/models/exports.d.ts +11 -0
- package/dist/types/models/segments/Arc.d.ts +52 -0
- package/dist/types/models/segments/EllipseArc.d.ts +70 -0
- package/dist/types/models/segments/Line.d.ts +32 -0
- package/dist/types/models/segments/Segment.d.ts +28 -0
- package/dist/types/models/utils/Transformable.d.ts +14 -0
- package/dist/types/offsetOperations.d.ts +8 -0
- package/dist/types/operations.d.ts +2 -0
- package/dist/types/utils/allCombinations.d.ts +2 -0
- package/dist/types/utils/allPairs.d.ts +1 -0
- package/dist/types/utils/angularDistance.d.ts +1 -0
- package/dist/types/utils/listOfFigures.d.ts +4 -0
- package/dist/types/utils/projectPointOnLine.d.ts +3 -0
- package/dist/types/utils/range.d.ts +1 -0
- package/dist/types/utils/removeDuplicatePoints.d.ts +2 -0
- package/dist/types/utils/unitAngle.d.ts +1 -0
- package/dist/types/utils/zip.d.ts +3 -0
- package/dist/types/vectorOperations.d.ts +23 -0
- package/package.json +29 -10
- package/dist/Diagram-1c56996e.js +0 -1698
- package/dist/Diagram-1c56996e.js.map +0 -1
- package/dist/Diagram-4fa55d2b.cjs +0 -4
- package/dist/Diagram-4fa55d2b.cjs.map +0 -1
- package/dist/draw-44dd36a9.js +0 -256
- package/dist/draw-44dd36a9.js.map +0 -1
- package/dist/draw-8c69c65f.cjs +0 -2
- package/dist/draw-8c69c65f.cjs.map +0 -1
- package/dist/drawShape.d.ts +0 -153
- package/dist/models.d.ts +0 -210
- package/dist/pantograph/drawShape.d.ts +0 -1
- package/dist/pantograph/models.d.ts +0 -1
- package/dist/pantograph.d.ts +0 -388
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Vector } from "./definitions.js";
|
|
2
|
+
import { Strand } from "./models/Strand.js";
|
|
3
|
+
import { Diagram } from "./models/Diagram.js";
|
|
4
|
+
import { Segment } from "./models/segments/Segment.js";
|
|
5
|
+
export declare class DrawingPen {
|
|
6
|
+
pointer: Vector;
|
|
7
|
+
protected firstPoint: Vector;
|
|
8
|
+
protected pendingSegments: Segment[];
|
|
9
|
+
protected _nextCorner: {
|
|
10
|
+
radius: number;
|
|
11
|
+
mode: "fillet" | "chamfer";
|
|
12
|
+
} | null;
|
|
13
|
+
constructor(origin?: Vector);
|
|
14
|
+
movePointerTo(point: Vector): this;
|
|
15
|
+
protected saveSegment(segment: Segment): this;
|
|
16
|
+
lineTo(point: Vector): this;
|
|
17
|
+
line(xDist: number, yDist: number): this;
|
|
18
|
+
vLine(distance: number): this;
|
|
19
|
+
hLine(distance: number): this;
|
|
20
|
+
vLineTo(yPos: number): this;
|
|
21
|
+
hLineTo(xPos: number): this;
|
|
22
|
+
polarLineTo([r, theta]: Vector): this;
|
|
23
|
+
polarLine(distance: number, angle: number): this;
|
|
24
|
+
tangentLine(distance: number): this;
|
|
25
|
+
threePointsArcTo(end: Vector, midPoint: Vector): this;
|
|
26
|
+
threePointsArc(xDist: number, yDist: number, viaXDist: number, viaYDist: number): this;
|
|
27
|
+
sagittaArcTo(end: Vector, sagitta: number): this;
|
|
28
|
+
sagittaArc(xDist: number, yDist: number, sagitta: number): this;
|
|
29
|
+
vSagittaArc(distance: number, sagitta: number): this;
|
|
30
|
+
hSagittaArc(distance: number, sagitta: number): this;
|
|
31
|
+
bulgeArcTo(end: Vector, bulge: number): this;
|
|
32
|
+
bulgeArc(xDist: number, yDist: number, bulge: number): this;
|
|
33
|
+
vBulgeArc(distance: number, bulge: number): this;
|
|
34
|
+
hBulgeArc(distance: number, bulge: number): this;
|
|
35
|
+
tangentArcTo(end: Vector, tangentAtStart?: Vector): this;
|
|
36
|
+
tangentArc(xDist: number, yDist: number, tangentAtStart?: Vector): this;
|
|
37
|
+
ellipseTo(end: Vector, r0: number, r1: number, xAxisRotation: number, longArc: boolean, sweepFlag: boolean): this;
|
|
38
|
+
ellipse(xDist: number, yDist: number, r0: number, r1: number, xAxisRotation: number, longArc: boolean, sweepFlag: boolean): this;
|
|
39
|
+
halfEllipseTo(end: Vector, sagitta: number): this;
|
|
40
|
+
halfEllipse(xDist: number, yDist: number, sagitta: number): this;
|
|
41
|
+
customCorner(radius: number, mode?: "fillet" | "chamfer"): this;
|
|
42
|
+
protected _customCornerLastWithFirst(radius: number, mode?: "fillet" | "chamfer"): void;
|
|
43
|
+
close(ignoreChecks?: boolean): Diagram;
|
|
44
|
+
closeWithMirror(ignoreChecks?: boolean): Diagram;
|
|
45
|
+
asStrand(): Strand;
|
|
46
|
+
}
|
|
47
|
+
export declare function draw(origin?: Vector): DrawingPen;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { Diagram } from "../../models/Diagram.js";
|
|
2
|
+
import { Figure } from "../../models/Figure.js";
|
|
3
|
+
import { Loop } from "../../models/Loop.js";
|
|
4
|
+
import { Arc } from "../../models/segments/Arc.js";
|
|
5
|
+
import { Line } from "../../models/segments/Line.js";
|
|
6
|
+
type Shape = Loop | Figure | Diagram | Arc | Line;
|
|
7
|
+
export declare function exportJSON(shape: Shape): {
|
|
8
|
+
type: string;
|
|
9
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
10
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
11
|
+
center?: undefined;
|
|
12
|
+
clockwise?: undefined;
|
|
13
|
+
majorRadius?: undefined;
|
|
14
|
+
minorRadius?: undefined;
|
|
15
|
+
tiltAngle?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
type: string;
|
|
18
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
19
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
20
|
+
center: import("../../definitions.js").Vector;
|
|
21
|
+
clockwise: boolean;
|
|
22
|
+
majorRadius?: undefined;
|
|
23
|
+
minorRadius?: undefined;
|
|
24
|
+
tiltAngle?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
type: string;
|
|
27
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
28
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
29
|
+
center: import("../../definitions.js").Vector;
|
|
30
|
+
clockwise: boolean;
|
|
31
|
+
majorRadius: number;
|
|
32
|
+
minorRadius: number;
|
|
33
|
+
tiltAngle: number;
|
|
34
|
+
} | {
|
|
35
|
+
type: string;
|
|
36
|
+
segments: ({
|
|
37
|
+
type: string;
|
|
38
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
39
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
40
|
+
center?: undefined;
|
|
41
|
+
clockwise?: undefined;
|
|
42
|
+
majorRadius?: undefined;
|
|
43
|
+
minorRadius?: undefined;
|
|
44
|
+
tiltAngle?: undefined;
|
|
45
|
+
} | {
|
|
46
|
+
type: string;
|
|
47
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
48
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
49
|
+
center: import("../../definitions.js").Vector;
|
|
50
|
+
clockwise: boolean;
|
|
51
|
+
majorRadius?: undefined;
|
|
52
|
+
minorRadius?: undefined;
|
|
53
|
+
tiltAngle?: undefined;
|
|
54
|
+
} | {
|
|
55
|
+
type: string;
|
|
56
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
57
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
58
|
+
center: import("../../definitions.js").Vector;
|
|
59
|
+
clockwise: boolean;
|
|
60
|
+
majorRadius: number;
|
|
61
|
+
minorRadius: number;
|
|
62
|
+
tiltAngle: number;
|
|
63
|
+
})[];
|
|
64
|
+
} | {
|
|
65
|
+
type: string;
|
|
66
|
+
contour: {
|
|
67
|
+
type: string;
|
|
68
|
+
segments: ({
|
|
69
|
+
type: string;
|
|
70
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
71
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
72
|
+
center?: undefined;
|
|
73
|
+
clockwise?: undefined;
|
|
74
|
+
majorRadius?: undefined;
|
|
75
|
+
minorRadius?: undefined;
|
|
76
|
+
tiltAngle?: undefined;
|
|
77
|
+
} | {
|
|
78
|
+
type: string;
|
|
79
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
80
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
81
|
+
center: import("../../definitions.js").Vector;
|
|
82
|
+
clockwise: boolean;
|
|
83
|
+
majorRadius?: undefined;
|
|
84
|
+
minorRadius?: undefined;
|
|
85
|
+
tiltAngle?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
type: string;
|
|
88
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
89
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
90
|
+
center: import("../../definitions.js").Vector;
|
|
91
|
+
clockwise: boolean;
|
|
92
|
+
majorRadius: number;
|
|
93
|
+
minorRadius: number;
|
|
94
|
+
tiltAngle: number;
|
|
95
|
+
})[];
|
|
96
|
+
};
|
|
97
|
+
holes: {
|
|
98
|
+
type: string;
|
|
99
|
+
segments: ({
|
|
100
|
+
type: string;
|
|
101
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
102
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
103
|
+
center?: undefined;
|
|
104
|
+
clockwise?: undefined;
|
|
105
|
+
majorRadius?: undefined;
|
|
106
|
+
minorRadius?: undefined;
|
|
107
|
+
tiltAngle?: undefined;
|
|
108
|
+
} | {
|
|
109
|
+
type: string;
|
|
110
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
111
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
112
|
+
center: import("../../definitions.js").Vector;
|
|
113
|
+
clockwise: boolean;
|
|
114
|
+
majorRadius?: undefined;
|
|
115
|
+
minorRadius?: undefined;
|
|
116
|
+
tiltAngle?: undefined;
|
|
117
|
+
} | {
|
|
118
|
+
type: string;
|
|
119
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
120
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
121
|
+
center: import("../../definitions.js").Vector;
|
|
122
|
+
clockwise: boolean;
|
|
123
|
+
majorRadius: number;
|
|
124
|
+
minorRadius: number;
|
|
125
|
+
tiltAngle: number;
|
|
126
|
+
})[];
|
|
127
|
+
}[];
|
|
128
|
+
} | {
|
|
129
|
+
type: string;
|
|
130
|
+
figures: {
|
|
131
|
+
type: string;
|
|
132
|
+
contour: {
|
|
133
|
+
type: string;
|
|
134
|
+
segments: ({
|
|
135
|
+
type: string;
|
|
136
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
137
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
138
|
+
center?: undefined;
|
|
139
|
+
clockwise?: undefined;
|
|
140
|
+
majorRadius?: undefined;
|
|
141
|
+
minorRadius?: undefined;
|
|
142
|
+
tiltAngle?: undefined;
|
|
143
|
+
} | {
|
|
144
|
+
type: string;
|
|
145
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
146
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
147
|
+
center: import("../../definitions.js").Vector;
|
|
148
|
+
clockwise: boolean;
|
|
149
|
+
majorRadius?: undefined;
|
|
150
|
+
minorRadius?: undefined;
|
|
151
|
+
tiltAngle?: undefined;
|
|
152
|
+
} | {
|
|
153
|
+
type: string;
|
|
154
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
155
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
156
|
+
center: import("../../definitions.js").Vector;
|
|
157
|
+
clockwise: boolean;
|
|
158
|
+
majorRadius: number;
|
|
159
|
+
minorRadius: number;
|
|
160
|
+
tiltAngle: number;
|
|
161
|
+
})[];
|
|
162
|
+
};
|
|
163
|
+
holes: {
|
|
164
|
+
type: string;
|
|
165
|
+
segments: ({
|
|
166
|
+
type: string;
|
|
167
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
168
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
169
|
+
center?: undefined;
|
|
170
|
+
clockwise?: undefined;
|
|
171
|
+
majorRadius?: undefined;
|
|
172
|
+
minorRadius?: undefined;
|
|
173
|
+
tiltAngle?: undefined;
|
|
174
|
+
} | {
|
|
175
|
+
type: string;
|
|
176
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
177
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
178
|
+
center: import("../../definitions.js").Vector;
|
|
179
|
+
clockwise: boolean;
|
|
180
|
+
majorRadius?: undefined;
|
|
181
|
+
minorRadius?: undefined;
|
|
182
|
+
tiltAngle?: undefined;
|
|
183
|
+
} | {
|
|
184
|
+
type: string;
|
|
185
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
186
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
187
|
+
center: import("../../definitions.js").Vector;
|
|
188
|
+
clockwise: boolean;
|
|
189
|
+
majorRadius: number;
|
|
190
|
+
minorRadius: number;
|
|
191
|
+
tiltAngle: number;
|
|
192
|
+
})[];
|
|
193
|
+
}[];
|
|
194
|
+
}[];
|
|
195
|
+
};
|
|
196
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Diagram } from "../../models/Diagram.js";
|
|
2
|
+
export declare function jsonDiagram(diagram: Diagram): {
|
|
3
|
+
type: string;
|
|
4
|
+
figures: {
|
|
5
|
+
type: string;
|
|
6
|
+
contour: {
|
|
7
|
+
type: string;
|
|
8
|
+
segments: ({
|
|
9
|
+
type: string;
|
|
10
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
11
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
12
|
+
center?: undefined;
|
|
13
|
+
clockwise?: undefined;
|
|
14
|
+
majorRadius?: undefined;
|
|
15
|
+
minorRadius?: undefined;
|
|
16
|
+
tiltAngle?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
type: string;
|
|
19
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
20
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
21
|
+
center: import("../../definitions.js").Vector;
|
|
22
|
+
clockwise: boolean;
|
|
23
|
+
majorRadius?: undefined;
|
|
24
|
+
minorRadius?: undefined;
|
|
25
|
+
tiltAngle?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
type: string;
|
|
28
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
29
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
30
|
+
center: import("../../definitions.js").Vector;
|
|
31
|
+
clockwise: boolean;
|
|
32
|
+
majorRadius: number;
|
|
33
|
+
minorRadius: number;
|
|
34
|
+
tiltAngle: number;
|
|
35
|
+
})[];
|
|
36
|
+
};
|
|
37
|
+
holes: {
|
|
38
|
+
type: string;
|
|
39
|
+
segments: ({
|
|
40
|
+
type: string;
|
|
41
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
42
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
43
|
+
center?: undefined;
|
|
44
|
+
clockwise?: undefined;
|
|
45
|
+
majorRadius?: undefined;
|
|
46
|
+
minorRadius?: undefined;
|
|
47
|
+
tiltAngle?: undefined;
|
|
48
|
+
} | {
|
|
49
|
+
type: string;
|
|
50
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
51
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
52
|
+
center: import("../../definitions.js").Vector;
|
|
53
|
+
clockwise: boolean;
|
|
54
|
+
majorRadius?: undefined;
|
|
55
|
+
minorRadius?: undefined;
|
|
56
|
+
tiltAngle?: undefined;
|
|
57
|
+
} | {
|
|
58
|
+
type: string;
|
|
59
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
60
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
61
|
+
center: import("../../definitions.js").Vector;
|
|
62
|
+
clockwise: boolean;
|
|
63
|
+
majorRadius: number;
|
|
64
|
+
minorRadius: number;
|
|
65
|
+
tiltAngle: number;
|
|
66
|
+
})[];
|
|
67
|
+
}[];
|
|
68
|
+
}[];
|
|
69
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Figure } from "../../models/Figure.js";
|
|
2
|
+
export declare function jsonFigure(figure: Figure): {
|
|
3
|
+
type: string;
|
|
4
|
+
contour: {
|
|
5
|
+
type: string;
|
|
6
|
+
segments: ({
|
|
7
|
+
type: string;
|
|
8
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
9
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
10
|
+
center?: undefined;
|
|
11
|
+
clockwise?: undefined;
|
|
12
|
+
majorRadius?: undefined;
|
|
13
|
+
minorRadius?: undefined;
|
|
14
|
+
tiltAngle?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
type: string;
|
|
17
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
18
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
19
|
+
center: import("../../definitions.js").Vector;
|
|
20
|
+
clockwise: boolean;
|
|
21
|
+
majorRadius?: undefined;
|
|
22
|
+
minorRadius?: undefined;
|
|
23
|
+
tiltAngle?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
type: string;
|
|
26
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
27
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
28
|
+
center: import("../../definitions.js").Vector;
|
|
29
|
+
clockwise: boolean;
|
|
30
|
+
majorRadius: number;
|
|
31
|
+
minorRadius: number;
|
|
32
|
+
tiltAngle: number;
|
|
33
|
+
})[];
|
|
34
|
+
};
|
|
35
|
+
holes: {
|
|
36
|
+
type: string;
|
|
37
|
+
segments: ({
|
|
38
|
+
type: string;
|
|
39
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
40
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
41
|
+
center?: undefined;
|
|
42
|
+
clockwise?: undefined;
|
|
43
|
+
majorRadius?: undefined;
|
|
44
|
+
minorRadius?: undefined;
|
|
45
|
+
tiltAngle?: undefined;
|
|
46
|
+
} | {
|
|
47
|
+
type: string;
|
|
48
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
49
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
50
|
+
center: import("../../definitions.js").Vector;
|
|
51
|
+
clockwise: boolean;
|
|
52
|
+
majorRadius?: undefined;
|
|
53
|
+
minorRadius?: undefined;
|
|
54
|
+
tiltAngle?: undefined;
|
|
55
|
+
} | {
|
|
56
|
+
type: string;
|
|
57
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
58
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
59
|
+
center: import("../../definitions.js").Vector;
|
|
60
|
+
clockwise: boolean;
|
|
61
|
+
majorRadius: number;
|
|
62
|
+
minorRadius: number;
|
|
63
|
+
tiltAngle: number;
|
|
64
|
+
})[];
|
|
65
|
+
}[];
|
|
66
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Loop } from "../../models/Loop.js";
|
|
2
|
+
export declare function jsonLoop(loop: Loop): {
|
|
3
|
+
type: string;
|
|
4
|
+
segments: ({
|
|
5
|
+
type: string;
|
|
6
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
7
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
8
|
+
center?: undefined;
|
|
9
|
+
clockwise?: undefined;
|
|
10
|
+
majorRadius?: undefined;
|
|
11
|
+
minorRadius?: undefined;
|
|
12
|
+
tiltAngle?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
type: string;
|
|
15
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
16
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
17
|
+
center: import("../../definitions.js").Vector;
|
|
18
|
+
clockwise: boolean;
|
|
19
|
+
majorRadius?: undefined;
|
|
20
|
+
minorRadius?: undefined;
|
|
21
|
+
tiltAngle?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
type: string;
|
|
24
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
25
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
26
|
+
center: import("../../definitions.js").Vector;
|
|
27
|
+
clockwise: boolean;
|
|
28
|
+
majorRadius: number;
|
|
29
|
+
minorRadius: number;
|
|
30
|
+
tiltAngle: number;
|
|
31
|
+
})[];
|
|
32
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Segment } from "../../models/segments/Segment.js";
|
|
2
|
+
export declare function jsonSegment(segment: Segment): {
|
|
3
|
+
type: string;
|
|
4
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
5
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
6
|
+
center?: undefined;
|
|
7
|
+
clockwise?: undefined;
|
|
8
|
+
majorRadius?: undefined;
|
|
9
|
+
minorRadius?: undefined;
|
|
10
|
+
tiltAngle?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
type: string;
|
|
13
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
14
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
15
|
+
center: import("../../definitions.js").Vector;
|
|
16
|
+
clockwise: boolean;
|
|
17
|
+
majorRadius?: undefined;
|
|
18
|
+
minorRadius?: undefined;
|
|
19
|
+
tiltAngle?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
type: string;
|
|
22
|
+
firstPoint: import("../../definitions.js").Vector;
|
|
23
|
+
lastPoint: import("../../definitions.js").Vector;
|
|
24
|
+
center: import("../../definitions.js").Vector;
|
|
25
|
+
clockwise: boolean;
|
|
26
|
+
majorRadius: number;
|
|
27
|
+
minorRadius: number;
|
|
28
|
+
tiltAngle: number;
|
|
29
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Diagram } from "../../models/Diagram.js";
|
|
2
|
+
import { Figure } from "../../models/Figure.js";
|
|
3
|
+
import { Arc } from "../../models/segments/Arc.js";
|
|
4
|
+
import { Line } from "../../models/segments/Line.js";
|
|
5
|
+
import { SVGUnit } from "./wrapSVG.js";
|
|
6
|
+
import type { Stroke } from "../../models/Stroke.js";
|
|
7
|
+
import { EllipseArc } from "../../models/segments/EllipseArc.js";
|
|
8
|
+
type Shape = Figure | Diagram | Arc | Line | EllipseArc | Stroke;
|
|
9
|
+
export declare function svgBody(shape: Shape): string;
|
|
10
|
+
type ConfiguredShape = Shape | {
|
|
11
|
+
shape: Shape;
|
|
12
|
+
color?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function exportSVG(shape: ConfiguredShape | ConfiguredShape[], { margin, unit, }?: {
|
|
15
|
+
margin?: number;
|
|
16
|
+
unit?: null | SVGUnit;
|
|
17
|
+
}): string;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BoundingBox } from "../../models/BoundingBox.js";
|
|
2
|
+
export declare function SVGViewbox(bbox: BoundingBox, margin?: number): string;
|
|
3
|
+
export type SVGUnit = "mm" | "cm" | "in" | "pc" | "px" | "pt";
|
|
4
|
+
export declare function wrapSVG(body: string, boundingBox: BoundingBox, margin: number | undefined, unit: null | SVGUnit): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Line } from "../../models/segments/Line.js";
|
|
2
|
+
import { Arc } from "../../models/segments/Arc.js";
|
|
3
|
+
import { Loop } from "../../models/Loop.js";
|
|
4
|
+
import { Figure } from "../../models/Figure.js";
|
|
5
|
+
import { Diagram } from "../../models/Diagram.js";
|
|
6
|
+
import { EllipseArc } from "../../models/segments/EllipseArc.js";
|
|
7
|
+
export declare function importJSON(json: any): Diagram | Figure | Loop | Line | Arc | EllipseArc;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Vector } from "./definitions.js";
|
|
2
|
+
export { Vector };
|
|
3
|
+
export declare const DEG2RAD: number;
|
|
4
|
+
export declare const RAD2DEG: number;
|
|
5
|
+
export declare function polarToCartesian(r: number, theta: number): Vector;
|
|
6
|
+
export declare function cartesianToPolar([x, y]: Vector): [number, number];
|
|
7
|
+
export type { Diagram, Figure, Loop, Strand, Stroke, TransformationMatrix, BoundingBox, Segment, Line, Arc, } from "./models/exports.js";
|
|
8
|
+
export { draw } from "./draw.js";
|
|
9
|
+
export { fuseAll, fuse, cut, intersect, eraseStrand, confineStrand, offset, outlineStroke, } from "./operations.js";
|
|
10
|
+
export { exportSVG, svgBody } from "./export/svg/exportSVG.js";
|
|
11
|
+
export { exportJSON } from "./export/json/exportJSON.js";
|
|
12
|
+
export { importJSON } from "./import/json/importJSON.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Vector } from "../definitions.js";
|
|
2
|
+
export declare class BoundingBox {
|
|
3
|
+
readonly xMin: number;
|
|
4
|
+
readonly yMin: number;
|
|
5
|
+
readonly xMax: number;
|
|
6
|
+
readonly yMax: number;
|
|
7
|
+
constructor(xMin?: number, yMin?: number, xMax?: number, yMax?: number);
|
|
8
|
+
get width(): number;
|
|
9
|
+
get height(): number;
|
|
10
|
+
contains(point: Vector): boolean;
|
|
11
|
+
overlaps(other: BoundingBox): boolean;
|
|
12
|
+
addPoint(point: Vector): BoundingBox;
|
|
13
|
+
merge(other: BoundingBox): BoundingBox;
|
|
14
|
+
}
|
|
15
|
+
export declare function pointsBoundingBox(points: Vector[]): BoundingBox;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Vector } from "../definitions.js";
|
|
2
|
+
import { BoundingBox } from "./BoundingBox.js";
|
|
3
|
+
import type { Figure } from "./Figure.js";
|
|
4
|
+
import type { TransformationMatrix } from "./TransformationMatrix.js";
|
|
5
|
+
import { Transformable } from "./utils/Transformable.js";
|
|
6
|
+
import { Strand } from "./Strand.js";
|
|
7
|
+
import type { Stroke } from "./Stroke.js";
|
|
8
|
+
export declare class Diagram extends Transformable<Diagram> {
|
|
9
|
+
figures: Figure[];
|
|
10
|
+
constructor(figures?: Figure[], { ignoreChecks }?: {
|
|
11
|
+
ignoreChecks?: boolean | undefined;
|
|
12
|
+
});
|
|
13
|
+
private _boundingBox;
|
|
14
|
+
get isEmpty(): boolean;
|
|
15
|
+
get boundingBox(): BoundingBox;
|
|
16
|
+
clone(): Diagram;
|
|
17
|
+
transform(matrix: TransformationMatrix): Diagram;
|
|
18
|
+
contains(point: Vector): boolean;
|
|
19
|
+
intersects(other: Diagram): boolean;
|
|
20
|
+
overlappingStrands(other: Diagram | Figure | Stroke): Strand[];
|
|
21
|
+
fuse(other: Diagram): Diagram;
|
|
22
|
+
cut(other: Diagram): Diagram;
|
|
23
|
+
intersect(other: Diagram): Diagram;
|
|
24
|
+
}
|
|
25
|
+
export declare function checkIsValidDiagram(figures: Figure[]): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Vector } from "../definitions.js";
|
|
2
|
+
import { TransformationMatrix } from "./TransformationMatrix.js";
|
|
3
|
+
import type { BoundingBox } from "./BoundingBox.js";
|
|
4
|
+
import { Loop } from "./Loop.js";
|
|
5
|
+
import { Strand } from "./Strand.js";
|
|
6
|
+
import type { Stroke } from "./Stroke.js";
|
|
7
|
+
import { Transformable } from "./utils/Transformable.js";
|
|
8
|
+
export declare class Figure extends Transformable<Figure> {
|
|
9
|
+
readonly contour: Loop;
|
|
10
|
+
readonly holes: Loop[];
|
|
11
|
+
constructor(contour: Loop, holes?: Loop[], { ignoreChecks }?: {
|
|
12
|
+
ignoreChecks?: boolean | undefined;
|
|
13
|
+
});
|
|
14
|
+
get boundingBox(): BoundingBox;
|
|
15
|
+
get isFull(): boolean;
|
|
16
|
+
get allLoops(): Loop[];
|
|
17
|
+
clone(): Figure;
|
|
18
|
+
transform(matrix: TransformationMatrix): Figure;
|
|
19
|
+
contains(point: Vector): boolean;
|
|
20
|
+
intersects(other: Figure): boolean;
|
|
21
|
+
overlappingStrands(other: Figure | Stroke): Strand[];
|
|
22
|
+
}
|
|
23
|
+
export declare function checkIsValidFigure(contour?: Loop, holes?: Loop[]): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Vector } from "../definitions.js";
|
|
2
|
+
import { AbstractStroke } from "./Stroke.js";
|
|
3
|
+
import type { TransformationMatrix } from "./TransformationMatrix.js";
|
|
4
|
+
import { Segment } from "./segments/Segment.js";
|
|
5
|
+
export declare class Loop extends AbstractStroke<Loop> {
|
|
6
|
+
strokeType: string;
|
|
7
|
+
constructor(segments: Segment[], { ignoreChecks }?: {
|
|
8
|
+
ignoreChecks?: boolean | undefined;
|
|
9
|
+
});
|
|
10
|
+
private _clockwise;
|
|
11
|
+
get clockwise(): boolean;
|
|
12
|
+
clone(): Loop;
|
|
13
|
+
reverse(): Loop;
|
|
14
|
+
transform(matrix: TransformationMatrix): Loop;
|
|
15
|
+
contains(point: Vector): boolean;
|
|
16
|
+
simplify(): Loop;
|
|
17
|
+
}
|
|
18
|
+
export declare function checkValidLoop(segments: Segment[]): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractStroke } from "./Stroke.js";
|
|
2
|
+
import { TransformationMatrix } from "./TransformationMatrix.js";
|
|
3
|
+
export declare class Strand extends AbstractStroke<Strand> {
|
|
4
|
+
strokeType: string;
|
|
5
|
+
reverse(): Strand;
|
|
6
|
+
clone(): Strand;
|
|
7
|
+
extend(strand: Strand): Strand;
|
|
8
|
+
simplify(): Strand;
|
|
9
|
+
transform(matrix: TransformationMatrix): Strand;
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BoundingBox } from "./BoundingBox.js";
|
|
2
|
+
import { Vector } from "../definitions.js";
|
|
3
|
+
import { Segment } from "./segments/Segment.js";
|
|
4
|
+
import { TransformationMatrix } from "./TransformationMatrix.js";
|
|
5
|
+
import { Transformable } from "./utils/Transformable.js";
|
|
6
|
+
export type Stroke = AbstractStroke<any>;
|
|
7
|
+
export declare abstract class AbstractStroke<T extends AbstractStroke<T>> extends Transformable<T> {
|
|
8
|
+
readonly segments: Segment[];
|
|
9
|
+
abstract strokeType: string;
|
|
10
|
+
get repr(): string;
|
|
11
|
+
get info(): string;
|
|
12
|
+
constructor(segments: Segment[], { ignoreChecks }?: {
|
|
13
|
+
ignoreChecks?: boolean | undefined;
|
|
14
|
+
});
|
|
15
|
+
get firstPoint(): Vector;
|
|
16
|
+
get lastPoint(): Vector;
|
|
17
|
+
get segmentsCount(): number;
|
|
18
|
+
onStroke(point: Vector): boolean;
|
|
19
|
+
intersects(other: Stroke): boolean;
|
|
20
|
+
overlappingSegments(other: Stroke): Segment[];
|
|
21
|
+
private _boundingBox;
|
|
22
|
+
get boundingBox(): BoundingBox;
|
|
23
|
+
abstract reverse(): T;
|
|
24
|
+
abstract clone(): T;
|
|
25
|
+
abstract transform(matrix: TransformationMatrix): T;
|
|
26
|
+
abstract simplify(): T;
|
|
27
|
+
}
|
|
28
|
+
export declare function checkSelfIntersections(segments: Segment[], type?: string): void;
|
|
29
|
+
export declare function checkValidStroke(segments: Segment[], type?: string): void;
|