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/src/prepare_pax.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
// prepare_pax.ts
|
|
2
|
-
|
|
3
|
-
// floating precision for pax export
|
|
4
|
-
function ff(ifloat: number): number {
|
|
5
|
-
//const rFloat = ifloat.toFixed(4);
|
|
6
|
-
//const c10 = 10000;
|
|
7
|
-
//const rFloat = Math.round(ifloat * c10) / c10;
|
|
8
|
-
const rFloat = ifloat; // no rounding
|
|
9
|
-
return rFloat;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface tPaxContourCircle {
|
|
13
|
-
circle: boolean;
|
|
14
|
-
cx: number;
|
|
15
|
-
cy: number;
|
|
16
|
-
radius: number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
enum PSeg {
|
|
20
|
-
eStart,
|
|
21
|
-
eStroke,
|
|
22
|
-
eArc
|
|
23
|
-
}
|
|
24
|
-
// for start and stroke
|
|
25
|
-
interface tPaxSegSt {
|
|
26
|
-
typ: PSeg;
|
|
27
|
-
px: number;
|
|
28
|
-
py: number;
|
|
29
|
-
}
|
|
30
|
-
interface tPaxSegArc {
|
|
31
|
-
typ: PSeg;
|
|
32
|
-
px: number;
|
|
33
|
-
py: number;
|
|
34
|
-
radius: number;
|
|
35
|
-
large: boolean;
|
|
36
|
-
ccw: boolean;
|
|
37
|
-
}
|
|
38
|
-
type tPaxSeg = tPaxSegSt | tPaxSegArc;
|
|
39
|
-
interface tPaxContourPath {
|
|
40
|
-
circle: boolean;
|
|
41
|
-
seg: tPaxSeg[];
|
|
42
|
-
}
|
|
43
|
-
type tPaxContour = tPaxContourPath | tPaxContourCircle;
|
|
44
|
-
|
|
45
|
-
function paxCircle(cx: number, cy: number, radius: number): tPaxContourCircle {
|
|
46
|
-
const rPax: tPaxContourCircle = {
|
|
47
|
-
circle: true,
|
|
48
|
-
cx: ff(cx),
|
|
49
|
-
cy: ff(cy),
|
|
50
|
-
radius: ff(radius)
|
|
51
|
-
};
|
|
52
|
-
return rPax;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
class PaxPath {
|
|
56
|
-
seg: tPaxSeg[];
|
|
57
|
-
constructor() {
|
|
58
|
-
this.seg = [];
|
|
59
|
-
}
|
|
60
|
-
addStart(px: number, py: number) {
|
|
61
|
-
this.seg = [];
|
|
62
|
-
const one: tPaxSegSt = {
|
|
63
|
-
typ: PSeg.eStart,
|
|
64
|
-
px: px,
|
|
65
|
-
py: py
|
|
66
|
-
};
|
|
67
|
-
this.seg.push(one);
|
|
68
|
-
}
|
|
69
|
-
addStroke(px: number, py: number) {
|
|
70
|
-
const one: tPaxSegSt = {
|
|
71
|
-
typ: PSeg.eStroke,
|
|
72
|
-
px: px,
|
|
73
|
-
py: py
|
|
74
|
-
};
|
|
75
|
-
this.seg.push(one);
|
|
76
|
-
}
|
|
77
|
-
addArc(cx: number, cy: number, radius: number, large: boolean, ccw: boolean) {
|
|
78
|
-
const one: tPaxSegArc = {
|
|
79
|
-
typ: PSeg.eArc,
|
|
80
|
-
px: cx,
|
|
81
|
-
py: cy,
|
|
82
|
-
radius: radius,
|
|
83
|
-
large: large,
|
|
84
|
-
ccw: ccw
|
|
85
|
-
};
|
|
86
|
-
this.seg.push(one);
|
|
87
|
-
}
|
|
88
|
-
toJson(): tPaxContourPath {
|
|
89
|
-
const rPaxC: tPaxContourPath = {
|
|
90
|
-
circle: false,
|
|
91
|
-
seg: this.seg
|
|
92
|
-
};
|
|
93
|
-
return rPaxC;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
function paxPath(): PaxPath {
|
|
97
|
-
const rPaxPath = new PaxPath();
|
|
98
|
-
return rPaxPath;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export type { tPaxSegArc, tPaxSeg, tPaxContourPath, tPaxContourCircle, tPaxContour };
|
|
102
|
-
export { PSeg, paxPath, paxCircle };
|
package/src/segment.test.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
//import { point } from './point';
|
|
3
|
-
import * as segLib from './segment';
|
|
4
|
-
|
|
5
|
-
describe('Segment type suit', () => {
|
|
6
|
-
it('isSeg', () => {
|
|
7
|
-
expect(segLib.isSeg(segLib.SegEnum.eStroke)).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('isAddPoint', () => {
|
|
10
|
-
expect(segLib.isAddPoint(segLib.SegEnum.eStart)).toBeTruthy();
|
|
11
|
-
});
|
|
12
|
-
it('isAddPoint', () => {
|
|
13
|
-
expect(segLib.isAddPoint(segLib.SegEnum.ePointed)).toBeFalsy();
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe('Segment suit', () => {
|
|
18
|
-
const s1 = new segLib.Segment1(segLib.SegEnum.eStroke, 50, 20, 0, false, false);
|
|
19
|
-
const s2 = new segLib.Segment1(segLib.SegEnum.eArc, 50, 50, 50, false, false);
|
|
20
|
-
it('arcSeg1To2', () => {
|
|
21
|
-
expect(() => segLib.arcSeg1To2(0, 0, s1)).toThrowError(/err202/);
|
|
22
|
-
const sb2 = segLib.arcSeg1To2(0, 0, s2);
|
|
23
|
-
expect(sb2.pc.cx).toBeCloseTo(50, 5);
|
|
24
|
-
expect(sb2.pc.cy).toBeCloseTo(0, 0);
|
|
25
|
-
});
|
|
26
|
-
});
|