designix 0.5.11 → 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.
Files changed (239) hide show
  1. package/dist/index.d.ts +59 -0
  2. package/dist/index.js +5669 -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/export_svg/base.svg +0 -1
  10. package/export_svg/base_cut.svg +0 -1
  11. package/export_svg/base_hollow.svg +0 -1
  12. package/export_svg/base_top.svg +0 -1
  13. package/export_svg/calculation_of_initAngle2.svg +0 -1
  14. package/export_svg/circles.svg +0 -1
  15. package/export_svg/circles_amplitude-offset.svg +0 -1
  16. package/export_svg/circles_amplitude-scale.svg +0 -1
  17. package/export_svg/circles_angle.svg +0 -1
  18. package/export_svg/default_param_blank.svg +0 -1
  19. package/export_svg/dummy_pole_static.svg +0 -1
  20. package/export_svg/dummy_pole_static_face.svg +0 -1
  21. package/export_svg/gear_addendeum_dedendum_sizes.svg +0 -9
  22. package/export_svg/gear_addendum_and_dedendum.svg +0 -1
  23. package/export_svg/gear_adherence_replaced_by_teeth.svg +0 -1
  24. package/export_svg/gear_base_circle_for_involute.svg +0 -2
  25. package/export_svg/gear_base_left_circle_for_involute.svg +0 -2
  26. package/export_svg/gear_base_right_circle_for_involute.svg +0 -2
  27. package/export_svg/gear_inter_axis_maximum_distance.svg +0 -1
  28. package/export_svg/gear_inter_axis_minimum_distance.svg +0 -1
  29. package/export_svg/gear_large_base_radius.svg +0 -5
  30. package/export_svg/gear_module_and_tooth_thickness.svg +0 -3
  31. package/export_svg/gear_optimum_base_radius.svg +0 -5
  32. package/export_svg/gear_optimum_base_radius_with_longer_inter_axis.svg +0 -5
  33. package/export_svg/gear_right_left_base_circles.svg +0 -1
  34. package/export_svg/gear_small_base_radius.svg +0 -5
  35. package/export_svg/gear_wheel_circles.svg +0 -2
  36. package/export_svg/gears.svg +0 -71
  37. package/export_svg/gears_motion_transmission_via_adherence.svg +0 -1
  38. package/export_svg/heliostat.svg +0 -1
  39. package/export_svg/heliostat2_face_sizing.svg +0 -1
  40. package/export_svg/heliostat2_side_sizing.svg +0 -1
  41. package/export_svg/heliostat_face_sizing.svg +0 -1
  42. package/export_svg/heliostat_overview.svg +0 -1
  43. package/export_svg/heliostat_side.svg +0 -1
  44. package/export_svg/heliostat_side_sizing.svg +0 -1
  45. package/export_svg/involute_of_circle.svg +0 -19
  46. package/export_svg/involute_of_circle_R0.svg +0 -1
  47. package/export_svg/involute_of_circle_Ri1_u0.svg +0 -1
  48. package/export_svg/involute_of_circle_Ri2_u2.svg +0 -1
  49. package/export_svg/left_side_angle_kitchen.svg +0 -1
  50. package/export_svg/negative_involute_of_circle_R0.svg +0 -1
  51. package/export_svg/point_c_position_and_speed_negative.svg +0 -1
  52. package/export_svg/point_c_position_and_speed_positive.svg +0 -1
  53. package/export_svg/pole_rotor.svg +0 -1
  54. package/export_svg/pole_rotor_cut.svg +0 -1
  55. package/export_svg/pole_rotor_ends.svg +0 -1
  56. package/export_svg/pole_stator.svg +0 -3
  57. package/export_svg/pole_stator_E2.svg +0 -3
  58. package/export_svg/pole_stator_bottom.svg +0 -1
  59. package/export_svg/pole_stator_cut.svg +0 -1
  60. package/export_svg/pole_stator_face.svg +0 -1
  61. package/export_svg/pole_stator_right.svg +0 -1
  62. package/export_svg/rake.svg +0 -1
  63. package/export_svg/rake_door.svg +0 -1
  64. package/export_svg/rake_face.svg +0 -1
  65. package/export_svg/rake_side.svg +0 -1
  66. package/export_svg/rake_side_stopper.svg +0 -1
  67. package/export_svg/rake_top.svg +0 -1
  68. package/export_svg/rake_top_stopper.svg +0 -1
  69. package/export_svg/rectangle.svg +0 -1
  70. package/export_svg/rectangle_height.svg +0 -1
  71. package/export_svg/rectangle_width.svg +0 -1
  72. package/export_svg/right_side_angle_kitchen.svg +0 -1
  73. package/export_svg/rod.svg +0 -1
  74. package/export_svg/rod_cut.svg +0 -1
  75. package/export_svg/rod_plate.svg +0 -1
  76. package/export_svg/rod_top.svg +0 -1
  77. package/export_svg/spider.svg +0 -1
  78. package/export_svg/spider_lateral.svg +0 -1
  79. package/export_svg/spider_profile.svg +0 -1
  80. package/export_svg/surface.svg +0 -3
  81. package/export_svg/surface_crenel.svg +0 -1
  82. package/export_svg/surface_extremities.svg +0 -2
  83. package/export_svg/surface_lz.svg +0 -1
  84. package/export_svg/surface_main.svg +0 -1
  85. package/export_svg/surface_power.svg +0 -2
  86. package/export_svg/surface_space_evolution.svg +0 -1
  87. package/export_svg/surface_space_shape.svg +0 -1
  88. package/export_svg/swing.svg +0 -1
  89. package/export_svg/swing_face.svg +0 -1
  90. package/export_svg/swing_side.svg +0 -1
  91. package/export_svg/swing_top.svg +0 -1
  92. package/export_svg/swing_with_rod.svg +0 -1
  93. package/export_svg/trapeze.svg +0 -1
  94. package/export_svg/trapeze_rod.svg +0 -1
  95. package/export_svg/trapeze_side.svg +0 -1
  96. package/export_svg/trapeze_top.svg +0 -1
  97. package/export_svg/verify_contour_1.svg +0 -1
  98. package/export_svg/verify_contour_1_l1.svg +0 -1
  99. package/export_svg/verify_contour_1_r1.svg +0 -1
  100. package/export_svg/verify_line.svg +0 -1
  101. package/export_svg/verify_line_2_l1cx.svg +0 -1
  102. package/export_svg/verify_line_p1x.svg +0 -1
  103. package/export_svg/verify_point.svg +0 -1
  104. package/export_svg/verify_point_p1x.svg +0 -1
  105. package/export_svg/verify_vector_p1x.svg +0 -1
  106. package/src/dummy/circles.ts +0 -65
  107. package/src/dummy/pole_static.ts +0 -86
  108. package/src/dummy/rectangle.ts +0 -55
  109. package/src/dummy/svg/circles.svg +0 -288
  110. package/src/dummy/svg/circles_amplitude-offset.svg +0 -109
  111. package/src/dummy/svg/circles_amplitude-scale.svg +0 -122
  112. package/src/dummy/svg/circles_angle.svg +0 -110
  113. package/src/dummy/svg/dummy_pole_static.svg +0 -192
  114. package/src/dummy/svg/dummy_pole_static_face.svg +0 -176
  115. package/src/dummy/svg/rectangle.svg +0 -131
  116. package/src/dummy/svg/rectangle_height.svg +0 -82
  117. package/src/dummy/svg/rectangle_width.svg +0 -81
  118. package/src/gears/gearWheelProfile.test.ts +0 -25
  119. package/src/gears/gearWheelProfile.ts +0 -753
  120. package/src/gears/gear_wheel_wheel.ts +0 -335
  121. package/src/gears/involute.test.ts +0 -21
  122. package/src/gears/involute.ts +0 -113
  123. package/src/gears/simplified_gear_wheel.ts +0 -242
  124. package/src/gears/svg/calculation_of_initAngle2.svg +0 -376
  125. package/src/gears/svg/gear_addendeum_dedendum_sizes.svg +0 -471
  126. package/src/gears/svg/gear_addendum_and_dedendum.svg +0 -269
  127. package/src/gears/svg/gear_adherence_replaced_by_teeth.svg +0 -168
  128. package/src/gears/svg/gear_base_circle_for_involute.svg +0 -376
  129. package/src/gears/svg/gear_base_left_circle_for_involute.svg +0 -556
  130. package/src/gears/svg/gear_base_right_circle_for_involute.svg +0 -516
  131. package/src/gears/svg/gear_inter_axis_maximum_distance.svg +0 -218
  132. package/src/gears/svg/gear_inter_axis_minimum_distance.svg +0 -218
  133. package/src/gears/svg/gear_large_base_radius.svg +0 -199
  134. package/src/gears/svg/gear_module_and_tooth_thickness.svg +0 -319
  135. package/src/gears/svg/gear_optimum_base_radius.svg +0 -232
  136. package/src/gears/svg/gear_optimum_base_radius_with_longer_inter_axis.svg +0 -344
  137. package/src/gears/svg/gear_right_left_base_circles.svg +0 -295
  138. package/src/gears/svg/gear_small_base_radius.svg +0 -163
  139. package/src/gears/svg/gear_wheel_circles.svg +0 -348
  140. package/src/gears/svg/gears.svg +0 -4726
  141. package/src/gears/svg/gears_motion_transmission_via_adherence.svg +0 -178
  142. package/src/gears/svg/involute_of_circle.svg +0 -2745
  143. package/src/gears/svg/involute_of_circle_R0.svg +0 -334
  144. package/src/gears/svg/involute_of_circle_Ri1_u0.svg +0 -297
  145. package/src/gears/svg/involute_of_circle_Ri2_u2.svg +0 -386
  146. package/src/gears/svg/left_side_angle_kitchen.svg +0 -207
  147. package/src/gears/svg/negative_involute_of_circle_R0.svg +0 -381
  148. package/src/gears/svg/point_c_position_and_speed_negative.svg +0 -343
  149. package/src/gears/svg/point_c_position_and_speed_positive.svg +0 -339
  150. package/src/gears/svg/right_side_angle_kitchen.svg +0 -201
  151. package/src/gears/wheelElements.test.ts +0 -13
  152. package/src/gears/wheelElements.ts +0 -176
  153. package/src/geometrix_verification/svg/verify_contour_1.svg +0 -320
  154. package/src/geometrix_verification/svg/verify_contour_1_l1.svg +0 -102
  155. package/src/geometrix_verification/svg/verify_contour_1_r1.svg +0 -170
  156. package/src/geometrix_verification/svg/verify_line.svg +0 -845
  157. package/src/geometrix_verification/svg/verify_line_2_l1cx.svg +0 -274
  158. package/src/geometrix_verification/svg/verify_line_p1x.svg +0 -261
  159. package/src/geometrix_verification/svg/verify_point.svg +0 -350
  160. package/src/geometrix_verification/svg/verify_point_p1x.svg +0 -258
  161. package/src/geometrix_verification/svg/verify_vector_p1x.svg +0 -282
  162. package/src/geometrix_verification/verify_contour_1.ts +0 -94
  163. package/src/geometrix_verification/verify_contour_2.ts +0 -267
  164. package/src/geometrix_verification/verify_contour_3.ts +0 -409
  165. package/src/geometrix_verification/verify_contour_4.ts +0 -91
  166. package/src/geometrix_verification/verify_exports_1.ts +0 -95
  167. package/src/geometrix_verification/verify_line.ts +0 -76
  168. package/src/geometrix_verification/verify_line_2.ts +0 -76
  169. package/src/geometrix_verification/verify_line_3.ts +0 -64
  170. package/src/geometrix_verification/verify_point.ts +0 -62
  171. package/src/geometrix_verification/verify_point_2.ts +0 -66
  172. package/src/geometrix_verification/verify_vector.ts +0 -70
  173. package/src/heliostat/base.ts +0 -254
  174. package/src/heliostat/heliostat.ts +0 -317
  175. package/src/heliostat/heliostat_2.ts +0 -284
  176. package/src/heliostat/pole_rotor.ts +0 -165
  177. package/src/heliostat/pole_static.ts +0 -275
  178. package/src/heliostat/rake.ts +0 -486
  179. package/src/heliostat/rake_stopper.ts +0 -409
  180. package/src/heliostat/rod.ts +0 -200
  181. package/src/heliostat/spider.ts +0 -238
  182. package/src/heliostat/surface.ts +0 -320
  183. package/src/heliostat/svg/base.svg +0 -1367
  184. package/src/heliostat/svg/base_cut.svg +0 -459
  185. package/src/heliostat/svg/base_hollow.svg +0 -469
  186. package/src/heliostat/svg/base_top.svg +0 -338
  187. package/src/heliostat/svg/heliostat.svg +0 -8013
  188. package/src/heliostat/svg/heliostat2_face_sizing.svg +0 -1386
  189. package/src/heliostat/svg/heliostat2_side_sizing.svg +0 -984
  190. package/src/heliostat/svg/heliostat_face_sizing.svg +0 -1448
  191. package/src/heliostat/svg/heliostat_overview.svg +0 -1552
  192. package/src/heliostat/svg/heliostat_side.svg +0 -1470
  193. package/src/heliostat/svg/heliostat_side_sizing.svg +0 -1128
  194. package/src/heliostat/svg/pole_rotor.svg +0 -592
  195. package/src/heliostat/svg/pole_rotor_cut.svg +0 -287
  196. package/src/heliostat/svg/pole_rotor_ends.svg +0 -336
  197. package/src/heliostat/svg/pole_stator.svg +0 -1945
  198. package/src/heliostat/svg/pole_stator_E2.svg +0 -410
  199. package/src/heliostat/svg/pole_stator_bottom.svg +0 -330
  200. package/src/heliostat/svg/pole_stator_cut.svg +0 -465
  201. package/src/heliostat/svg/pole_stator_face.svg +0 -457
  202. package/src/heliostat/svg/pole_stator_right.svg +0 -357
  203. package/src/heliostat/svg/rake.svg +0 -4691
  204. package/src/heliostat/svg/rake_door.svg +0 -617
  205. package/src/heliostat/svg/rake_face.svg +0 -1211
  206. package/src/heliostat/svg/rake_side.svg +0 -809
  207. package/src/heliostat/svg/rake_side_stopper.svg +0 -596
  208. package/src/heliostat/svg/rake_top.svg +0 -514
  209. package/src/heliostat/svg/rake_top_stopper.svg +0 -565
  210. package/src/heliostat/svg/rod.svg +0 -1314
  211. package/src/heliostat/svg/rod_cut.svg +0 -265
  212. package/src/heliostat/svg/rod_plate.svg +0 -409
  213. package/src/heliostat/svg/rod_top.svg +0 -577
  214. package/src/heliostat/svg/spider.svg +0 -693
  215. package/src/heliostat/svg/spider_lateral.svg +0 -222
  216. package/src/heliostat/svg/spider_profile.svg +0 -429
  217. package/src/heliostat/svg/surface.svg +0 -3577
  218. package/src/heliostat/svg/surface_crenel.svg +0 -1335
  219. package/src/heliostat/svg/surface_extremities.svg +0 -510
  220. package/src/heliostat/svg/surface_lz.svg +0 -182
  221. package/src/heliostat/svg/surface_main.svg +0 -366
  222. package/src/heliostat/svg/surface_power.svg +0 -331
  223. package/src/heliostat/svg/surface_space_evolution.svg +0 -210
  224. package/src/heliostat/svg/surface_space_shape.svg +0 -98
  225. package/src/heliostat/svg/swing.svg +0 -3310
  226. package/src/heliostat/svg/swing_face.svg +0 -902
  227. package/src/heliostat/svg/swing_side.svg +0 -574
  228. package/src/heliostat/svg/swing_top.svg +0 -923
  229. package/src/heliostat/svg/swing_with_rod.svg +0 -547
  230. package/src/heliostat/svg/trapeze.svg +0 -1711
  231. package/src/heliostat/svg/trapeze_rod.svg +0 -122
  232. package/src/heliostat/svg/trapeze_side.svg +0 -361
  233. package/src/heliostat/svg/trapeze_top.svg +0 -1057
  234. package/src/heliostat/swing.ts +0 -246
  235. package/src/heliostat/trapeze.ts +0 -510
  236. package/src/index.ts +0 -33
  237. package/src/svg/default_param_blank.svg +0 -40
  238. package/tsconfig.json +0 -13
  239. package/vitest.config.ts +0 -7
