geometrix 0.5.10 → 0.5.11

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.
Files changed (90) hide show
  1. package/dist/index.d.ts +505 -0
  2. package/dist/index.js +3848 -0
  3. package/dist/index.js.map +1 -0
  4. package/package.json +6 -1
  5. package/.eslintignore +0 -17
  6. package/.eslintrc.cjs +0 -24
  7. package/.prettierignore +0 -15
  8. package/.prettierrc +0 -8
  9. package/src/aaExportContent.ts +0 -213
  10. package/src/aaExportFile.ts +0 -141
  11. package/src/aaParamGeom.ts +0 -62
  12. package/src/angle_utils.test.ts +0 -83
  13. package/src/angle_utils.ts +0 -98
  14. package/src/arc_to_stroke.ts +0 -73
  15. package/src/canvas_utils.test.ts +0 -28
  16. package/src/canvas_utils.ts +0 -159
  17. package/src/contour.test.ts +0 -37
  18. package/src/contour.ts +0 -806
  19. package/src/designParams.ts +0 -178
  20. package/src/figure.test.ts +0 -21
  21. package/src/figure.ts +0 -400
  22. package/src/index.ts +0 -16
  23. package/src/line.test.ts +0 -78
  24. package/src/line.ts +0 -359
  25. package/src/paramFile.ts +0 -52
  26. package/src/point.test.ts +0 -36
  27. package/src/point.ts +0 -246
  28. package/src/prepare_pax.ts +0 -102
  29. package/src/segment.test.ts +0 -26
  30. package/src/segment.ts +0 -701
  31. package/src/sub_design.ts +0 -16
  32. package/src/triangle_utils.test.ts +0 -38
  33. package/src/triangle_utils.ts +0 -112
  34. package/src/vector.test.ts +0 -28
  35. package/src/vector.ts +0 -122
  36. package/src/volume.ts +0 -50
  37. package/src/write_dxf.ts +0 -100
  38. package/src/write_openjscad.ts +0 -284
  39. package/src/write_openscad.ts +0 -305
  40. package/src/write_pax.ts +0 -73
  41. package/src/write_svg.ts +0 -101
  42. package/svg/any_triangle.svg +0 -156
  43. package/svg/arc_definition.svg +0 -506
  44. package/svg/construct_corner_rounded_ext_arc_ext_arc.svg +0 -378
  45. package/svg/construct_corner_rounded_int_arc_ext_arc.svg +0 -359
  46. package/svg/construct_corner_rounded_int_arc_int_arc.svg +0 -356
  47. package/svg/construct_corner_rounded_stroke_ext_arc.svg +0 -374
  48. package/svg/construct_corner_rounded_stroke_ext_arc_obtuse.svg +0 -370
  49. package/svg/construct_corner_rounded_stroke_ext_arc_obtuse_method2.svg +0 -311
  50. package/svg/construct_corner_rounded_stroke_int_arc.svg +0 -364
  51. package/svg/construct_corner_rounded_stroke_int_arc_obtuse.svg +0 -358
  52. package/svg/construct_corner_rounded_stroke_int_arc_obtuse_method2.svg +0 -237
  53. package/svg/construct_corner_rounded_stroke_stroke.svg +0 -280
  54. package/svg/construct_corner_wideacc.svg +0 -286
  55. package/svg/construct_corner_widened.svg +0 -278
  56. package/svg/construction_of_line_intersection_1.svg +0 -187
  57. package/svg/construction_of_line_intersection_2.svg +0 -189
  58. package/svg/contour_arc_definition_options.svg +0 -324
  59. package/svg/contour_point_absolute_relative.svg +0 -258
  60. package/svg/contour_tangential_two_arcs.svg +0 -531
  61. package/svg/contour_tangential_two_arcs_impossible_case.svg +0 -175
  62. package/svg/contour_tangential_two_arcs_requirements.svg +0 -364
  63. package/svg/corner_rounded_ext_arc_ext_arc.svg +0 -281
  64. package/svg/corner_rounded_int_arc_ext_arc.svg +0 -281
  65. package/svg/corner_rounded_int_arc_int_arc.svg +0 -279
  66. package/svg/corner_rounded_stroke_ext_arc.svg +0 -218
  67. package/svg/corner_rounded_stroke_int_arc.svg +0 -225
  68. package/svg/corner_rounded_stroke_stroke.svg +0 -174
  69. package/svg/geom_dev.svg +0 -14708
  70. package/svg/geom_modules.svg +0 -246
  71. package/svg/geom_user.svg +0 -58
  72. package/svg/line_axis_x_cases.svg +0 -1408
  73. package/svg/line_axis_y_cases.svg +0 -1369
  74. package/svg/line_distanceOrig.svg +0 -318
  75. package/svg/line_getAxisXIntersection.svg +0 -262
  76. package/svg/line_getAxisXIntersection_2.svg +0 -244
  77. package/svg/line_getAxisYIntersection.svg +0 -304
  78. package/svg/line_getAxisYIntersection_2.svg +0 -285
  79. package/svg/line_getAxisYIntersection_3.svg +0 -277
  80. package/svg/line_intersection.svg +0 -346
  81. package/svg/line_projectPoint.svg +0 -311
  82. package/svg/point_1.svg +0 -243
  83. package/svg/point_2.svg +0 -409
  84. package/svg/point_3.svg +0 -298
  85. package/svg/point_4.svg +0 -272
  86. package/svg/point_5.svg +0 -356
  87. package/svg/right_triangle.svg +0 -194
  88. package/svg/vector_definition.svg +0 -130
  89. package/tsconfig.json +0 -13
  90. package/vitest.config.ts +0 -7
@@ -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 };
@@ -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
- });