designix 0.5.3

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 (237) hide show
  1. package/.eslintignore +17 -0
  2. package/.eslintrc.cjs +24 -0
  3. package/.prettierignore +15 -0
  4. package/.prettierrc +8 -0
  5. package/README.md +27 -0
  6. package/export_svg/base.svg +1 -0
  7. package/export_svg/base_cut.svg +1 -0
  8. package/export_svg/base_hollow.svg +1 -0
  9. package/export_svg/base_top.svg +1 -0
  10. package/export_svg/calculation_of_initAngle2.svg +1 -0
  11. package/export_svg/circles.svg +1 -0
  12. package/export_svg/circles_amplitude-offset.svg +1 -0
  13. package/export_svg/circles_amplitude-scale.svg +1 -0
  14. package/export_svg/circles_angle.svg +1 -0
  15. package/export_svg/default_param_blank.svg +1 -0
  16. package/export_svg/dummy_pole_static.svg +1 -0
  17. package/export_svg/dummy_pole_static_face.svg +1 -0
  18. package/export_svg/gear_addendeum_dedendum_sizes.svg +9 -0
  19. package/export_svg/gear_addendum_and_dedendum.svg +1 -0
  20. package/export_svg/gear_adherence_replaced_by_teeth.svg +1 -0
  21. package/export_svg/gear_base_circle_for_involute.svg +2 -0
  22. package/export_svg/gear_base_left_circle_for_involute.svg +2 -0
  23. package/export_svg/gear_base_right_circle_for_involute.svg +2 -0
  24. package/export_svg/gear_inter_axis_maximum_distance.svg +1 -0
  25. package/export_svg/gear_inter_axis_minimum_distance.svg +1 -0
  26. package/export_svg/gear_large_base_radius.svg +5 -0
  27. package/export_svg/gear_module_and_tooth_thickness.svg +3 -0
  28. package/export_svg/gear_optimum_base_radius.svg +5 -0
  29. package/export_svg/gear_optimum_base_radius_with_longer_inter_axis.svg +5 -0
  30. package/export_svg/gear_right_left_base_circles.svg +1 -0
  31. package/export_svg/gear_small_base_radius.svg +5 -0
  32. package/export_svg/gear_wheel_circles.svg +2 -0
  33. package/export_svg/gears.svg +71 -0
  34. package/export_svg/gears_motion_transmission_via_adherence.svg +1 -0
  35. package/export_svg/heliostat.svg +1 -0
  36. package/export_svg/heliostat2_face_sizing.svg +1 -0
  37. package/export_svg/heliostat2_side_sizing.svg +1 -0
  38. package/export_svg/heliostat_face_sizing.svg +1 -0
  39. package/export_svg/heliostat_overview.svg +1 -0
  40. package/export_svg/heliostat_side.svg +1 -0
  41. package/export_svg/heliostat_side_sizing.svg +1 -0
  42. package/export_svg/involute_of_circle.svg +19 -0
  43. package/export_svg/involute_of_circle_R0.svg +1 -0
  44. package/export_svg/involute_of_circle_Ri1_u0.svg +1 -0
  45. package/export_svg/involute_of_circle_Ri2_u2.svg +1 -0
  46. package/export_svg/left_side_angle_kitchen.svg +1 -0
  47. package/export_svg/negative_involute_of_circle_R0.svg +1 -0
  48. package/export_svg/point_c_position_and_speed_negative.svg +1 -0
  49. package/export_svg/point_c_position_and_speed_positive.svg +1 -0
  50. package/export_svg/pole_rotor.svg +1 -0
  51. package/export_svg/pole_rotor_cut.svg +1 -0
  52. package/export_svg/pole_rotor_ends.svg +1 -0
  53. package/export_svg/pole_stator.svg +3 -0
  54. package/export_svg/pole_stator_E2.svg +3 -0
  55. package/export_svg/pole_stator_bottom.svg +1 -0
  56. package/export_svg/pole_stator_cut.svg +1 -0
  57. package/export_svg/pole_stator_face.svg +1 -0
  58. package/export_svg/pole_stator_right.svg +1 -0
  59. package/export_svg/rake.svg +1 -0
  60. package/export_svg/rake_door.svg +1 -0
  61. package/export_svg/rake_face.svg +1 -0
  62. package/export_svg/rake_side.svg +1 -0
  63. package/export_svg/rake_side_stopper.svg +1 -0
  64. package/export_svg/rake_top.svg +1 -0
  65. package/export_svg/rake_top_stopper.svg +1 -0
  66. package/export_svg/rectangle.svg +1 -0
  67. package/export_svg/rectangle_height.svg +1 -0
  68. package/export_svg/rectangle_width.svg +1 -0
  69. package/export_svg/right_side_angle_kitchen.svg +1 -0
  70. package/export_svg/rod.svg +1 -0
  71. package/export_svg/rod_cut.svg +1 -0
  72. package/export_svg/rod_plate.svg +1 -0
  73. package/export_svg/rod_top.svg +1 -0
  74. package/export_svg/spider.svg +1 -0
  75. package/export_svg/spider_lateral.svg +1 -0
  76. package/export_svg/spider_profile.svg +1 -0
  77. package/export_svg/surface.svg +3 -0
  78. package/export_svg/surface_crenel.svg +1 -0
  79. package/export_svg/surface_extremities.svg +2 -0
  80. package/export_svg/surface_lz.svg +1 -0
  81. package/export_svg/surface_main.svg +1 -0
  82. package/export_svg/surface_power.svg +2 -0
  83. package/export_svg/surface_space_evolution.svg +1 -0
  84. package/export_svg/surface_space_shape.svg +1 -0
  85. package/export_svg/swing.svg +1 -0
  86. package/export_svg/swing_face.svg +1 -0
  87. package/export_svg/swing_side.svg +1 -0
  88. package/export_svg/swing_top.svg +1 -0
  89. package/export_svg/swing_with_rod.svg +1 -0
  90. package/export_svg/trapeze.svg +1 -0
  91. package/export_svg/trapeze_rod.svg +1 -0
  92. package/export_svg/trapeze_side.svg +1 -0
  93. package/export_svg/trapeze_top.svg +1 -0
  94. package/export_svg/verify_contour_1.svg +1 -0
  95. package/export_svg/verify_contour_1_l1.svg +1 -0
  96. package/export_svg/verify_contour_1_r1.svg +1 -0
  97. package/export_svg/verify_line.svg +1 -0
  98. package/export_svg/verify_line_2_l1cx.svg +1 -0
  99. package/export_svg/verify_line_p1x.svg +1 -0
  100. package/export_svg/verify_point.svg +1 -0
  101. package/export_svg/verify_point_p1x.svg +1 -0
  102. package/export_svg/verify_vector_p1x.svg +1 -0
  103. package/package.json +76 -0
  104. package/src/dummy/circles.ts +65 -0
  105. package/src/dummy/pole_static.ts +86 -0
  106. package/src/dummy/rectangle.ts +55 -0
  107. package/src/dummy/svg/circles.svg +288 -0
  108. package/src/dummy/svg/circles_amplitude-offset.svg +109 -0
  109. package/src/dummy/svg/circles_amplitude-scale.svg +122 -0
  110. package/src/dummy/svg/circles_angle.svg +110 -0
  111. package/src/dummy/svg/dummy_pole_static.svg +192 -0
  112. package/src/dummy/svg/dummy_pole_static_face.svg +176 -0
  113. package/src/dummy/svg/rectangle.svg +131 -0
  114. package/src/dummy/svg/rectangle_height.svg +82 -0
  115. package/src/dummy/svg/rectangle_width.svg +81 -0
  116. package/src/gears/gearWheelProfile.test.ts +25 -0
  117. package/src/gears/gearWheelProfile.ts +753 -0
  118. package/src/gears/gear_wheel_wheel.ts +335 -0
  119. package/src/gears/involute.test.ts +21 -0
  120. package/src/gears/involute.ts +113 -0
  121. package/src/gears/simplified_gear_wheel.ts +242 -0
  122. package/src/gears/svg/calculation_of_initAngle2.svg +376 -0
  123. package/src/gears/svg/gear_addendeum_dedendum_sizes.svg +471 -0
  124. package/src/gears/svg/gear_addendum_and_dedendum.svg +269 -0
  125. package/src/gears/svg/gear_adherence_replaced_by_teeth.svg +168 -0
  126. package/src/gears/svg/gear_base_circle_for_involute.svg +376 -0
  127. package/src/gears/svg/gear_base_left_circle_for_involute.svg +556 -0
  128. package/src/gears/svg/gear_base_right_circle_for_involute.svg +516 -0
  129. package/src/gears/svg/gear_inter_axis_maximum_distance.svg +218 -0
  130. package/src/gears/svg/gear_inter_axis_minimum_distance.svg +218 -0
  131. package/src/gears/svg/gear_large_base_radius.svg +199 -0
  132. package/src/gears/svg/gear_module_and_tooth_thickness.svg +319 -0
  133. package/src/gears/svg/gear_optimum_base_radius.svg +232 -0
  134. package/src/gears/svg/gear_optimum_base_radius_with_longer_inter_axis.svg +344 -0
  135. package/src/gears/svg/gear_right_left_base_circles.svg +295 -0
  136. package/src/gears/svg/gear_small_base_radius.svg +163 -0
  137. package/src/gears/svg/gear_wheel_circles.svg +348 -0
  138. package/src/gears/svg/gears.svg +4726 -0
  139. package/src/gears/svg/gears_motion_transmission_via_adherence.svg +178 -0
  140. package/src/gears/svg/involute_of_circle.svg +2745 -0
  141. package/src/gears/svg/involute_of_circle_R0.svg +334 -0
  142. package/src/gears/svg/involute_of_circle_Ri1_u0.svg +297 -0
  143. package/src/gears/svg/involute_of_circle_Ri2_u2.svg +386 -0
  144. package/src/gears/svg/left_side_angle_kitchen.svg +207 -0
  145. package/src/gears/svg/negative_involute_of_circle_R0.svg +381 -0
  146. package/src/gears/svg/point_c_position_and_speed_negative.svg +343 -0
  147. package/src/gears/svg/point_c_position_and_speed_positive.svg +339 -0
  148. package/src/gears/svg/right_side_angle_kitchen.svg +201 -0
  149. package/src/gears/wheelElements.test.ts +13 -0
  150. package/src/gears/wheelElements.ts +176 -0
  151. package/src/geometrix_verification/svg/verify_contour_1.svg +320 -0
  152. package/src/geometrix_verification/svg/verify_contour_1_l1.svg +102 -0
  153. package/src/geometrix_verification/svg/verify_contour_1_r1.svg +170 -0
  154. package/src/geometrix_verification/svg/verify_line.svg +845 -0
  155. package/src/geometrix_verification/svg/verify_line_2_l1cx.svg +274 -0
  156. package/src/geometrix_verification/svg/verify_line_p1x.svg +261 -0
  157. package/src/geometrix_verification/svg/verify_point.svg +350 -0
  158. package/src/geometrix_verification/svg/verify_point_p1x.svg +258 -0
  159. package/src/geometrix_verification/svg/verify_vector_p1x.svg +282 -0
  160. package/src/geometrix_verification/verify_contour_1.ts +94 -0
  161. package/src/geometrix_verification/verify_contour_2.ts +267 -0
  162. package/src/geometrix_verification/verify_contour_3.ts +409 -0
  163. package/src/geometrix_verification/verify_contour_4.ts +91 -0
  164. package/src/geometrix_verification/verify_exports_1.ts +95 -0
  165. package/src/geometrix_verification/verify_line.ts +76 -0
  166. package/src/geometrix_verification/verify_line_2.ts +76 -0
  167. package/src/geometrix_verification/verify_line_3.ts +64 -0
  168. package/src/geometrix_verification/verify_point.ts +62 -0
  169. package/src/geometrix_verification/verify_point_2.ts +66 -0
  170. package/src/geometrix_verification/verify_vector.ts +70 -0
  171. package/src/heliostat/base.ts +254 -0
  172. package/src/heliostat/heliostat.ts +317 -0
  173. package/src/heliostat/heliostat_2.ts +284 -0
  174. package/src/heliostat/pole_rotor.ts +165 -0
  175. package/src/heliostat/pole_static.ts +275 -0
  176. package/src/heliostat/rake.ts +486 -0
  177. package/src/heliostat/rake_stopper.ts +409 -0
  178. package/src/heliostat/rod.ts +200 -0
  179. package/src/heliostat/spider.ts +238 -0
  180. package/src/heliostat/surface.ts +320 -0
  181. package/src/heliostat/svg/base.svg +1367 -0
  182. package/src/heliostat/svg/base_cut.svg +459 -0
  183. package/src/heliostat/svg/base_hollow.svg +469 -0
  184. package/src/heliostat/svg/base_top.svg +338 -0
  185. package/src/heliostat/svg/heliostat.svg +8013 -0
  186. package/src/heliostat/svg/heliostat2_face_sizing.svg +1386 -0
  187. package/src/heliostat/svg/heliostat2_side_sizing.svg +984 -0
  188. package/src/heliostat/svg/heliostat_face_sizing.svg +1448 -0
  189. package/src/heliostat/svg/heliostat_overview.svg +1552 -0
  190. package/src/heliostat/svg/heliostat_side.svg +1470 -0
  191. package/src/heliostat/svg/heliostat_side_sizing.svg +1128 -0
  192. package/src/heliostat/svg/pole_rotor.svg +592 -0
  193. package/src/heliostat/svg/pole_rotor_cut.svg +287 -0
  194. package/src/heliostat/svg/pole_rotor_ends.svg +336 -0
  195. package/src/heliostat/svg/pole_stator.svg +1945 -0
  196. package/src/heliostat/svg/pole_stator_E2.svg +410 -0
  197. package/src/heliostat/svg/pole_stator_bottom.svg +330 -0
  198. package/src/heliostat/svg/pole_stator_cut.svg +465 -0
  199. package/src/heliostat/svg/pole_stator_face.svg +457 -0
  200. package/src/heliostat/svg/pole_stator_right.svg +357 -0
  201. package/src/heliostat/svg/rake.svg +4691 -0
  202. package/src/heliostat/svg/rake_door.svg +617 -0
  203. package/src/heliostat/svg/rake_face.svg +1211 -0
  204. package/src/heliostat/svg/rake_side.svg +809 -0
  205. package/src/heliostat/svg/rake_side_stopper.svg +596 -0
  206. package/src/heliostat/svg/rake_top.svg +514 -0
  207. package/src/heliostat/svg/rake_top_stopper.svg +565 -0
  208. package/src/heliostat/svg/rod.svg +1314 -0
  209. package/src/heliostat/svg/rod_cut.svg +265 -0
  210. package/src/heliostat/svg/rod_plate.svg +409 -0
  211. package/src/heliostat/svg/rod_top.svg +577 -0
  212. package/src/heliostat/svg/spider.svg +693 -0
  213. package/src/heliostat/svg/spider_lateral.svg +222 -0
  214. package/src/heliostat/svg/spider_profile.svg +429 -0
  215. package/src/heliostat/svg/surface.svg +3577 -0
  216. package/src/heliostat/svg/surface_crenel.svg +1335 -0
  217. package/src/heliostat/svg/surface_extremities.svg +510 -0
  218. package/src/heliostat/svg/surface_lz.svg +182 -0
  219. package/src/heliostat/svg/surface_main.svg +366 -0
  220. package/src/heliostat/svg/surface_power.svg +331 -0
  221. package/src/heliostat/svg/surface_space_evolution.svg +210 -0
  222. package/src/heliostat/svg/surface_space_shape.svg +98 -0
  223. package/src/heliostat/svg/swing.svg +3310 -0
  224. package/src/heliostat/svg/swing_face.svg +902 -0
  225. package/src/heliostat/svg/swing_side.svg +574 -0
  226. package/src/heliostat/svg/swing_top.svg +923 -0
  227. package/src/heliostat/svg/swing_with_rod.svg +547 -0
  228. package/src/heliostat/svg/trapeze.svg +1711 -0
  229. package/src/heliostat/svg/trapeze_rod.svg +122 -0
  230. package/src/heliostat/svg/trapeze_side.svg +361 -0
  231. package/src/heliostat/svg/trapeze_top.svg +1057 -0
  232. package/src/heliostat/swing.ts +246 -0
  233. package/src/heliostat/trapeze.ts +510 -0
  234. package/src/index.ts +33 -0
  235. package/src/svg/default_param_blank.svg +40 -0
  236. package/tsconfig.json +13 -0
  237. package/vitest.config.ts +7 -0
@@ -0,0 +1,76 @@
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 };
@@ -0,0 +1,64 @@
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 };
@@ -0,0 +1,62 @@
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 };
@@ -0,0 +1,66 @@
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 };
@@ -0,0 +1,70 @@
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 };
@@ -0,0 +1,254 @@
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 };