@@ -1,76 +0,0 @@
1
- // verify_line_2.ts
2
-
3
- import type { tParamDef, tParamVal, tGeom, tPageDef } from 'geometrix';
4
- import { degToRad, point, line, figure, pNumber, initGeom } from 'geometrix';
5
-
6
- const pDef: tParamDef = {
7
- partName: 'verify_line_2',
8
- params: [
9
- //pNumber(name, unit, init, min, max, step)
10
- pNumber('l1cx', 'mm', 10, -200, 200, 1),
11
- pNumber('l1cy', 'mm', 20, -200, 200, 1),
12
- pNumber('l1ca', 'degree', 15, -200, 200, 1),
13
- pNumber('l2cx', 'mm', 30, -200, 200, 1),
14
- pNumber('l2cy', 'mm', 50, -200, 200, 1),
15
- pNumber('l2ca', 'degree', 35, -200, 200, 1),
16
- pNumber('p3x', 'mm', -30, -200, 200, 1),
17
- pNumber('p3y', 'mm', 30, -200, 200, 1)
18
- ],
19
- paramSvg: {
20
- l1cx: 'verify_line_2_l1cx.svg',
21
- l1cy: 'verify_line_2_l1cx.svg',
22
- l1ca: 'verify_line_2_l1cx.svg',
23
- l2cx: 'verify_line_2_l1cx.svg',
24
- l2cy: 'verify_line_2_l1cx.svg',
25
- l2ca: 'verify_line_2_l1cx.svg',
26
- p3x: 'verify_line_2_l1cx.svg',
27
- p3y: 'verify_line_2_l1cx.svg'
28
- },
29
- sim: {
30
- tMax: 100,
31
- tStep: 0.1,
32
- tUpdate: 500 // every 0.5 second
33
- }
34
- };
35
-
36
- function pGeom(t: number, param: tParamVal): tGeom {
37
- const rGeome = initGeom(pDef.partName);
38
- rGeome.logstr += `${rGeome.partName} simTime: ${t}\n`;
39
- try {
40
- const figOne = figure();
41
- const p1 = point(param.l1cx, param.l1cy);
42
- const p2 = point(param.l2cx, param.l2cy);
43
- const p3 = point(param.p3x, param.p3y);
44
- figOne.addPoint(p1);
45
- figOne.addPoint(p2);
46
- figOne.addPoint(p3);
47
- const l1 = line(param.l1cx, param.l1cy, degToRad(param.l1ca + t));
48
- const l2 = line(param.l2cx, param.l2cy, degToRad(param.l2ca));
49
- figOne.addLine(l1);
50
- figOne.addLine(l2);
51
- figOne.addPoint(l1.intersection(l2));
52
- figOne.addPoint(l1.projectPoint(p3));
53
- rGeome.logstr += `dist(l1, p3) = ${l1.distanceToPoint(p3)}\n`;
54
- figOne.addPoint(l2.projectPoint(p3));
55
- rGeome.logstr += `dist(l2, p3) = ${l2.distanceToPoint(p3)}\n`;
56
- const bisector = l1.bisector(l2, p3);
57
- const pBisec = point(bisector.cx, bisector.cy).translatePolar(bisector.ca, 30);
58
- figOne.addPoint(pBisec);
59
- rGeome.fig = { one: figOne };
60
- rGeome.logstr += 'verify_line_2 draw successfully!\n';
61
- rGeome.calcErr = false;
62
- } catch (emsg) {
63
- rGeome.logstr += emsg as string;
64
- console.log(emsg as string);
65
- }
66
- return rGeome;
67
- }
68
-
69
- const verifyLine2Def: tPageDef = {
70
- pTitle: 'Verify line 2',
71
- pDescription: 'Debugging more line.ts',
72
- pDef: pDef,
73
- pGeom: pGeom
74
- };
75
-
76
- export { verifyLine2Def };
@@ -1,64 +0,0 @@
1
- // verify_line_3.ts
2
-
3
- import type { tParamDef, tParamVal, tGeom, tPageDef } from 'geometrix';
4
- import { point, bisector, circleCenter, figure, pNumber, initGeom } from 'geometrix';
5
-
6
- const pDef: tParamDef = {
7
- partName: 'verify_line_3',
8
- params: [
9
- //pNumber(name, unit, init, min, max, step)
10
- pNumber('p1x', 'mm', 30, -200, 200, 1),
11
- pNumber('p1y', 'mm', 50, -200, 200, 1),
12
- pNumber('p2x', 'mm', 40, -200, 200, 1),
13
- pNumber('p2y', 'mm', -20, -200, 200, 1),
14
- pNumber('p3x', 'mm', -30, -200, 200, 1),
15
- pNumber('p3y', 'mm', 30, -200, 200, 1)
16
- ],
17
- paramSvg: {
18
- p1x: 'verify_line_p1x.svg',
19
- p1y: 'verify_line_p1x.svg',
20
- p2x: 'verify_line_p1x.svg',
21
- p2y: 'verify_line_p1x.svg',
22
- p3x: 'verify_line_p1x.svg',
23
- p3y: 'verify_line_p1x.svg'
24
- },
25
- sim: {
26
- tMax: 10,
27
- tStep: 0.1,
28
- tUpdate: 500 // every 0.5 second
29
- }
30
- };
31
-
32
- function pGeom(t: number, param: tParamVal): tGeom {
33
- const rGeome = initGeom(pDef.partName);
34
- rGeome.logstr += `${rGeome.partName} simTime: ${t}\n`;
35
- try {
36
- const figOne = figure();
37
- const p1 = point(param.p1x, param.p1y + t);
38
- const p2 = point(param.p2x, param.p2y);
39
- const p3 = point(param.p3x, param.p3y);
40
- figOne.addPoint(p1);
41
- figOne.addPoint(p2);
42
- figOne.addPoint(p3);
43
- const l1 = bisector(p1, p2);
44
- figOne.addLine(l1);
45
- const pCenter = circleCenter(p1, p2, p3);
46
- figOne.addPoint(pCenter);
47
- rGeome.fig = { one: figOne };
48
- rGeome.logstr += 'verify_line_3 draw successfully!\n';
49
- rGeome.calcErr = false;
50
- } catch (emsg) {
51
- rGeome.logstr += emsg as string;
52
- console.log(emsg as string);
53
- }
54
- return rGeome;
55
- }
56
-
57
- const verifyLine3Def: tPageDef = {
58
- pTitle: 'Verify line 3',
59
- pDescription: 'Debugging more more line.ts',
60
- pDef: pDef,
61
- pGeom: pGeom
62
- };
63
-
64
- export { verifyLine3Def };
@@ -1,62 +0,0 @@
1
- // verify_point.ts
2
-
3
- import type { tParamDef, tParamVal, tGeom, tPageDef } from 'geometrix';
4
- import { degToRad, point, figure, pNumber, initGeom } from 'geometrix';
5
-
6
- const pDef: tParamDef = {
7
- partName: 'verify_point',
8
- params: [
9
- //pNumber(name, unit, init, min, max, step)
10
- pNumber('p1x', 'mm', 30, -200, 200, 1),
11
- pNumber('p1y', 'mm', 50, -200, 200, 1),
12
- pNumber('p2a', 'degree', 30, -200, 200, 1),
13
- pNumber('p2l', 'mm', 60, 0, 200, 1),
14
- pNumber('rotateOrig', 'degree', 45, -200, 200, 1),
15
- pNumber('scaleOrig', 'scalar', 1.5, 0.1, 2, 0.1)
16
- ],
17
- paramSvg: {
18
- p1x: 'verify_point_p1x.svg',
19
- p1y: 'verify_point_p1x.svg',
20
- p2a: 'verify_point_p1x.svg',
21
- p2l: 'verify_point_p1x.svg',
22
- rotateOrig: 'verify_point_p1x.svg',
23
- scaleOrig: 'verify_point_p1x.svg'
24
- },
25
- sim: {
26
- tMax: 10,
27
- tStep: 0.1,
28
- tUpdate: 500 // every 0.5 second
29
- }
30
- };
31
-
32
- function pGeom(t: number, param: tParamVal): tGeom {
33
- const rGeome = initGeom(pDef.partName);
34
- rGeome.logstr += `${rGeome.partName} simTime: ${t}\n`;
35
- try {
36
- const figOne = figure();
37
- const p1 = point(param.p1x, param.p1y + t);
38
- const p2 = point(0, 0).setPolar(degToRad(param.p2a), param.p2l);
39
- const p3 = p1.rotateOrig(degToRad(param.rotateOrig));
40
- const p4 = p1.scaleOrig(param.scaleOrig);
41
- figOne.addPoint(p1);
42
- figOne.addPoint(p2);
43
- figOne.addPoint(p3);
44
- figOne.addPoint(p4);
45
- rGeome.fig = { one: figOne };
46
- rGeome.logstr += 'verify_point draw successfully!\n';
47
- rGeome.calcErr = false;
48
- } catch (emsg) {
49
- rGeome.logstr += emsg as string;
50
- console.log(emsg as string);
51
- }
52
- return rGeome;
53
- }
54
-
55
- const verifyPoint1Def: tPageDef = {
56
- pTitle: 'Verify point',
57
- pDescription: 'Debugging point.ts',
58
- pDef: pDef,
59
- pGeom: pGeom
60
- };
61
-
62
- export { verifyPoint1Def };
@@ -1,66 +0,0 @@
1
- // verify_point_2.ts
2
-
3
- import type { tParamDef, tParamVal, tGeom, tPageDef } from 'geometrix';
4
- import { point, figure, pNumber, initGeom } from 'geometrix';
5
-
6
- const pDef: tParamDef = {
7
- partName: 'verify_point_2',
8
- params: [
9
- //pNumber(name, unit, init, min, max, step)
10
- pNumber('p1x', 'mm', 30, -200, 200, 1),
11
- pNumber('p1y', 'mm', 50, -200, 200, 1),
12
- pNumber('p2x', 'mm', -10, -200, 200, 1),
13
- pNumber('p2y', 'mm', 60, -200, 200, 1),
14
- pNumber('p3x', 'mm', 70, -200, 200, 1),
15
- pNumber('p3y', 'mm', -20, -200, 200, 1),
16
- pNumber('dist', 'mm', 50, 0, 200, 1)
17
- ],
18
- paramSvg: {
19
- p1x: 'verify_line_p1x.svg',
20
- p1y: 'verify_line_p1x.svg',
21
- p2x: 'verify_line_p1x.svg',
22
- p2y: 'verify_line_p1x.svg',
23
- p3x: 'verify_line_p1x.svg',
24
- p3y: 'verify_line_p1x.svg',
25
- dist: 'default_param_blank.svg'
26
- },
27
- sim: {
28
- tMax: 10,
29
- tStep: 0.1,
30
- tUpdate: 500 // every 0.5 second
31
- }
32
- };
33
-
34
- function pGeom(t: number, param: tParamVal): tGeom {
35
- const rGeome = initGeom(pDef.partName);
36
- rGeome.logstr += `${rGeome.partName} simTime: ${t}\n`;
37
- try {
38
- const figOne = figure();
39
- const p1 = point(param.p1x, param.p1y + t);
40
- const p2 = point(param.p2x, param.p2y);
41
- const p3 = point(param.p3x, param.p3y);
42
- const mp1p2 = p1.middlePoint(p2);
43
- const ep1p2 = p1.equidistantPoint(p2, param.dist, p3);
44
- figOne.addPoint(p1);
45
- figOne.addPoint(p2);
46
- figOne.addPoint(p3);
47
- figOne.addPoint(mp1p2);
48
- figOne.addPoint(ep1p2);
49
- rGeome.fig = { one: figOne };
50
- rGeome.logstr += 'verify_point_2 draw successfully!\n';
51
- rGeome.calcErr = false;
52
- } catch (emsg) {
53
- rGeome.logstr += emsg as string;
54
- console.log(emsg as string);
55
- }
56
- return rGeome;
57
- }
58
-
59
- const verifyPoint2Def: tPageDef = {
60
- pTitle: 'Verify point 2',
61
- pDescription: 'Debugging more point.ts',
62
- pDef: pDef,
63
- pGeom: pGeom
64
- };
65
-
66
- export { verifyPoint2Def };
@@ -1,70 +0,0 @@
1
- // verify_vector.ts
2
-
3
- import type { tParamDef, tParamVal, tGeom, tPageDef } from 'geometrix';
4
- import { degToRad, point, vector, figure, pNumber, initGeom } from 'geometrix';
5
-
6
- const pDef: tParamDef = {
7
- partName: 'verify_vector',
8
- params: [
9
- //pNumber(name, unit, init, min, max, step)
10
- pNumber('p1x', 'mm', 30, -200, 200, 1),
11
- pNumber('p1y', 'mm', 50, -200, 200, 1),
12
- pNumber('p2x', 'mm', 80, -200, 200, 1),
13
- pNumber('p2y', 'mm', -30, -200, 200, 1),
14
- pNumber('v1a', 'degree', 30, -200, 200, 1),
15
- pNumber('v1l', 'mm', 60, 0, 200, 1),
16
- pNumber('v2a', 'degree', 30, -200, 200, 1),
17
- pNumber('v2l', 'mm', 60, 0, 200, 1)
18
- ],
19
- paramSvg: {
20
- p1x: 'verify_vector_p1x.svg',
21
- p1y: 'verify_vector_p1x.svg',
22
- p2x: 'verify_vector_p1x.svg',
23
- p2y: 'verify_vector_p1x.svg',
24
- v1a: 'verify_vector_p1x.svg',
25
- v1l: 'verify_vector_p1x.svg',
26
- v2a: 'verify_vector_p1x.svg',
27
- v2l: 'verify_vector_p1x.svg'
28
- },
29
- sim: {
30
- tMax: 10,
31
- tStep: 0.1,
32
- tUpdate: 500 // every 0.5 second
33
- }
34
- };
35
-
36
- function pGeom(t: number, param: tParamVal): tGeom {
37
- const rGeome = initGeom(pDef.partName);
38
- rGeome.logstr += `${rGeome.partName} simTime: ${t}\n`;
39
- try {
40
- const figOne = figure();
41
- const p1 = point(param.p1x, param.p1y + t);
42
- const p2 = point(param.p2x, param.p2y);
43
- const v1 = vector(degToRad(param.v1a), param.v1l, p1);
44
- const v2 = vector(degToRad(param.v2a), param.v2l, p1);
45
- figOne.addPoint(p1);
46
- figOne.addPoint(p2);
47
- figOne.addVector(v1);
48
- figOne.addVector(v2);
49
- const v3 = v1.add(v2);
50
- const p3 = v3.translatePoint(p2);
51
- figOne.addVector(v3);
52
- figOne.addPoint(p3);
53
- rGeome.fig = { one: figOne };
54
- rGeome.logstr += 'verify_vector draw successfully!\n';
55
- rGeome.calcErr = false;
56
- } catch (emsg) {
57
- rGeome.logstr += emsg as string;
58
- console.log(emsg);
59
- }
60
- return rGeome;
61
- }
62
-
63
- const verifyVector1Def: tPageDef = {
64
- pTitle: 'Verify vector',
65
- pDescription: 'Debugging vector.ts',
66
- pDef: pDef,
67
- pGeom: pGeom
68
- };
69
-
70
- export { verifyVector1Def };
@@ -1,254 +0,0 @@
1
- // base.ts
2
-
3
- import type {
4
- tContour,
5
- tParamDef,
6
- tParamVal,
7
- tGeom,
8
- tExtrude,
9
- tPageDef
10
- //tSubInst
11
- //tSubDesign
12
- } from 'geometrix';
13
- import {
14
- contour,
15
- contourCircle,
16
- figure,
17
- //degToRad,
18
- //radToDeg,
19
- ffix,
20
- pNumber,
21
- //pCheckbox,
22
- //pDropdown,
23
- initGeom,
24
- EExtrude,
25
- EBVolume
26
- } from 'geometrix';
27
-
28
- const pDef: tParamDef = {
29
- partName: 'base',
30
- params: [
31
- //pNumber(name, unit, init, min, max, step)
32
- pNumber('D1', 'mm', 600, 100, 4000, 10),
33
- pNumber('D2', 'mm', 700, 100, 4000, 10),
34
- pNumber('D3', 'mm', 400, 100, 4000, 10),
35
- pNumber('D4', 'mm', 500, 100, 4000, 10),
36
- pNumber('E1', 'mm', 30, 1, 80, 1),
37
- pNumber('E2', 'mm', 30, 1, 80, 1),
38
- pNumber('E3', 'mm', 30, 1, 80, 1),
39
- pNumber('H1', 'mm', 800, 10, 4000, 10),
40
- pNumber('H2', 'mm', 50, 10, 4000, 10),
41
- pNumber('H3', 'mm', 400, 10, 4000, 10),
42
- pNumber('N2', '', 12, 1, 100, 1),
43
- pNumber('L2', 'mm', 100, 1, 400, 1),
44
- pNumber('N1', '', 24, 3, 100, 1),
45
- pNumber('D5', 'mm', 40, 1, 100, 1),
46
- pNumber('L1', 'mm', 34, 1, 300, 1)
47
- ],
48
- paramSvg: {
49
- D1: 'base_cut.svg',
50
- D2: 'base_cut.svg',
51
- D3: 'base_cut.svg',
52
- D4: 'base_cut.svg',
53
- E1: 'base_cut.svg',
54
- E2: 'base_cut.svg',
55
- E3: 'base_cut.svg',
56
- H1: 'base_cut.svg',
57
- H2: 'base_hollow.svg',
58
- H3: 'base_hollow.svg',
59
- N2: 'base_hollow.svg',
60
- L2: 'base_hollow.svg',
61
- N1: 'base_top.svg',
62
- D5: 'base_top.svg',
63
- L1: 'base_top.svg'
64
- },
65
- sim: {
66
- tMax: 180,
67
- tStep: 0.5,
68
- tUpdate: 500 // every 0.5 second
69
- }
70
- };
71
-
72
- type tCtr1 = (orient: number) => tContour;
73
-
74
- function pGeom(t: number, param: tParamVal): tGeom {
75
- let ctrBaseCut1: tCtr1;
76
- let ctrBaseCut2: tCtr1;
77
- let ctrHollow: tCtr1;
78
- const rGeome = initGeom(pDef.partName);
79
- const figCut = figure();
80
- const figTop = figure();
81
- const figHollow = figure();
82
- rGeome.logstr += `${rGeome.partName} simTime: ${t}\n`;
83
- try {
84
- const R1 = param.D1 / 2;
85
- const R2 = param.D2 / 2;
86
- const R3 = param.D3 / 2;
87
- const R4 = param.D4 / 2;
88
- const R5 = param.D5 / 2;
89
- const RL2 = param.L2 / 2;
90
- if (R2 < R1) {
91
- throw `err089: D2 ${param.D2} too small compare to D1 ${param.D1}`;
92
- }
93
- if (R4 > R1 - param.E2) {
94
- throw `err189: D4 ${param.D4} too large compare to D1 ${param.D1} and E2 ${param.E2}`;
95
- }
96
- rGeome.logstr += `base-height: ${ffix(param.H1)} mm\n`;
97
- rGeome.logstr += `base-external-diameter: ${ffix(param.D2)} mm\n`;
98
- // figCut
99
- ctrBaseCut1 = function (orient: number): tContour {
100
- const rBaseCut1 = contour(orient * R2, 0)
101
- .addSegStrokeA(orient * R2, param.E3)
102
- .addSegStrokeA(orient * R1, param.E3)
103
- .addSegStrokeA(orient * R1, param.H1)
104
- .addSegStrokeA(orient * (R1 - param.E2), param.H1)
105
- .addSegStrokeA(orient * (R1 - param.E2), param.E3)
106
- .addSegStrokeA(orient * R4, param.E3)
107
- .addSegStrokeA(orient * R4, 0)
108
- .closeSegStroke();
109
- return rBaseCut1;
110
- };
111
- ctrBaseCut2 = function (orient: number): tContour {
112
- const rBaseCut2 = contour(orient * R2, 0)
113
- .addSegStrokeA(orient * R2, param.E3)
114
- .addSegStrokeA(orient * R1, param.E3)
115
- .addSegStrokeA(orient * R1, param.H1)
116
- .addSegStrokeA(orient * R3, param.H1)
117
- .addSegStrokeA(orient * R3, param.H1 - param.E1)
118
- .addSegStrokeA(orient * (R1 - param.E2), param.H1 - param.E1)
119
- .addSegStrokeA(orient * (R1 - param.E2), param.E3)
120
- .addSegStrokeA(orient * R4, param.E3)
121
- .addSegStrokeA(orient * R4, 0)
122
- .closeSegStroke();
123
- return rBaseCut2;
124
- };
125
- if (param.H1 < param.E3 + param.H2 + param.H3 + param.E1) {
126
- throw `err125: H1 ${param.H1} too small compare to E3 ${param.H3}, H2 ${param.H2}, H3 ${param.H3}, E1 ${param.E1}`;
127
- }
128
- if (param.D5 > param.H3) {
129
- throw `err128: D5 ${param.D5} too large compare to H3 ${param.H3}`;
130
- }
131
- const hollowAngle = 2 * Math.asin(RL2 / (R1 - param.E2));
132
- if (param.N2 * hollowAngle > 2 * Math.PI) {
133
- throw `err132: N2 ${param.N2} too large compare to L2 ${param.L2}, D1 ${param.D1}, E2 ${param.E2}`;
134
- }
135
- const hollowH = param.E3 + param.H2 + RL2;
136
- ctrHollow = function (orient: number): tContour {
137
- const rHollow = contour(orient * RL2, hollowH)
138
- .addSegStrokeA(orient * RL2, hollowH + param.H3 - param.L2)
139
- .addPointA(-orient * RL2, hollowH + param.H3 - param.L2)
140
- .addSegArc(RL2, false, true)
141
- .addSegStrokeA(-orient * RL2, hollowH)
142
- //.addPointA(orient * RL2, hollowH)
143
- .closeSegArc(RL2, false, true);
144
- return rHollow;
145
- };
146
- figCut.addMain(ctrBaseCut1(1));
147
- figCut.addSecond(ctrBaseCut2(1));
148
- figCut.addSecond(ctrBaseCut2(-1));
149
- figCut.addSecond(ctrHollow(1));
150
- // figTop
151
- if (R3 + param.L1 + R5 > R1 - param.E2) {
152
- throw `err127: D3 ${param.D3} too large compare to D1 ${param.D1}, E2 ${param.E2}, L1 ${param.L1}, R5 ${param.D5}`;
153
- }
154
- if (R5 > param.L1) {
155
- throw `err130: D5 ${param.D5} too large compare to L1 ${param.L1}`;
156
- }
157
- const holeAngle = 2 * Math.asin(R5 / (R2 + param.L1));
158
- if (param.N1 * holeAngle > 2 * Math.PI) {
159
- throw `err134: N1 ${param.N1} too large compare to D5 ${param.D5}, L1 ${param.L1}, D2 ${param.D2}`;
160
- }
161
- figTop.addMain(contourCircle(0, 0, R1));
162
- figTop.addMain(contourCircle(0, 0, R3));
163
- const posR = R3 + param.L1;
164
- const posA = (2 * Math.PI) / param.N1;
165
- for (let i = 0; i < param.N1; i++) {
166
- const posX = posR * Math.cos(i * posA);
167
- const posY = posR * Math.sin(i * posA);
168
- figTop.addMain(contourCircle(posX, posY, R5));
169
- }
170
- figTop.addSecond(contourCircle(0, 0, R1 - param.E1));
171
- figTop.addSecond(contourCircle(0, 0, R2));
172
- figTop.addSecond(contourCircle(0, 0, R4));
173
- // figHollow
174
- figHollow.addMain(ctrHollow(1));
175
- figHollow.addSecond(ctrBaseCut2(1));
176
- figHollow.addSecond(ctrBaseCut2(-1));
177
- // final figure list
178
- rGeome.fig = {
179
- faceCut: figCut,
180
- faceTop: figTop,
181
- faceHollow: figHollow
182
- };
183
- const designName = rGeome.partName;
184
- const hollowStep = (2 * Math.PI) / param.N2;
185
- const lHollow = [...Array(param.N2).keys()];
186
- const preExtrude = lHollow.map((idx) => {
187
- const rHollow: tExtrude = {
188
- outName: `subpax_${designName}_hollow_${idx}`,
189
- face: `${designName}_faceHollow`,
190
- extrudeMethod: EExtrude.eLinearOrtho,
191
- length: R2 + param.E2,
192
- rotate: [Math.PI / 2, 0, idx * hollowStep],
193
- translate: [0, 0, 0]
194
- };
195
- return rHollow;
196
- });
197
- const lVolHollow = lHollow.map((idx) => `subpax_${designName}_hollow_${idx}`);
198
- rGeome.vol = {
199
- extrudes: [
200
- {
201
- outName: `subpax_${designName}_cut`,
202
- face: `${designName}_faceCut`,
203
- extrudeMethod: EExtrude.eRotate,
204
- rotate: [0, 0, 0],
205
- translate: [Math.PI / 2, 0, 0]
206
- },
207
- {
208
- outName: `subpax_${designName}_top`,
209
- face: `${designName}_faceTop`,
210
- extrudeMethod: EExtrude.eLinearOrtho,
211
- length: param.E1,
212
- rotate: [0, 0, 0],
213
- translate: [0, 0, param.H1 - param.E1]
214
- },
215
- ...preExtrude
216
- ],
217
- volumes: [
218
- {
219
- outName: `ipax_${designName}_hollows`,
220
- boolMethod: EBVolume.eUnion,
221
- inList: [...lVolHollow]
222
- },
223
- {
224
- outName: `ipax_${designName}_cylinder`,
225
- boolMethod: EBVolume.eSubstraction,
226
- inList: [`subpax_${designName}_cut`, `ipax_${designName}_hollows`]
227
- },
228
- {
229
- outName: `pax_${designName}`,
230
- boolMethod: EBVolume.eUnion,
231
- inList: [`ipax_${designName}_cylinder`, `subpax_${designName}_top`]
232
- }
233
- ]
234
- };
235
- // sub-design
236
- rGeome.sub = {};
237
- // finalize
238
- rGeome.logstr += 'heliostat-base draw successfully!\n';
239
- rGeome.calcErr = false;
240
- } catch (emsg) {
241
- rGeome.logstr += emsg as string;
242
- console.log(emsg as string);
243
- }
244
- return rGeome;
245
- }
246
-
247
- const baseDef: tPageDef = {
248
- pTitle: 'Heliostat base',
249
- pDescription: 'The base for the static-pole of the heliostat',
250
- pDef: pDef,
251
- pGeom: pGeom
252
- };
253
-
254
- export { baseDef };