geometrix 0.5.10 → 0.5.12
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/index.d.ts +505 -0
- package/dist/index.js +3848 -0
- package/package.json +7 -1
- package/.eslintignore +0 -17
- package/.eslintrc.cjs +0 -24
- package/.prettierignore +0 -15
- package/.prettierrc +0 -8
- package/src/aaExportContent.ts +0 -213
- package/src/aaExportFile.ts +0 -141
- package/src/aaParamGeom.ts +0 -62
- package/src/angle_utils.test.ts +0 -83
- package/src/angle_utils.ts +0 -98
- package/src/arc_to_stroke.ts +0 -73
- package/src/canvas_utils.test.ts +0 -28
- package/src/canvas_utils.ts +0 -159
- package/src/contour.test.ts +0 -37
- package/src/contour.ts +0 -806
- package/src/designParams.ts +0 -178
- package/src/figure.test.ts +0 -21
- package/src/figure.ts +0 -400
- package/src/index.ts +0 -16
- package/src/line.test.ts +0 -78
- package/src/line.ts +0 -359
- package/src/paramFile.ts +0 -52
- package/src/point.test.ts +0 -36
- package/src/point.ts +0 -246
- package/src/prepare_pax.ts +0 -102
- package/src/segment.test.ts +0 -26
- package/src/segment.ts +0 -701
- package/src/sub_design.ts +0 -16
- package/src/triangle_utils.test.ts +0 -38
- package/src/triangle_utils.ts +0 -112
- package/src/vector.test.ts +0 -28
- package/src/vector.ts +0 -122
- package/src/volume.ts +0 -50
- package/src/write_dxf.ts +0 -100
- package/src/write_openjscad.ts +0 -284
- package/src/write_openscad.ts +0 -305
- package/src/write_pax.ts +0 -73
- package/src/write_svg.ts +0 -101
- package/svg/any_triangle.svg +0 -156
- package/svg/arc_definition.svg +0 -506
- package/svg/construct_corner_rounded_ext_arc_ext_arc.svg +0 -378
- package/svg/construct_corner_rounded_int_arc_ext_arc.svg +0 -359
- package/svg/construct_corner_rounded_int_arc_int_arc.svg +0 -356
- package/svg/construct_corner_rounded_stroke_ext_arc.svg +0 -374
- package/svg/construct_corner_rounded_stroke_ext_arc_obtuse.svg +0 -370
- package/svg/construct_corner_rounded_stroke_ext_arc_obtuse_method2.svg +0 -311
- package/svg/construct_corner_rounded_stroke_int_arc.svg +0 -364
- package/svg/construct_corner_rounded_stroke_int_arc_obtuse.svg +0 -358
- package/svg/construct_corner_rounded_stroke_int_arc_obtuse_method2.svg +0 -237
- package/svg/construct_corner_rounded_stroke_stroke.svg +0 -280
- package/svg/construct_corner_wideacc.svg +0 -286
- package/svg/construct_corner_widened.svg +0 -278
- package/svg/construction_of_line_intersection_1.svg +0 -187
- package/svg/construction_of_line_intersection_2.svg +0 -189
- package/svg/contour_arc_definition_options.svg +0 -324
- package/svg/contour_point_absolute_relative.svg +0 -258
- package/svg/contour_tangential_two_arcs.svg +0 -531
- package/svg/contour_tangential_two_arcs_impossible_case.svg +0 -175
- package/svg/contour_tangential_two_arcs_requirements.svg +0 -364
- package/svg/corner_rounded_ext_arc_ext_arc.svg +0 -281
- package/svg/corner_rounded_int_arc_ext_arc.svg +0 -281
- package/svg/corner_rounded_int_arc_int_arc.svg +0 -279
- package/svg/corner_rounded_stroke_ext_arc.svg +0 -218
- package/svg/corner_rounded_stroke_int_arc.svg +0 -225
- package/svg/corner_rounded_stroke_stroke.svg +0 -174
- package/svg/geom_dev.svg +0 -14708
- package/svg/geom_modules.svg +0 -246
- package/svg/geom_user.svg +0 -58
- package/svg/line_axis_x_cases.svg +0 -1408
- package/svg/line_axis_y_cases.svg +0 -1369
- package/svg/line_distanceOrig.svg +0 -318
- package/svg/line_getAxisXIntersection.svg +0 -262
- package/svg/line_getAxisXIntersection_2.svg +0 -244
- package/svg/line_getAxisYIntersection.svg +0 -304
- package/svg/line_getAxisYIntersection_2.svg +0 -285
- package/svg/line_getAxisYIntersection_3.svg +0 -277
- package/svg/line_intersection.svg +0 -346
- package/svg/line_projectPoint.svg +0 -311
- package/svg/point_1.svg +0 -243
- package/svg/point_2.svg +0 -409
- package/svg/point_3.svg +0 -298
- package/svg/point_4.svg +0 -272
- package/svg/point_5.svg +0 -356
- package/svg/right_triangle.svg +0 -194
- package/svg/vector_definition.svg +0 -130
- package/tsconfig.json +0 -13
- package/vitest.config.ts +0 -7
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
declare const colors: {
|
|
2
|
+
point: string;
|
|
3
|
+
line: string;
|
|
4
|
+
vector: string;
|
|
5
|
+
contour: string;
|
|
6
|
+
main: string;
|
|
7
|
+
mainB: string;
|
|
8
|
+
second: string;
|
|
9
|
+
secondB: string;
|
|
10
|
+
dynamics: string;
|
|
11
|
+
ruler: string;
|
|
12
|
+
origin: string;
|
|
13
|
+
reference: string;
|
|
14
|
+
mouse: string;
|
|
15
|
+
};
|
|
16
|
+
interface tCanvasAdjust {
|
|
17
|
+
init: number;
|
|
18
|
+
xMin: number;
|
|
19
|
+
yMin: number;
|
|
20
|
+
xyDiff: number;
|
|
21
|
+
shiftX: number;
|
|
22
|
+
shiftY: number;
|
|
23
|
+
scaleX: number;
|
|
24
|
+
scaleY: number;
|
|
25
|
+
}
|
|
26
|
+
declare function point2canvas(px: number, py: number, iAdjust: tCanvasAdjust): [number, number];
|
|
27
|
+
declare function canvas2point(cx: number, cy: number, iAdjust: tCanvasAdjust): [number, number];
|
|
28
|
+
declare function canvasTranslatePolar(cx: number, cy: number, ia: number, il: number): [number, number];
|
|
29
|
+
declare function radius2canvas(iRadius: number, iAdjust: tCanvasAdjust): number;
|
|
30
|
+
declare function adjustZero(): tCanvasAdjust;
|
|
31
|
+
declare function adjustInit(xMin: number, xMax: number, yMin: number, yMax: number, cWidth: number, cHeight: number): tCanvasAdjust;
|
|
32
|
+
declare function adjustCenter(px: number, py: number, iAdjust: tCanvasAdjust): tCanvasAdjust;
|
|
33
|
+
declare function adjustRect(p1x: number, p1y: number, p2x: number, p2y: number, cWidth: number, cHeight: number): tCanvasAdjust;
|
|
34
|
+
declare function adjustScale(iFactor: number, iAdjust: tCanvasAdjust): tCanvasAdjust;
|
|
35
|
+
declare function adjustTranslate(p1x: number, p1y: number, p2x: number, p2y: number, iAdjust: tCanvasAdjust): tCanvasAdjust;
|
|
36
|
+
|
|
37
|
+
declare function degToRad(degrees: number): number;
|
|
38
|
+
declare function radToDeg(rad: number): number;
|
|
39
|
+
declare function roundZero(ix: number): number;
|
|
40
|
+
declare function withinZero2Pi(ia: number): number;
|
|
41
|
+
declare function withinPiPi(ia: number): number;
|
|
42
|
+
declare function ffix(ifloat: number): string;
|
|
43
|
+
|
|
44
|
+
declare function lcFromLaLbAc(la: number, lb: number, ac: number): number;
|
|
45
|
+
declare function aCFromLaLbLc(la: number, lb: number, lc: number): number;
|
|
46
|
+
declare function lbFromLaAaAb(ila: number, iaA: number, iaB: number): number;
|
|
47
|
+
declare function aBFromLaLbAa(ila: number, ilb: number, iaA: number): number;
|
|
48
|
+
|
|
49
|
+
type tPolar = [number, number];
|
|
50
|
+
declare enum ShapePoint {
|
|
51
|
+
eDefault = 0,
|
|
52
|
+
eCircle = 1,
|
|
53
|
+
eCross = 2,
|
|
54
|
+
eSquare = 3,
|
|
55
|
+
eBigSquare = 4,
|
|
56
|
+
eTwoTri = 5,
|
|
57
|
+
eTri1 = 6,
|
|
58
|
+
eTri2 = 7,
|
|
59
|
+
eTri3 = 8,
|
|
60
|
+
eTri4 = 9
|
|
61
|
+
}
|
|
62
|
+
declare class Point {
|
|
63
|
+
cx: number;
|
|
64
|
+
cy: number;
|
|
65
|
+
shape: ShapePoint;
|
|
66
|
+
constructor(ix: number, iy: number, ishape?: ShapePoint);
|
|
67
|
+
draw(ctx: CanvasRenderingContext2D, cAdjust: tCanvasAdjust, color?: string, ishape?: ShapePoint): void;
|
|
68
|
+
distanceOrig(): number;
|
|
69
|
+
angleOrig(): number;
|
|
70
|
+
getPolar(): tPolar;
|
|
71
|
+
setPolar(ia: number, il: number): Point;
|
|
72
|
+
translate(ix: number, iy: number): Point;
|
|
73
|
+
translatePolar(ia: number, il: number): Point;
|
|
74
|
+
clone(ishape?: ShapePoint): Point;
|
|
75
|
+
rotateOrig(ia: number): Point;
|
|
76
|
+
scaleOrig(ir: number): Point;
|
|
77
|
+
rotate(ic: Point, ia: number): Point;
|
|
78
|
+
scale(ic: Point, ir: number): Point;
|
|
79
|
+
isEqual(ic: Point): boolean;
|
|
80
|
+
distanceToPoint(p2: Point): number;
|
|
81
|
+
angleToPoint(p2: Point): number;
|
|
82
|
+
angleFromToPoints(p2: Point, p3: Point): number;
|
|
83
|
+
middlePoint(p2: Point): Point;
|
|
84
|
+
equidistantPoint(p2: Point, dist: number, p3: Point): Point;
|
|
85
|
+
}
|
|
86
|
+
declare function point(ix: number, iy: number, ishape?: ShapePoint): Point;
|
|
87
|
+
|
|
88
|
+
interface tAffine {
|
|
89
|
+
quasiVertical: boolean;
|
|
90
|
+
ha: number;
|
|
91
|
+
hb: number;
|
|
92
|
+
va: number;
|
|
93
|
+
vb: number;
|
|
94
|
+
}
|
|
95
|
+
declare class Line {
|
|
96
|
+
cx: number;
|
|
97
|
+
cy: number;
|
|
98
|
+
ca: number;
|
|
99
|
+
constructor(ix: number, iy: number, ia: number);
|
|
100
|
+
draw(ctx: CanvasRenderingContext2D, cAdjust: tCanvasAdjust, color?: string): void;
|
|
101
|
+
setFromPoints(p1: Point, p2: Point): this;
|
|
102
|
+
getAffine(): tAffine;
|
|
103
|
+
setAffine(iAffine: tAffine): Line;
|
|
104
|
+
intersection(il: Line): Point;
|
|
105
|
+
getAxisXIntersection(): number;
|
|
106
|
+
getAxisYIntersection(): number;
|
|
107
|
+
getAxisXIntersecTri(): number;
|
|
108
|
+
getAxisYIntersecTri(): number;
|
|
109
|
+
angleOrig(): number;
|
|
110
|
+
distanceOrig(): number;
|
|
111
|
+
projectOrig(): Point;
|
|
112
|
+
translate(ix: number, iy: number): Line;
|
|
113
|
+
rotateOrig(ia: number): Line;
|
|
114
|
+
scaleOrig(ir: number): Line;
|
|
115
|
+
rotate(ic: Point, ia: number): Line;
|
|
116
|
+
scale(ic: Point, ir: number): Line;
|
|
117
|
+
clone(): Line;
|
|
118
|
+
lineOrthogonal(ic: Point): Line;
|
|
119
|
+
lineParallel(ic: Point): Line;
|
|
120
|
+
distanceToPoint(ic: Point): number;
|
|
121
|
+
projectPoint(ic: Point): Point;
|
|
122
|
+
isParallel(il: Line): boolean;
|
|
123
|
+
isOrthogonal(il: Line): boolean;
|
|
124
|
+
isEqual(il: Line): boolean;
|
|
125
|
+
bisector(il: Line, ip: Point): Line;
|
|
126
|
+
lineParallelDistance(iDist: number, ipMagnet: Point, ipMagnet2: Point): Line;
|
|
127
|
+
}
|
|
128
|
+
declare function line(ix: number, iy: number, ia: number): Line;
|
|
129
|
+
declare function linePP(ip1: Point, ip2: Point): Line;
|
|
130
|
+
declare function bisector(ip1: Point, ip2: Point): Line;
|
|
131
|
+
declare function circleCenter(ip1: Point, ip2: Point, ip3: Point): Point;
|
|
132
|
+
|
|
133
|
+
type tCartesian = [number, number];
|
|
134
|
+
declare class Vector {
|
|
135
|
+
ca: number;
|
|
136
|
+
cl: number;
|
|
137
|
+
drawPoint: Point;
|
|
138
|
+
constructor(ia: number, il: number, iDrawPoint: Point);
|
|
139
|
+
draw(ctx: CanvasRenderingContext2D, cAdjust: tCanvasAdjust, color?: string): void;
|
|
140
|
+
getCartesian(): tCartesian;
|
|
141
|
+
setCartesian(ix: number, iy: number): Vector;
|
|
142
|
+
translatePoint(ip: Point): Point;
|
|
143
|
+
add(iVect: Vector): Vector;
|
|
144
|
+
addCart(ix: number, iy: number): Vector;
|
|
145
|
+
translate(ix: number, iy: number): Vector;
|
|
146
|
+
rotate(ic: Point, ia: number): Vector;
|
|
147
|
+
clone(): Vector;
|
|
148
|
+
isEqual(iVect: Vector): boolean;
|
|
149
|
+
dotProduct(iVect: Vector): number;
|
|
150
|
+
crossProduct(iVect: Vector): number;
|
|
151
|
+
}
|
|
152
|
+
declare function vector(ia: number, il: number, iDrawPoint: Point): Vector;
|
|
153
|
+
|
|
154
|
+
declare enum SegEnum {
|
|
155
|
+
eStroke = 0,
|
|
156
|
+
eArc = 1,
|
|
157
|
+
ePointed = 2,
|
|
158
|
+
eRounded = 3,
|
|
159
|
+
eWidened = 4,
|
|
160
|
+
eWideAcc = 5,// Widened Access
|
|
161
|
+
eStart = 6
|
|
162
|
+
}
|
|
163
|
+
declare class Segment1 {
|
|
164
|
+
sType: SegEnum;
|
|
165
|
+
px: number;
|
|
166
|
+
py: number;
|
|
167
|
+
radius: number;
|
|
168
|
+
arcLarge: boolean;
|
|
169
|
+
arcCcw: boolean;
|
|
170
|
+
constructor(iType: SegEnum, ix: number, iy: number, iRadius: number, iArcLarge?: boolean, iArcCcw?: boolean);
|
|
171
|
+
clone(): Segment1;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
declare class DxfSeg {
|
|
175
|
+
arc: boolean;
|
|
176
|
+
p1x: number;
|
|
177
|
+
p1y: number;
|
|
178
|
+
radius: number;
|
|
179
|
+
a1: number;
|
|
180
|
+
a2: number;
|
|
181
|
+
p2x: number;
|
|
182
|
+
p2y: number;
|
|
183
|
+
constructor(arc: boolean, p1x: number, p1y: number, radius: number, a1: number, a2: number, p2x: number, p2y: number);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
interface tPaxContourCircle {
|
|
187
|
+
circle: boolean;
|
|
188
|
+
cx: number;
|
|
189
|
+
cy: number;
|
|
190
|
+
radius: number;
|
|
191
|
+
}
|
|
192
|
+
declare enum PSeg {
|
|
193
|
+
eStart = 0,
|
|
194
|
+
eStroke = 1,
|
|
195
|
+
eArc = 2
|
|
196
|
+
}
|
|
197
|
+
interface tPaxSegSt {
|
|
198
|
+
typ: PSeg;
|
|
199
|
+
px: number;
|
|
200
|
+
py: number;
|
|
201
|
+
}
|
|
202
|
+
interface tPaxSegArc {
|
|
203
|
+
typ: PSeg;
|
|
204
|
+
px: number;
|
|
205
|
+
py: number;
|
|
206
|
+
radius: number;
|
|
207
|
+
large: boolean;
|
|
208
|
+
ccw: boolean;
|
|
209
|
+
}
|
|
210
|
+
type tPaxSeg = tPaxSegSt | tPaxSegArc;
|
|
211
|
+
interface tPaxContourPath {
|
|
212
|
+
circle: boolean;
|
|
213
|
+
seg: tPaxSeg[];
|
|
214
|
+
}
|
|
215
|
+
type tPaxContour = tPaxContourPath | tPaxContourCircle;
|
|
216
|
+
|
|
217
|
+
declare abstract class AContour {
|
|
218
|
+
abstract circle: boolean;
|
|
219
|
+
abstract imposedColor: string;
|
|
220
|
+
abstract draw(ctx: CanvasRenderingContext2D, cAdjust: tCanvasAdjust, color: string): void;
|
|
221
|
+
abstract extractSkeleton(): AContour;
|
|
222
|
+
abstract generateContour(): AContour;
|
|
223
|
+
abstract generatePoints(): Point[];
|
|
224
|
+
abstract generateLines(): Line[];
|
|
225
|
+
abstract check(): string;
|
|
226
|
+
abstract toSvg(yCeiling: number, color?: string): string;
|
|
227
|
+
abstract toDxfSeg(): DxfSeg[];
|
|
228
|
+
abstract toPax(): tPaxContour;
|
|
229
|
+
}
|
|
230
|
+
declare class Contour extends AContour {
|
|
231
|
+
circle: boolean;
|
|
232
|
+
segments: Segment1[];
|
|
233
|
+
points: Point[];
|
|
234
|
+
debugPoints: Point[];
|
|
235
|
+
debugLines: Line[];
|
|
236
|
+
lastPoint: Point;
|
|
237
|
+
imposedColor: string;
|
|
238
|
+
constructor(ix: number, iy: number, icolor?: string);
|
|
239
|
+
setLastPoint(ix: number, iy: number): void;
|
|
240
|
+
getLastPoint(): Point;
|
|
241
|
+
addPointA(ax: number, ay: number): Contour;
|
|
242
|
+
addPointAP(aa: number, al: number): Contour;
|
|
243
|
+
addPointR(rx: number, ry: number): Contour;
|
|
244
|
+
addPointRP(ra: number, rl: number): Contour;
|
|
245
|
+
addSeg(iSeg: Segment1): Contour;
|
|
246
|
+
addSegStroke(): Contour;
|
|
247
|
+
addSegStrokeA(ax: number, ay: number): Contour;
|
|
248
|
+
addSegStrokeAP(aa: number, al: number): Contour;
|
|
249
|
+
addSegStrokeR(rx: number, ry: number): Contour;
|
|
250
|
+
addSegStrokeRP(ra: number, rl: number): Contour;
|
|
251
|
+
addSegArc(iRadius: number, iLarge: boolean, iCcw: boolean): Contour;
|
|
252
|
+
addSegArc2(): Contour;
|
|
253
|
+
addSegArc3(iTangentAngle1: number, firstNlast: boolean): Contour;
|
|
254
|
+
addSeg2Arcs(ita1: number, ita2: number): Contour;
|
|
255
|
+
addCornerPointed(): Contour;
|
|
256
|
+
addCornerRounded(iRadius: number): Contour;
|
|
257
|
+
addCornerWidened(iRadius: number): Contour;
|
|
258
|
+
addCornerWideAcc(iRadius: number): Contour;
|
|
259
|
+
closeSegStroke(): Contour;
|
|
260
|
+
closeSegArc(iRadius: number, iLarge: boolean, iCcw: boolean): Contour;
|
|
261
|
+
clone(): Contour;
|
|
262
|
+
translate(ix: number, iy: number): Contour;
|
|
263
|
+
translatePolar(ia: number, il: number): Contour;
|
|
264
|
+
rotate(ix: number, iy: number, ia: number): Contour;
|
|
265
|
+
scale(ix: number, iy: number, ir: number, scaleCorner?: boolean): Contour;
|
|
266
|
+
addPartial(iContour: Contour): Contour;
|
|
267
|
+
draw(ctx: CanvasRenderingContext2D, cAdjust: tCanvasAdjust, color?: string): void;
|
|
268
|
+
extractSkeleton(): Contour;
|
|
269
|
+
generateContour(): Contour;
|
|
270
|
+
generatePoints(): Point[];
|
|
271
|
+
generateLines(): Line[];
|
|
272
|
+
checkContour(ctr: Contour): void;
|
|
273
|
+
check(): string;
|
|
274
|
+
toSvg(yCeiling: number, color?: string): string;
|
|
275
|
+
toDxfSeg(): DxfSeg[];
|
|
276
|
+
toPax(): tPaxContourPath;
|
|
277
|
+
}
|
|
278
|
+
declare class ContourCircle extends AContour {
|
|
279
|
+
circle: boolean;
|
|
280
|
+
px: number;
|
|
281
|
+
py: number;
|
|
282
|
+
radius: number;
|
|
283
|
+
imposedColor: string;
|
|
284
|
+
constructor(ix: number, iy: number, iRadius: number, icolor?: string);
|
|
285
|
+
clone(): ContourCircle;
|
|
286
|
+
translate(ix: number, iy: number): ContourCircle;
|
|
287
|
+
translatePolar(ia: number, il: number): ContourCircle;
|
|
288
|
+
rotate(ix: number, iy: number, ia: number): ContourCircle;
|
|
289
|
+
draw(ctx: CanvasRenderingContext2D, cAdjust: tCanvasAdjust, color?: string): void;
|
|
290
|
+
extractSkeleton(): ContourCircle;
|
|
291
|
+
generateContour(): ContourCircle;
|
|
292
|
+
generatePoints(): Point[];
|
|
293
|
+
generateLines(): Line[];
|
|
294
|
+
check(): string;
|
|
295
|
+
toSvg(yCeiling: number, color?: string): string;
|
|
296
|
+
toDxfSeg(): DxfSeg[];
|
|
297
|
+
toPax(): tPaxContourCircle;
|
|
298
|
+
}
|
|
299
|
+
declare function contour(ix: number, iy: number, icolor?: string): Contour;
|
|
300
|
+
declare function contourCircle(ix: number, iy: number, iRadius: number, icolor?: string): ContourCircle;
|
|
301
|
+
type tContour = Contour | ContourCircle;
|
|
302
|
+
|
|
303
|
+
interface tLayers {
|
|
304
|
+
points: boolean;
|
|
305
|
+
lines: boolean;
|
|
306
|
+
vectors: boolean;
|
|
307
|
+
main: boolean;
|
|
308
|
+
mainB: boolean;
|
|
309
|
+
second: boolean;
|
|
310
|
+
secondB: boolean;
|
|
311
|
+
dynamics: boolean;
|
|
312
|
+
ruler: boolean;
|
|
313
|
+
refframe: boolean;
|
|
314
|
+
}
|
|
315
|
+
declare class Figure {
|
|
316
|
+
pointList: Point[];
|
|
317
|
+
lineList: Line[];
|
|
318
|
+
vectorList: Vector[];
|
|
319
|
+
mainList: tContour[];
|
|
320
|
+
mainBList: tContour[];
|
|
321
|
+
secondList: tContour[];
|
|
322
|
+
secondBList: tContour[];
|
|
323
|
+
dynamicsList: tContour[];
|
|
324
|
+
xMin: number;
|
|
325
|
+
xMax: number;
|
|
326
|
+
yMin: number;
|
|
327
|
+
yMax: number;
|
|
328
|
+
constructor();
|
|
329
|
+
addPoint(ipoint: Point): void;
|
|
330
|
+
addPoints(ipoints: Point[]): void;
|
|
331
|
+
addLine(iline: Line): void;
|
|
332
|
+
addLines(ilines: Line[]): void;
|
|
333
|
+
addVector(ivector: Vector): void;
|
|
334
|
+
addMain(icontour: tContour): void;
|
|
335
|
+
addSecond(icontour: tContour): void;
|
|
336
|
+
addDynamics(icontour: tContour): void;
|
|
337
|
+
translate(ix: number, iy: number): Figure;
|
|
338
|
+
translatePolar(ia: number, il: number): Figure;
|
|
339
|
+
rotate(ix: number, iy: number, ia: number): Figure;
|
|
340
|
+
mergeFigure(ifig: Figure, mainToSecond?: boolean): void;
|
|
341
|
+
clear(): void;
|
|
342
|
+
getMinMax(): void;
|
|
343
|
+
getAdjustFull(iCanvasWidth: number, iCanvasHeight: number): tCanvasAdjust;
|
|
344
|
+
getAdjustZoom(iCanvasWidth: number, iCanvasHeight: number): tCanvasAdjust;
|
|
345
|
+
quantifyRuler(canvasWidth: number, adjust: tCanvasAdjust): number[];
|
|
346
|
+
drawRuler(ctx: CanvasRenderingContext2D, adjust: tCanvasAdjust, color: string): void;
|
|
347
|
+
draw(ctx: CanvasRenderingContext2D, adjust: tCanvasAdjust, layers: tLayers): void;
|
|
348
|
+
}
|
|
349
|
+
declare function figure(): Figure;
|
|
350
|
+
type tFaces = Record<string, Figure>;
|
|
351
|
+
declare function mergeFaces(iFaces: tFaces): Figure;
|
|
352
|
+
declare function initLayers(): tLayers;
|
|
353
|
+
declare function copyLayers(iLayers: tLayers): tLayers;
|
|
354
|
+
|
|
355
|
+
declare enum PType {
|
|
356
|
+
eNumber = 0,
|
|
357
|
+
eCheckbox = 1,
|
|
358
|
+
eDropdown = 2
|
|
359
|
+
}
|
|
360
|
+
interface tParam {
|
|
361
|
+
name: string;
|
|
362
|
+
unit: string;
|
|
363
|
+
init: number;
|
|
364
|
+
min: number;
|
|
365
|
+
max: number;
|
|
366
|
+
step: number;
|
|
367
|
+
dropdown: string[];
|
|
368
|
+
pType: PType;
|
|
369
|
+
}
|
|
370
|
+
interface tSimTime {
|
|
371
|
+
tMax: number;
|
|
372
|
+
tStep: number;
|
|
373
|
+
tUpdate: number;
|
|
374
|
+
}
|
|
375
|
+
interface tParamDef {
|
|
376
|
+
partName: string;
|
|
377
|
+
params: tParam[];
|
|
378
|
+
paramSvg: Record<string, string>;
|
|
379
|
+
sim: tSimTime;
|
|
380
|
+
}
|
|
381
|
+
type tParamVal = Record<string, number>;
|
|
382
|
+
type tParamChanged = Record<string, boolean>;
|
|
383
|
+
interface tDesignParamOne {
|
|
384
|
+
val: number;
|
|
385
|
+
init: number;
|
|
386
|
+
chg: boolean;
|
|
387
|
+
}
|
|
388
|
+
declare function oneDesignParam(iVal: number, iInit: number, iChg: boolean): tDesignParamOne;
|
|
389
|
+
type tDesignParamList = Record<string, tDesignParamOne>;
|
|
390
|
+
declare function paramListToVal(dpList: tDesignParamList): tParamVal;
|
|
391
|
+
declare class DesignParam {
|
|
392
|
+
paramVal: tParamVal;
|
|
393
|
+
paramInit: tParamVal;
|
|
394
|
+
paramChanged: tParamChanged;
|
|
395
|
+
partName: string;
|
|
396
|
+
paramNames: string[];
|
|
397
|
+
getParamName(): string[];
|
|
398
|
+
constructor(iparamDef: tParamDef);
|
|
399
|
+
getPartName(): string;
|
|
400
|
+
getParamVal(): tParamVal;
|
|
401
|
+
getVal(iname: string): number;
|
|
402
|
+
getInit(iname: string): number;
|
|
403
|
+
getChanged(iname: string): boolean;
|
|
404
|
+
setVal(iname: string, ival: number): void;
|
|
405
|
+
applyParamVal(iValues: tParamVal): string;
|
|
406
|
+
applyParamList(iValues: tDesignParamList): string;
|
|
407
|
+
getDesignParamList(): tDesignParamList;
|
|
408
|
+
}
|
|
409
|
+
declare function designParam(iparamDef: tParamDef): DesignParam;
|
|
410
|
+
declare function pNumber(name: string, unit: string, init: number, min?: number, max?: number, step?: number): tParam;
|
|
411
|
+
declare function pCheckbox(name: string, init: boolean): tParam;
|
|
412
|
+
declare function pDropdown(name: string, values: string[]): tParam;
|
|
413
|
+
|
|
414
|
+
type tPosiOrien = [number, number, number];
|
|
415
|
+
interface tSubInst {
|
|
416
|
+
partName: string;
|
|
417
|
+
dparam: tDesignParamList;
|
|
418
|
+
orientation: tPosiOrien;
|
|
419
|
+
position: tPosiOrien;
|
|
420
|
+
}
|
|
421
|
+
type tSubDesign = Record<string, tSubInst>;
|
|
422
|
+
|
|
423
|
+
interface tGeom {
|
|
424
|
+
partName: string;
|
|
425
|
+
calcErr: boolean;
|
|
426
|
+
logstr: string;
|
|
427
|
+
fig: tFaces;
|
|
428
|
+
vol: tVolume;
|
|
429
|
+
sub: tSubDesign;
|
|
430
|
+
}
|
|
431
|
+
type tGeomFunc = (t: number, ipVal: tParamVal) => tGeom;
|
|
432
|
+
interface tPageDef {
|
|
433
|
+
pTitle: string;
|
|
434
|
+
pDescription: string;
|
|
435
|
+
pDef: tParamDef;
|
|
436
|
+
pGeom: tGeomFunc;
|
|
437
|
+
}
|
|
438
|
+
type tAllPageDef = Record<string, tPageDef>;
|
|
439
|
+
type tAllLink = Record<string, string>;
|
|
440
|
+
declare function fround(ireal: number, iprecision?: number): number;
|
|
441
|
+
declare function initGeom(partName: string): tGeom;
|
|
442
|
+
declare function checkGeom(iGeom: tGeom): void;
|
|
443
|
+
declare function prefixLog(iLog: string, iPartName: string): string;
|
|
444
|
+
|
|
445
|
+
interface tInherit {
|
|
446
|
+
outName: string;
|
|
447
|
+
subdesign: string;
|
|
448
|
+
subgeom: tGeom;
|
|
449
|
+
rotate: [number, number, number];
|
|
450
|
+
translate: [number, number, number];
|
|
451
|
+
}
|
|
452
|
+
declare enum EExtrude {
|
|
453
|
+
eLinearOrtho = 0,
|
|
454
|
+
eRotate = 1
|
|
455
|
+
}
|
|
456
|
+
interface tExtrude {
|
|
457
|
+
outName: string;
|
|
458
|
+
face: string;
|
|
459
|
+
extrudeMethod: EExtrude;
|
|
460
|
+
length?: number;
|
|
461
|
+
rotate: [number, number, number];
|
|
462
|
+
translate: [number, number, number];
|
|
463
|
+
}
|
|
464
|
+
declare enum EBVolume {
|
|
465
|
+
eIdentity = 0,
|
|
466
|
+
eIntersection = 1,
|
|
467
|
+
eUnion = 2,
|
|
468
|
+
eSubstraction = 3
|
|
469
|
+
}
|
|
470
|
+
interface tBVolume {
|
|
471
|
+
outName: string;
|
|
472
|
+
boolMethod: EBVolume;
|
|
473
|
+
inList: string[];
|
|
474
|
+
}
|
|
475
|
+
interface tVolume {
|
|
476
|
+
inherits?: tInherit[];
|
|
477
|
+
extrudes: tExtrude[];
|
|
478
|
+
volumes: tBVolume[];
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
declare enum EFormat {
|
|
482
|
+
eSVG = 0,
|
|
483
|
+
eSVGALL = 1,
|
|
484
|
+
eDXF = 2,
|
|
485
|
+
eDXFALL = 3,
|
|
486
|
+
ePAX = 4,
|
|
487
|
+
eOPENSCAD = 5,
|
|
488
|
+
eJSCAD = 6,
|
|
489
|
+
eZIP = 7
|
|
490
|
+
}
|
|
491
|
+
declare function fileTextContent(fgeom: tGeomFunc, paramVal: tParamVal, eFace: string, exportFormat: EFormat): string;
|
|
492
|
+
declare function fileBinContent(fgeom: tGeomFunc, tSim: number, paramVal: tParamVal, exportFormat: EFormat): Promise<Blob>;
|
|
493
|
+
declare function fileMime(exportFormat: EFormat): string;
|
|
494
|
+
declare function fileSuffix(exportFormat: EFormat): string;
|
|
495
|
+
declare function fileBin(exportFormat: EFormat): boolean;
|
|
496
|
+
|
|
497
|
+
interface tParamValInFile {
|
|
498
|
+
lastModif: string;
|
|
499
|
+
pVal: tParamVal;
|
|
500
|
+
comment: string;
|
|
501
|
+
}
|
|
502
|
+
declare function createParamFile(lastModif: string, idparams: tParamVal, comment: string): string;
|
|
503
|
+
declare function parseParamFile(fContentStr: string): [tParamValInFile, string];
|
|
504
|
+
|
|
505
|
+
export { DesignParam, EBVolume, EExtrude, EFormat, Figure, PType, Point, ShapePoint, aBFromLaLbAa, aCFromLaLbLc, adjustCenter, adjustInit, adjustRect, adjustScale, adjustTranslate, adjustZero, bisector, canvas2point, canvasTranslatePolar, checkGeom, circleCenter, colors, contour, contourCircle, copyLayers, createParamFile, degToRad, designParam, ffix, figure, fileBin, fileBinContent, fileMime, fileSuffix, fileTextContent, fround, initGeom, initLayers, lbFromLaAaAb, lcFromLaLbAc, line, linePP, mergeFaces, oneDesignParam, pCheckbox, pDropdown, pNumber, paramListToVal, parseParamFile, point, point2canvas, prefixLog, radToDeg, radius2canvas, roundZero, type tAllLink, type tAllPageDef, type tBVolume, type tCanvasAdjust, type tContour, type tDesignParamList, type tExtrude, type tFaces, type tGeom, type tGeomFunc, type tInherit, type tLayers, type tPageDef, type tParamDef, type tParamVal, type tParamValInFile, type tPosiOrien, type tSubDesign, type tSubInst, type tVolume, vector, withinPiPi, withinZero2Pi };
|