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,486 @@
1
+ // rake.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: 'rake',
30
+ params: [
31
+ //pNumber(name, unit, init, min, max, step)
32
+ pNumber('D1', 'mm', 600, 100, 4000, 10),
33
+ pNumber('D2', 'mm', 400, 100, 4000, 10),
34
+ pNumber('D3', 'mm', 400, 100, 4000, 10),
35
+ pNumber('H1', 'mm', 800, 100, 4000, 10),
36
+ pNumber('H2', 'mm', 3000, 100, 6000, 10),
37
+ pNumber('H3', 'mm', 400, 0, 4000, 10),
38
+ pNumber('E1', 'mm', 20, 1, 80, 1),
39
+ pNumber('E3', 'mm', 30, 1, 80, 1),
40
+ pNumber('H4', 'mm', 400, 100, 1000, 10),
41
+ pNumber('D4', 'mm', 300, 100, 1000, 10),
42
+ pNumber('E4', 'mm', 20, 1, 80, 1),
43
+ pNumber('H5', 'mm', 1000, 100, 2000, 10),
44
+ pNumber('D5', 'mm', 200, 10, 1000, 10),
45
+ pNumber('L4', 'mm', 300, 10, 1000, 10),
46
+ pNumber('L5', 'mm', 2000, 100, 4000, 10),
47
+ pNumber('L6', 'mm', 2000, 100, 4000, 10),
48
+ pNumber('D6', 'mm', 100, 10, 600, 10),
49
+ pNumber('E6', 'mm', 10, 1, 80, 1),
50
+ pNumber('L7', 'mm', 100, 10, 1000, 1),
51
+ pNumber('L8', 'mm', 200, 10, 1000, 1),
52
+ pNumber('N1', '', 24, 3, 100, 1),
53
+ pNumber('D7', 'mm', 40, 1, 100, 1),
54
+ pNumber('L1', 'mm', 30, 1, 300, 1),
55
+ pNumber('D8', 'mm', 400, 100, 1000, 10),
56
+ pNumber('H6', 'mm', 100, 50, 1000, 10),
57
+ pNumber('H7', 'mm', 600, 100, 2000, 10),
58
+ pNumber('L9', 'mm', 300, 100, 1000, 10),
59
+ pNumber('R9', 'mm', 50, 0, 300, 1)
60
+ ],
61
+ paramSvg: {
62
+ D1: 'rake_face.svg',
63
+ D2: 'rake_face.svg',
64
+ D3: 'rake_face.svg',
65
+ H1: 'rake_face.svg',
66
+ H2: 'rake_face.svg',
67
+ H3: 'rake_face.svg',
68
+ E1: 'rake_face.svg',
69
+ E3: 'rake_face.svg',
70
+ H4: 'rake_side.svg',
71
+ D4: 'rake_side.svg',
72
+ E4: 'rake_side.svg',
73
+ H5: 'rake_side.svg',
74
+ D5: 'rake_side.svg',
75
+ L4: 'rake_face.svg',
76
+ L5: 'rake_face.svg',
77
+ L6: 'rake_face.svg',
78
+ D6: 'rake_face.svg',
79
+ E6: 'rake_face.svg',
80
+ L7: 'rake_face.svg',
81
+ L8: 'rake_face.svg',
82
+ N1: 'rake_top.svg',
83
+ D7: 'rake_top.svg',
84
+ L1: 'rake_top.svg',
85
+ D8: 'rake_side.svg',
86
+ H6: 'rake_door.svg',
87
+ H7: 'rake_door.svg',
88
+ L9: 'rake_door.svg',
89
+ R9: 'rake_door.svg'
90
+ },
91
+ sim: {
92
+ tMax: 180,
93
+ tStep: 0.5,
94
+ tUpdate: 500 // every 0.5 second
95
+ }
96
+ };
97
+
98
+ type tCtr1 = (orient: number) => tContour;
99
+ type tCtr2 = (width: number, height: number, xpos: number, ypos: number, angle: number) => tContour;
100
+
101
+ function pGeom(t: number, param: tParamVal): tGeom {
102
+ let ctrCone: tCtr1;
103
+ let ctrConePlus: tCtr1;
104
+ let ctrRect: tCtr2;
105
+ const rGeome = initGeom(pDef.partName);
106
+ const figCone = figure();
107
+ const figBeam = figure();
108
+ const figBeamHollow = figure();
109
+ const figDisc = figure();
110
+ const figHand = figure();
111
+ const figWing = figure();
112
+ const figWingHollow = figure();
113
+ const figDoor = figure();
114
+ rGeome.logstr += `${rGeome.partName} simTime: ${t}\n`;
115
+ try {
116
+ const R1 = param.D1 / 2;
117
+ const R2 = param.D2 / 2;
118
+ const R3 = param.D3 / 2;
119
+ const R4 = param.D4 / 2;
120
+ const R5 = param.D5 / 2;
121
+ const R6 = param.D6 / 2;
122
+ const R7 = param.D7 / 2;
123
+ const R8 = param.D8 / 2;
124
+ const H1H2 = param.H1 + param.H2;
125
+ const H1H5 = H1H2 - param.H4 + param.H5;
126
+ rGeome.logstr += `cone-height: ${ffix(H1H2)} mm\n`;
127
+ rGeome.logstr += `cone-height total: ${ffix(H1H5)} mm\n`;
128
+ if (param.D2 > param.D1) {
129
+ throw `err110: D2 ${param.D2} is larger than D1 ${param.D1}`;
130
+ }
131
+ if (param.D3 + param.E1 > param.D1) {
132
+ throw `err113: D3 ${param.D3} is too large compare to D1 ${param.D1} and E1 ${param.E1}`;
133
+ }
134
+ if (param.H3 + param.E3 > param.H1) {
135
+ throw `err116: H3 ${param.H3} is too large compare to H1 ${param.H1} and E3 ${param.E3}`;
136
+ }
137
+ if (param.H4 + R4 > param.H2) {
138
+ throw `err119: H4 ${param.H4} is too large compare to H2 ${param.H2} and D4 ${param.D4}`;
139
+ }
140
+ if (param.E4 > R4) {
141
+ throw `err122: E4 ${param.E4} is too large compare to D4 ${param.D4}`;
142
+ }
143
+ if (param.D8 <= param.D5) {
144
+ throw `err146: D8 ${param.D8} is too small compare to D5 ${param.D5}`;
145
+ }
146
+ const beamL = 4 * param.L4 + param.L5 + 2 * param.L6;
147
+ const beamH = param.H1 + param.H2 - param.H4;
148
+ const handLowX = R4 * Math.cos(Math.PI / 6);
149
+ const handLowY = R4 * Math.sin(Math.PI / 6);
150
+ const handHighXint = R5 * Math.cos(Math.PI / 6);
151
+ const handHighYint = R5 * Math.sin(Math.PI / 6);
152
+ const handHighXext = R8 * Math.cos(Math.PI / 6);
153
+ const handHighYext = R8 * Math.sin(Math.PI / 6);
154
+ const handPos = [-beamL / 2, -param.L5 / 2 - param.L4, param.L5 / 2, beamL / 2 - param.L4];
155
+ const wingLy = param.H2 - param.L8 - param.H4 - R4;
156
+ if (wingLy < 0) {
157
+ throw `err140: H2 ${param.H2} too small compare to L8 ${param.L8}, H4 ${param.H4} and D4 ${param.D4}`;
158
+ }
159
+ const coneAngle = Math.atan2(R1 - R2, param.H2);
160
+ rGeome.logstr += `cone-angle: ${ffix(radToDeg(coneAngle))} degree\n`;
161
+ const wingLx = beamL / 2 - param.L7 - R1 + param.L8 * Math.tan(coneAngle);
162
+ const wingL = Math.sqrt(wingLx ** 2 + wingLy ** 2);
163
+ const wingAngle = Math.atan2(wingLx, wingLy);
164
+ rGeome.logstr += `wing-angle: ${ffix(radToDeg(wingAngle))} degree\n`;
165
+ const wingLPre = param.E1 / Math.sin(wingAngle + coneAngle);
166
+ const wingL2 = wingL + param.E4 / Math.cos(wingAngle) + wingLPre;
167
+ const wingPosX = R1 - param.L8 * Math.tan(coneAngle) - wingLPre * Math.sin(wingAngle);
168
+ const wingPosY = param.H1 + param.L8 - wingLPre * Math.cos(wingAngle);
169
+ const wingCPosX = wingPosX - R6 * Math.cos(wingAngle);
170
+ const wingCPosY = wingPosY + R6 * Math.sin(wingAngle);
171
+ const wingHR = R6 - param.E6;
172
+ const wingHPosX = wingPosX - param.E6 * Math.cos(wingAngle);
173
+ const wingHPosY = wingPosY + param.E6 * Math.sin(wingAngle);
174
+ const wingAngleC = Math.PI / 2 - wingAngle;
175
+ const doorLowX = param.L9 / 2;
176
+ const doorHighX = doorLowX - param.H7 * Math.tan(coneAngle);
177
+ if (doorHighX < param.R9) {
178
+ throw `err177: R9 ${param.R9} too large compare to coneAngle and L9 ${param.L9}`;
179
+ }
180
+ if (param.L9 > param.D1) {
181
+ throw `err180: L9 ${param.L9} too large compare to D1 ${param.D1}`;
182
+ }
183
+ // figCone
184
+ const coneSlopeX = param.E1 * Math.cos(coneAngle);
185
+ const coneSlopeY = param.E1 * Math.sin(coneAngle);
186
+ const coneFC = param.E1 * Math.tan(coneAngle / 2);
187
+ ctrCone = function (orient: number): tContour {
188
+ const rCtr = contour(orient * R1, 0)
189
+ .addSegStrokeA(orient * R1, param.H1)
190
+ .addSegStrokeA(orient * R2, H1H2)
191
+ .addSegStrokeA(orient * (R2 - coneSlopeX), H1H2 - coneSlopeY)
192
+ .addSegStrokeA(orient * (R1 - param.E1), param.H1 - coneFC)
193
+ .addSegStrokeA(orient * (R1 - param.E1), 0)
194
+ .closeSegStroke();
195
+ return rCtr;
196
+ };
197
+ ctrConePlus = function (orient: number): tContour {
198
+ const rCtr = contour(orient * R1, 0)
199
+ .addSegStrokeA(orient * R1, param.H1)
200
+ .addSegStrokeA(orient * R2, H1H2)
201
+ .addSegStrokeA(orient * (R2 - coneSlopeX), H1H2 - coneSlopeY)
202
+ .addSegStrokeA(orient * (R1 - param.E1), param.H1 - coneFC)
203
+ .addSegStrokeA(orient * (R1 - param.E1), param.H1 - param.H3)
204
+ .addSegStrokeA(orient * R3, param.H1 - param.H3)
205
+ .addSegStrokeA(orient * R3, param.H1 - param.H3 - param.E3)
206
+ .addSegStrokeA(orient * (R1 - param.E1), param.H1 - param.H3 - param.E3)
207
+ .addSegStrokeA(orient * (R1 - param.E1), 0)
208
+ .closeSegStroke();
209
+ return rCtr;
210
+ };
211
+ ctrRect = function (
212
+ width: number,
213
+ height: number,
214
+ xpos: number,
215
+ ypos: number,
216
+ angle: number
217
+ ): tContour {
218
+ const xWidth = width * Math.cos(angle);
219
+ const yWidth = width * Math.sin(angle);
220
+ const xHeight = -height * Math.sin(angle);
221
+ const yHeight = height * Math.cos(angle);
222
+ const rCtr = contour(xpos, ypos)
223
+ .addSegStrokeA(xpos + xWidth, ypos + yWidth)
224
+ .addSegStrokeA(xpos + xWidth + xHeight, ypos + yWidth + yHeight)
225
+ .addSegStrokeA(xpos + xHeight, ypos + yHeight)
226
+ .closeSegStroke();
227
+ return rCtr;
228
+ };
229
+ const ctrDoor = contour(doorLowX, param.H1 + param.H6)
230
+ .addCornerRounded(param.R9)
231
+ .addSegStrokeA(doorHighX, param.H1 + param.H6 + param.H7)
232
+ .addCornerRounded(param.R9)
233
+ .addSegStrokeA(-doorHighX, param.H1 + param.H6 + param.H7)
234
+ .addCornerRounded(param.R9)
235
+ .addSegStrokeA(-doorLowX, param.H1 + param.H6)
236
+ .addCornerRounded(param.R9)
237
+ .closeSegStroke();
238
+ figCone.addMain(ctrCone(1));
239
+ figCone.addSecond(ctrConePlus(1));
240
+ figCone.addSecond(ctrConePlus(-1));
241
+ //figCone.addSecond(contourCircle(0, beamH, R4));
242
+ //figCone.addSecond(contourCircle(0, beamH, R4 - param.E4));
243
+ figCone.addSecond(ctrRect(beamL, param.D4, -beamL / 2, beamH - R4, 0)); // beam-ext
244
+ figCone.addSecond(
245
+ ctrRect(beamL, param.D4 - 2 * param.E4, -beamL / 2, beamH - R4 + param.E4, 0)
246
+ ); // beam-int
247
+ for (const posX of handPos) {
248
+ figCone.addSecond(
249
+ ctrRect(param.L4, param.H5 - handLowY - handHighYint, posX, beamH + handLowY, 0)
250
+ );
251
+ }
252
+ figCone.addSecond(ctrRect(wingL2, 2 * R6, wingPosX, wingPosY, wingAngleC)); // wing-right
253
+ figCone.addSecond(ctrRect(wingL2, 2 * wingHR, wingHPosX, wingHPosY, wingAngleC));
254
+ figCone.addSecond(ctrRect(2 * R6, wingL2, -wingPosX, wingPosY, wingAngle)); // wing-left
255
+ figCone.addSecond(ctrRect(2 * wingHR, wingL2, -wingHPosX, wingHPosY, wingAngle));
256
+ figCone.addSecond(ctrDoor);
257
+ // figBeam
258
+ const ctrHand = contour(handLowX, beamH + handLowY)
259
+ .addSegStrokeA(handHighXext, beamH + param.H5 - handHighYext)
260
+ .addSegStrokeA(handHighXint, beamH + param.H5 - handHighYint)
261
+ .addPointA(-handHighXint, beamH + param.H5 - handHighYint)
262
+ .addSegArc(R5, false, false)
263
+ .addSegStrokeA(-handHighXext, beamH + param.H5 - handHighYext)
264
+ .addSegStrokeA(-handLowX, beamH + handLowY)
265
+ .closeSegArc(R4, false, false);
266
+ figBeam.addMain(contourCircle(0, beamH, R4));
267
+ figBeam.addMain(contourCircle(0, beamH, R4 - param.E4));
268
+ figBeam.addSecond(ctrConePlus(1));
269
+ figBeam.addSecond(ctrConePlus(-1));
270
+ figBeam.addSecond(ctrHand);
271
+ figBeam.addSecond(contourCircle(0, beamH + param.H5, R5));
272
+ figBeam.addSecond(ctrRect(2 * R6, wingLy, -R6, param.H1 + param.L8, 0)); // wing
273
+ figBeam.addSecond(ctrRect(2 * wingHR, wingLy, -wingHR, param.H1 + param.L8, 0));
274
+ figBeam.addSecond(ctrDoor);
275
+ // figBeamHollow
276
+ figBeamHollow.addMain(contourCircle(0, beamH, R4 - param.E4));
277
+ figBeamHollow.addSecond(contourCircle(0, beamH, R4));
278
+ figBeamHollow.addSecond(ctrHand);
279
+ // figDisc
280
+ figDisc.addMain(contourCircle(0, 0, R1));
281
+ figDisc.addMain(contourCircle(0, 0, R3));
282
+ const posR = R3 + param.L1;
283
+ const posA = (2 * Math.PI) / param.N1;
284
+ for (let i = 0; i < param.N1; i++) {
285
+ const posX = posR * Math.cos(i * posA);
286
+ const posY = posR * Math.sin(i * posA);
287
+ figDisc.addMain(contourCircle(posX, posY, R7));
288
+ }
289
+ figDisc.addSecond(contourCircle(0, 0, R1 - param.E1));
290
+ figDisc.addSecond(contourCircle(0, 0, R2));
291
+ figDisc.addSecond(ctrRect(param.D4, beamL, -R4, -beamL / 2, 0)); // beam-ext
292
+ figDisc.addSecond(ctrRect(param.D4 - 2 * param.E4, beamL, -R4 + param.E4, -beamL / 2, 0)); // beam-int
293
+ for (const posX of handPos) {
294
+ figDisc.addSecond(ctrRect(2 * handLowX, param.L4, -handLowX, posX, 0));
295
+ figDisc.addSecond(ctrRect(2 * handHighXint, param.L4, -handHighXint, posX, 0));
296
+ figDisc.addSecond(ctrRect(2 * handHighXext, param.L4, -handHighXext, posX, 0));
297
+ }
298
+ figDisc.addSecond(ctrRect(2 * R6, wingLx, -R6, R1 - param.L8 * Math.tan(coneAngle), 0)); // wing-right
299
+ figDisc.addSecond(
300
+ ctrRect(2 * wingHR, wingLx, -wingHR, R1 - param.L8 * Math.tan(coneAngle), 0)
301
+ );
302
+ figDisc.addSecond(
303
+ ctrRect(2 * R6, wingLx, -R6, -R1 + param.L8 * Math.tan(coneAngle) - wingLx, 0)
304
+ ); // wing-left
305
+ figDisc.addSecond(
306
+ ctrRect(2 * wingHR, wingLx, -wingHR, -R1 + param.L8 * Math.tan(coneAngle) - wingLx, 0)
307
+ );
308
+ // figHand
309
+ figHand.addMain(ctrHand);
310
+ figHand.addSecond(contourCircle(0, beamH, R4));
311
+ figHand.addSecond(contourCircle(0, beamH, R4 - param.E4));
312
+ figHand.addSecond(contourCircle(0, beamH + param.H5, R5));
313
+ // figWing
314
+ figWing.addMain(contourCircle(0, 0, R6));
315
+ figWing.addMain(contourCircle(0, 0, wingHR));
316
+ // figWingHollow
317
+ figWingHollow.addSecond(contourCircle(0, 0, R6));
318
+ figWingHollow.addMain(contourCircle(0, 0, wingHR));
319
+ // figDoor
320
+ figDoor.addMain(ctrDoor);
321
+ figDoor.addSecond(ctrConePlus(1));
322
+ figDoor.addSecond(ctrConePlus(-1));
323
+ figDoor.addSecond(ctrRect(beamL, param.D4, -beamL / 2, beamH - R4, 0)); // beam-ext
324
+ figDoor.addSecond(
325
+ ctrRect(beamL, param.D4 - 2 * param.E4, -beamL / 2, beamH - R4 + param.E4, 0)
326
+ ); // beam-int
327
+ for (const posX of handPos) {
328
+ figDoor.addSecond(
329
+ ctrRect(param.L4, param.H5 - handLowY - handHighYint, posX, beamH + handLowY, 0)
330
+ );
331
+ }
332
+ figDoor.addSecond(ctrRect(wingL2, 2 * R6, wingPosX, wingPosY, wingAngleC)); // wing-right
333
+ figDoor.addSecond(ctrRect(wingL2, 2 * wingHR, wingHPosX, wingHPosY, wingAngleC));
334
+ figDoor.addSecond(ctrRect(2 * R6, wingL2, -wingPosX, wingPosY, wingAngle)); // wing-left
335
+ figDoor.addSecond(ctrRect(2 * wingHR, wingL2, -wingHPosX, wingHPosY, wingAngle));
336
+ // final figure list
337
+ rGeome.fig = {
338
+ faceCone: figCone,
339
+ faceBeam: figBeam,
340
+ faceBeamHollow: figBeamHollow,
341
+ faceDisc: figDisc,
342
+ faceHand: figHand,
343
+ faceWing: figWing,
344
+ faceWingHollow: figWingHollow,
345
+ faceDoor: figDoor
346
+ };
347
+ const designName = rGeome.partName;
348
+ const preExtrude = handPos.map((posX, idx) => {
349
+ const rHand: tExtrude = {
350
+ outName: `subpax_${designName}_hand_${idx}`,
351
+ face: `${designName}_faceHand`,
352
+ extrudeMethod: EExtrude.eLinearOrtho,
353
+ length: param.L4,
354
+ rotate: [Math.PI / 2, 0, 0],
355
+ translate: [0, -posX, 0]
356
+ };
357
+ return rHand;
358
+ });
359
+ rGeome.vol = {
360
+ extrudes: [
361
+ {
362
+ outName: `subpax_${designName}_cone`,
363
+ face: `${designName}_faceCone`,
364
+ extrudeMethod: EExtrude.eRotate,
365
+ rotate: [0, 0, 0],
366
+ translate: [0, 0, 0]
367
+ },
368
+ {
369
+ outName: `subpax_${designName}_beam`,
370
+ face: `${designName}_faceBeam`,
371
+ extrudeMethod: EExtrude.eLinearOrtho,
372
+ length: beamL,
373
+ rotate: [Math.PI / 2, 0, 0],
374
+ translate: [0, beamL / 2, 0]
375
+ },
376
+ {
377
+ outName: `subpax_${designName}_beamHollow`,
378
+ face: `${designName}_faceBeamHollow`,
379
+ extrudeMethod: EExtrude.eLinearOrtho,
380
+ length: beamL,
381
+ rotate: [Math.PI / 2, 0, 0],
382
+ translate: [0, beamL / 2, 0]
383
+ },
384
+ {
385
+ outName: `subpax_${designName}_disc`,
386
+ face: `${designName}_faceDisc`,
387
+ extrudeMethod: EExtrude.eLinearOrtho,
388
+ length: param.E3,
389
+ rotate: [0, 0, 0],
390
+ translate: [0, 0, param.H1 - param.H3 - param.E3]
391
+ },
392
+ {
393
+ outName: `subpax_${designName}_wing_right`,
394
+ face: `${designName}_faceWing`,
395
+ extrudeMethod: EExtrude.eLinearOrtho,
396
+ length: wingL2,
397
+ rotate: [-wingAngle, 0, 0],
398
+ translate: [0, wingCPosX, wingCPosY]
399
+ },
400
+ {
401
+ outName: `subpax_${designName}_wing_left`,
402
+ face: `${designName}_faceWing`,
403
+ extrudeMethod: EExtrude.eLinearOrtho,
404
+ length: wingL2,
405
+ rotate: [wingAngle, 0, 0],
406
+ translate: [0, -wingCPosX, wingCPosY]
407
+ },
408
+ {
409
+ outName: `subpax_${designName}_wing_hollow_right`,
410
+ face: `${designName}_faceWingHollow`,
411
+ extrudeMethod: EExtrude.eLinearOrtho,
412
+ length: wingL2,
413
+ rotate: [-wingAngle, 0, 0],
414
+ translate: [0, wingCPosX, wingCPosY]
415
+ },
416
+ {
417
+ outName: `subpax_${designName}_wing_hollow_left`,
418
+ face: `${designName}_faceWingHollow`,
419
+ extrudeMethod: EExtrude.eLinearOrtho,
420
+ length: wingL2,
421
+ rotate: [wingAngle, 0, 0],
422
+ translate: [0, -wingCPosX, wingCPosY]
423
+ },
424
+ {
425
+ outName: `subpax_${designName}_door`,
426
+ face: `${designName}_faceDoor`,
427
+ extrudeMethod: EExtrude.eLinearOrtho,
428
+ length: param.D1,
429
+ rotate: [Math.PI / 2, 0, Math.PI / 2],
430
+ translate: [0, 0, 0]
431
+ },
432
+ ...preExtrude
433
+ ],
434
+ volumes: [
435
+ {
436
+ outName: `ipax_${designName}_plus`,
437
+ boolMethod: EBVolume.eUnion,
438
+ inList: [
439
+ `subpax_${designName}_cone`,
440
+ `subpax_${designName}_beam`,
441
+ `subpax_${designName}_disc`,
442
+ `subpax_${designName}_hand_0`,
443
+ `subpax_${designName}_hand_1`,
444
+ `subpax_${designName}_hand_2`,
445
+ `subpax_${designName}_hand_3`,
446
+ `subpax_${designName}_wing_right`,
447
+ `subpax_${designName}_wing_left`
448
+ ]
449
+ },
450
+ {
451
+ outName: `ipax_${designName}_hollow`,
452
+ boolMethod: EBVolume.eUnion,
453
+ inList: [
454
+ `subpax_${designName}_beamHollow`,
455
+ `subpax_${designName}_wing_hollow_right`,
456
+ `subpax_${designName}_wing_hollow_left`,
457
+ `subpax_${designName}_door`
458
+ ]
459
+ },
460
+ {
461
+ outName: `pax_${designName}`,
462
+ boolMethod: EBVolume.eSubstraction,
463
+ inList: [`ipax_${designName}_plus`, `ipax_${designName}_hollow`]
464
+ }
465
+ ]
466
+ };
467
+ // sub-design
468
+ rGeome.sub = {};
469
+ // finalize
470
+ rGeome.logstr += 'heliostat-rake draw successfully!\n';
471
+ rGeome.calcErr = false;
472
+ } catch (emsg) {
473
+ rGeome.logstr += emsg as string;
474
+ console.log(emsg as string);
475
+ }
476
+ return rGeome;
477
+ }
478
+
479
+ const rakeDef: tPageDef = {
480
+ pTitle: 'Heliostat rake',
481
+ pDescription: 'The rake on top of the pole-rotor of the heliostat',
482
+ pDef: pDef,
483
+ pGeom: pGeom
484
+ };
485
+
486
+ export { rakeDef };