DeepSDFStruct 1.7.2__py3-none-any.whl

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 (165) hide show
  1. DeepSDFStruct/SDF.py +1734 -0
  2. DeepSDFStruct/__init__.py +66 -0
  3. DeepSDFStruct/deep_sdf/__init__.py +69 -0
  4. DeepSDFStruct/deep_sdf/create_screenshots_from_plyfiles.py +65 -0
  5. DeepSDFStruct/deep_sdf/data.py +258 -0
  6. DeepSDFStruct/deep_sdf/metrics/__init__.py +14 -0
  7. DeepSDFStruct/deep_sdf/metrics/mesh_to_analytical.py +24 -0
  8. DeepSDFStruct/deep_sdf/models.py +197 -0
  9. DeepSDFStruct/deep_sdf/networks/__init__.py +8 -0
  10. DeepSDFStruct/deep_sdf/networks/analytic_round_cross.py +105 -0
  11. DeepSDFStruct/deep_sdf/networks/deep_sdf_decoder.py +155 -0
  12. DeepSDFStruct/deep_sdf/networks/hierarchical_deep_sdf_decoder.py +139 -0
  13. DeepSDFStruct/deep_sdf/networks/hierarchical_positional_sdf_decoder.py +190 -0
  14. DeepSDFStruct/deep_sdf/networks/resnet_positional_sdf_decoder.py +108 -0
  15. DeepSDFStruct/deep_sdf/nn_utils.py +70 -0
  16. DeepSDFStruct/deep_sdf/plotting.py +143 -0
  17. DeepSDFStruct/deep_sdf/reconstruction.py +165 -0
  18. DeepSDFStruct/deep_sdf/training.py +840 -0
  19. DeepSDFStruct/deep_sdf/workspace.py +363 -0
  20. DeepSDFStruct/design_of_experiments.py +235 -0
  21. DeepSDFStruct/flexicubes/__init__.py +15 -0
  22. DeepSDFStruct/flexicubes/flexicubes.py +1005 -0
  23. DeepSDFStruct/flexicubes/tables.py +2338 -0
  24. DeepSDFStruct/flexisquares/__init__.py +15 -0
  25. DeepSDFStruct/flexisquares/flexisquares.py +967 -0
  26. DeepSDFStruct/flexisquares/tables.py +63 -0
  27. DeepSDFStruct/lattice_structure.py +254 -0
  28. DeepSDFStruct/local_shapes.py +226 -0
  29. DeepSDFStruct/mesh.py +1184 -0
  30. DeepSDFStruct/optimization.py +357 -0
  31. DeepSDFStruct/parametrization.py +215 -0
  32. DeepSDFStruct/pretrained_models.py +128 -0
  33. DeepSDFStruct/sampling.py +670 -0
  34. DeepSDFStruct/sdf_operations.py +990 -0
  35. DeepSDFStruct/sdf_primitives.py +1416 -0
  36. DeepSDFStruct/splinepy_unitcells/__init__.py +35 -0
  37. DeepSDFStruct/splinepy_unitcells/chi_3D.py +1617 -0
  38. DeepSDFStruct/splinepy_unitcells/cross_lattice.py +165 -0
  39. DeepSDFStruct/splinepy_unitcells/double_lattice_extruded.py +298 -0
  40. DeepSDFStruct/splinepy_unitcells/snappy_3d.py +544 -0
  41. DeepSDFStruct/torch_spline.py +446 -0
  42. DeepSDFStruct/trained_models/analytic_round_cross/LatentCodes/latest.pth +0 -0
  43. DeepSDFStruct/trained_models/analytic_round_cross/ModelParameters/latest.pth +0 -0
  44. DeepSDFStruct/trained_models/analytic_round_cross/OptimizerParameters/latest.pth +0 -0
  45. DeepSDFStruct/trained_models/analytic_round_cross/specs.json +45 -0
  46. DeepSDFStruct/trained_models/chi_and_cross/LatentCodes/latest.pth +0 -0
  47. DeepSDFStruct/trained_models/chi_and_cross/Logs.pth +0 -0
  48. DeepSDFStruct/trained_models/chi_and_cross/ModelParameters/latest.pth +0 -0
  49. DeepSDFStruct/trained_models/chi_and_cross/OptimizerParameters/latest.pth +0 -0
  50. DeepSDFStruct/trained_models/chi_and_cross/specs.json +76 -0
  51. DeepSDFStruct/trained_models/primitives/LatentCodes/latest.pth +0 -0
  52. DeepSDFStruct/trained_models/primitives/ModelParameters/latest.pth +0 -0
  53. DeepSDFStruct/trained_models/primitives/OptimizerParameters/latest.pth +0 -0
  54. DeepSDFStruct/trained_models/primitives/specs.json +46 -0
  55. DeepSDFStruct/trained_models/primitives_2d/LatentCodes/latest.pth +0 -0
  56. DeepSDFStruct/trained_models/primitives_2d/ModelParameters/latest.pth +0 -0
  57. DeepSDFStruct/trained_models/primitives_2d/OptimizerParameters/latest.pth +0 -0
  58. DeepSDFStruct/trained_models/primitives_2d/specs.json +46 -0
  59. DeepSDFStruct/trained_models/round_cross/LatentCodes/latest.pth +0 -0
  60. DeepSDFStruct/trained_models/round_cross/Logs.pth +0 -0
  61. DeepSDFStruct/trained_models/round_cross/ModelParameters/latest.pth +0 -0
  62. DeepSDFStruct/trained_models/round_cross/OptimizerParameters/latest.pth +0 -0
  63. DeepSDFStruct/trained_models/round_cross/specs.json +45 -0
  64. DeepSDFStruct/trained_models/test_experiment/LatentCodes/latent_code_data_map.json +106 -0
  65. DeepSDFStruct/trained_models/test_experiment/specs.json +45 -0
  66. DeepSDFStruct/trained_models/test_experiment/training_summary.json +10 -0
  67. DeepSDFStruct/trained_models/test_experiment_hierarchical/LatentCodes/latent_code_data_map.json +106 -0
  68. DeepSDFStruct/trained_models/test_experiment_hierarchical/specs.json +45 -0
  69. DeepSDFStruct/trained_models/test_experiment_hierarchical/training_summary.json +10 -0
  70. DeepSDFStruct/trained_models/test_experiment_homogenization/LatentCodes/latent_code_data_map.json +5006 -0
  71. DeepSDFStruct/trained_models/test_experiment_homogenization/LatentCodes/latest.pth +0 -0
  72. DeepSDFStruct/trained_models/test_experiment_homogenization/Logs.png +0 -0
  73. DeepSDFStruct/trained_models/test_experiment_homogenization/ModelParameters/latest.pth +0 -0
  74. DeepSDFStruct/trained_models/test_experiment_homogenization/OptimizerParameters/latest.pth +0 -0
  75. DeepSDFStruct/trained_models/test_experiment_homogenization/specs.json +83 -0
  76. DeepSDFStruct/trained_models/test_experiment_homogenization/training_summary.json +10 -0
  77. DeepSDFStruct/utils.py +96 -0
  78. DeepSDFStruct/visualization/latent_viewer.py +211 -0
  79. DeepSDFStruct/visualization/latent_viewer_cli.py +8 -0
  80. benchmarks/generate_sdf_showcase.py +622 -0
  81. benchmarks/sdf_from_mesh_benchmark.py +52 -0
  82. benchmarks/sdf_from_mesh_comparison.md +33 -0
  83. benchmarks/sdf_showcase/operations/boolean/difference_sphere_box.png +0 -0
  84. benchmarks/sdf_showcase/operations/boolean/union_sphere_box.png +0 -0
  85. benchmarks/sdf_showcase/operations/transformations/circular_array_sphere.png +0 -0
  86. benchmarks/sdf_showcase/operations/transformations/dilate_sphere.png +0 -0
  87. benchmarks/sdf_showcase/operations/transformations/mirror_sphere.png +0 -0
  88. benchmarks/sdf_showcase/operations/transformations/repeat_sphere.png +0 -0
  89. benchmarks/sdf_showcase/operations/transformations/revolve_circle.png +0 -0
  90. benchmarks/sdf_showcase/operations/transformations/shell_sphere.png +0 -0
  91. benchmarks/sdf_showcase/operations/transformations/twist_torus.png +0 -0
  92. benchmarks/sdf_showcase/primitives/2D/circle.png +0 -0
  93. benchmarks/sdf_showcase/primitives/2D/equilateral_triangle.png +0 -0
  94. benchmarks/sdf_showcase/primitives/2D/hexagon.png +0 -0
  95. benchmarks/sdf_showcase/primitives/2D/polygon_pentagon.png +0 -0
  96. benchmarks/sdf_showcase/primitives/2D/rectangle.png +0 -0
  97. benchmarks/sdf_showcase/primitives/2D/rounded_rectangle.png +0 -0
  98. benchmarks/sdf_showcase/primitives/3D/box.png +0 -0
  99. benchmarks/sdf_showcase/primitives/3D/capped_cone.png +0 -0
  100. benchmarks/sdf_showcase/primitives/3D/capped_cylinder.png +0 -0
  101. benchmarks/sdf_showcase/primitives/3D/capsule.png +0 -0
  102. benchmarks/sdf_showcase/primitives/3D/cone.png +0 -0
  103. benchmarks/sdf_showcase/primitives/3D/corner_spheres.png +0 -0
  104. benchmarks/sdf_showcase/primitives/3D/cross_ms.png +0 -0
  105. benchmarks/sdf_showcase/primitives/3D/cylinder.png +0 -0
  106. benchmarks/sdf_showcase/primitives/3D/dodecahedron.png +0 -0
  107. benchmarks/sdf_showcase/primitives/3D/ellipsoid.png +0 -0
  108. benchmarks/sdf_showcase/primitives/3D/icosahedron.png +0 -0
  109. benchmarks/sdf_showcase/primitives/3D/octahedron.png +0 -0
  110. benchmarks/sdf_showcase/primitives/3D/pyramid.png +0 -0
  111. benchmarks/sdf_showcase/primitives/3D/rounded_box.png +0 -0
  112. benchmarks/sdf_showcase/primitives/3D/rounded_cone.png +0 -0
  113. benchmarks/sdf_showcase/primitives/3D/rounded_cylinder.png +0 -0
  114. benchmarks/sdf_showcase/primitives/3D/sphere.png +0 -0
  115. benchmarks/sdf_showcase/primitives/3D/tetrahedron.png +0 -0
  116. benchmarks/sdf_showcase/primitives/3D/torus.png +0 -0
  117. benchmarks/sdf_showcase/primitives/3D/wireframe_box.png +0 -0
  118. deepsdfstruct-1.7.2.dist-info/METADATA +44 -0
  119. deepsdfstruct-1.7.2.dist-info/RECORD +165 -0
  120. deepsdfstruct-1.7.2.dist-info/WHEEL +5 -0
  121. deepsdfstruct-1.7.2.dist-info/licenses/LICENSE +208 -0
  122. deepsdfstruct-1.7.2.dist-info/licenses/NOTICE +67 -0
  123. deepsdfstruct-1.7.2.dist-info/scm_file_list.json +178 -0
  124. deepsdfstruct-1.7.2.dist-info/scm_version.json +8 -0
  125. deepsdfstruct-1.7.2.dist-info/top_level.txt +4 -0
  126. docs/Makefile +20 -0
  127. docs/api_reference.rst +6 -0
  128. docs/conf.py +60 -0
  129. docs/index.rst +136 -0
  130. docs/make.bat +35 -0
  131. docs/qr_code_github.png +0 -0
  132. docs/qr_code_paper.png +0 -0
  133. docs/readme_images/example_output_01.png +0 -0
  134. docs/readme_images/example_output_02.png +0 -0
  135. docs/readme_images/example_output_03.png +0 -0
  136. docs/readme_images/example_output_04.png +0 -0
  137. tests/data/chairs/1005.obj +282 -0
  138. tests/data/chairs/1024.obj +222 -0
  139. tests/data/chairs/README.md +1 -0
  140. tests/data/circular_balls_test_case.stl +0 -0
  141. tests/data/cone.stl +1794 -0
  142. tests/data/example_disconnectd_mesh.inp +1784 -0
  143. tests/data/example_line_mesh.vtk +0 -0
  144. tests/data/stanford_bunny.stl +0 -0
  145. tests/data/sweep_test_case.stl +0 -0
  146. tests/test_DOE.py +49 -0
  147. tests/test_elongate_sdf.py +195 -0
  148. tests/test_flexisquares.py +187 -0
  149. tests/test_generate_dataset.py +76 -0
  150. tests/test_lattice_evaluation.py +137 -0
  151. tests/test_mesh_export.py +137 -0
  152. tests/test_mesh_functions.py +49 -0
  153. tests/test_networks.py +71 -0
  154. tests/test_pretrained_models.py +40 -0
  155. tests/test_reconstruction.py +101 -0
  156. tests/test_sdf_from_mesh.py +52 -0
  157. tests/test_sdf_functions.py +117 -0
  158. tests/test_sdf_primitives.py +668 -0
  159. tests/test_sdf_trimesh_comparison.py +482 -0
  160. tests/test_splinepy_unitcells.py +64 -0
  161. tests/test_structural_optimization.py +178 -0
  162. tests/test_torch_spline.py +216 -0
  163. tests/test_train_model.py +110 -0
  164. tests/test_training_data_ids.py +41 -0
  165. tests/tmp_outputs/temp_file.txt +0 -0
@@ -0,0 +1,1617 @@
1
+ """
2
+ Chi-3D Lattice Unit Cell
3
+ ========================
4
+
5
+ This module implements a 3D chi-shaped lattice unit cell using splinepy.
6
+ The chi structure is characterized by intersecting diagonal struts forming
7
+ an X or chi (χ) pattern, commonly used in mechanical metamaterials.
8
+
9
+ The unit cell provides parametric control over:
10
+ - Strut thickness
11
+ - Arm position
12
+ - Rounding radius
13
+ - Angular configuration
14
+ """
15
+
16
+ import splinepy
17
+ import numpy as _np
18
+ from splinepy.microstructure.tiles.tile_base import TileBase as _TileBase
19
+
20
+
21
+ class Chi3D(_TileBase):
22
+
23
+ _dim = 2 # Dimension der Einheitszelle
24
+ _para_dim = 2 # Dimension der Spline Struktur?
25
+ _evaluation_points = _np.array(
26
+ [[0.5, 0], [0, 0.5], [0.5, 0.5], [1.0, 0.5], [0.5, 1]]
27
+ )
28
+ _n_info_per_eval_point = 5
29
+
30
+ def create_tile(
31
+ self, parameters=None, make3D=True, parameters_sensitivitW=None, **kwargs
32
+ ):
33
+ """
34
+ [Winkel, Dicke, Armposition, Armpositionsverschiebung, Rundungradius]
35
+ """
36
+ Edge = 0.5
37
+ if parameters is None:
38
+ self._logd("Tile request is not parametrized, setting default Pi/8")
39
+ # Parameter wie folgt [Winkel, Dicke, Armposition, Armpositionsverschiebung, Rundungradius]
40
+ parameters = _np.array(
41
+ [
42
+ [_np.pi / 8, Edge * 0.1, Edge / 1.4, Edge / 3, Edge / 8],
43
+ [_np.pi / 8, Edge * 0.1, Edge / 1.4, Edge / 3, Edge / 8],
44
+ [_np.pi / 8, Edge * 0.1, Edge / 1.4, Edge / 3, Edge / 8],
45
+ [_np.pi / 8, Edge * 0.1, Edge / 1.4, Edge / 3, Edge / 8],
46
+ [_np.pi / 8, Edge * 0.1, Edge / 1.4, Edge / 3, Edge / 8],
47
+ ]
48
+ )
49
+ else:
50
+ if not (
51
+ _np.all(parameters >= -_np.pi * 0.5)
52
+ and _np.all(parameters <= _np.pi * 0.5)
53
+ ):
54
+ raise ValueError("The parameter must be in -Pi/2 and Pi/2")
55
+ pass
56
+ self.check_params(parameters)
57
+
58
+ # radius = Edge/8
59
+ # arm_pos = Edge/1.4
60
+ # delta_d = Edge/3
61
+
62
+ arm_pos = parameters[2, 2]
63
+ delta_d = parameters[2, 3]
64
+ radius = parameters[2, 4]
65
+
66
+ beta = parameters[2, 0]
67
+
68
+ t = parameters[2, 1]
69
+ # t = 0.15
70
+ tO = parameters[3, 1]
71
+ tN = parameters[4, 1]
72
+ tW = parameters[1, 1]
73
+ tS = parameters[0, 1]
74
+
75
+ lges1 = arm_pos / _np.cos(beta) - t / 2 + Edge + arm_pos * _np.tan(beta)
76
+
77
+ delta_tS_knick = (
78
+ (tS - t) * ((arm_pos / _np.cos(beta) - t / 2) / lges1) + t
79
+ ) / t
80
+ delta_tS_gerade = (
81
+ (tS - t) * ((arm_pos / _np.cos(beta) - t / 2) * 2 / lges1) + t
82
+ ) / t
83
+ delta_tW_knick = (
84
+ (tW - t) * ((arm_pos / _np.cos(beta) - t / 2) / lges1) + t
85
+ ) / t
86
+ delta_tW_gerade = (
87
+ (tW - t) * ((arm_pos / _np.cos(beta) - t / 2) * 2 / lges1) + t
88
+ ) / t
89
+
90
+ delta_tO_knick = (
91
+ (tO - t) * ((arm_pos / _np.cos(beta) - t / 2) / lges1) + t
92
+ ) / t
93
+ delta_tO_gerade = (
94
+ (tO - t) * ((arm_pos / _np.cos(beta) - t / 2) * 2 / lges1) + t
95
+ ) / t
96
+ delta_tN_knick = (
97
+ (tN - t) * ((arm_pos / _np.cos(beta) - t / 2) / lges1) + t
98
+ ) / t
99
+ delta_tN_gerade = (
100
+ (tN - t) * ((arm_pos / _np.cos(beta) - t / 2) * 2 / lges1) + t
101
+ ) / t
102
+
103
+ spline_list = []
104
+
105
+ # Chi links unten
106
+ m1 = 1
107
+ m2 = 1
108
+ translationx = Edge
109
+ translationy = Edge
110
+
111
+ # Spline 1.1 Rundung des Armes innen
112
+ spline_list.append(
113
+ splinepy.Bezier(
114
+ degrees=[2, 1],
115
+ control_points=_np.array(
116
+ [
117
+ [
118
+ -t / _np.sqrt(2) * _np.cos(_np.pi / 4 + beta)
119
+ - (radius * _np.cos(beta)),
120
+ t / _np.sqrt(2) * _np.sin(_np.pi / 4 + beta)
121
+ + (radius * _np.sin(beta)),
122
+ ],
123
+ [
124
+ -arm_pos - delta_tS_knick * t / 2,
125
+ (arm_pos + t / 2) * _np.tan(beta)
126
+ + delta_tS_knick * t / (2 * _np.sin(_np.pi / 2 - beta)),
127
+ ],
128
+ [
129
+ -arm_pos - delta_tS_gerade * t / 2,
130
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
131
+ + radius,
132
+ ],
133
+ [
134
+ -t / _np.sqrt(2) * _np.cos(-_np.pi / 4 + beta)
135
+ - (radius * _np.cos(beta)),
136
+ t / _np.sqrt(2) * _np.sin(-_np.pi / 4 + beta)
137
+ + (radius * _np.sin(beta)),
138
+ ],
139
+ [
140
+ -arm_pos + delta_tS_knick * t / 2,
141
+ (arm_pos - t / 2) * _np.tan(beta)
142
+ - delta_tS_knick * t / (2 * _np.sin(_np.pi / 2 - beta)),
143
+ ],
144
+ [
145
+ -arm_pos + delta_tS_gerade * t / 2,
146
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
147
+ + radius,
148
+ ],
149
+ ]
150
+ )
151
+ * _np.array(
152
+ [[m1, m2], [m1, m2], [m1, m2], [m1, m2], [m1, m2], [m1, m2]]
153
+ )
154
+ + _np.array(
155
+ [
156
+ [translationx, translationy],
157
+ [translationx, translationy],
158
+ [translationx, translationy],
159
+ [translationx, translationy],
160
+ [translationx, translationy],
161
+ [translationx, translationy],
162
+ ]
163
+ ),
164
+ )
165
+ )
166
+
167
+ # Spline 1.2 Rundung des Armes außen
168
+ spline_list.append(
169
+ splinepy.Bezier(
170
+ degrees=[3, 1],
171
+ control_points=_np.array(
172
+ [
173
+ [
174
+ -arm_pos - delta_tS_gerade * t / 2,
175
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
176
+ + radius,
177
+ ],
178
+ [
179
+ -arm_pos - delta_tS_gerade * t / 6 * 2 - tS / 6,
180
+ -(Edge / 3)
181
+ + 2
182
+ * (
183
+ (
184
+ arm_pos * _np.tan(beta)
185
+ - arm_pos / _np.cos(beta)
186
+ + t / 2
187
+ )
188
+ + radius
189
+ )
190
+ / 3
191
+ - (
192
+ 0.5
193
+ * tS
194
+ * (
195
+ -1
196
+ + 1
197
+ / (
198
+ _np.cos(
199
+ _np.arctan(
200
+ (3 * delta_d)
201
+ / (
202
+ Edge
203
+ + (
204
+ arm_pos * _np.tan(beta)
205
+ - arm_pos / _np.cos(beta)
206
+ + t / 2
207
+ )
208
+ + radius
209
+ )
210
+ )
211
+ )
212
+ )
213
+ )
214
+ )
215
+ / (
216
+ (3 * delta_d)
217
+ / (
218
+ Edge
219
+ + (
220
+ arm_pos * _np.tan(beta)
221
+ - arm_pos / _np.cos(beta)
222
+ + t / 2
223
+ )
224
+ + radius
225
+ )
226
+ ),
227
+ ],
228
+ [
229
+ -arm_pos - delta_tS_gerade * t / 6 - tS / 6 * 2 + delta_d,
230
+ -(2 * Edge / 3)
231
+ + (
232
+ (
233
+ arm_pos * _np.tan(beta)
234
+ - arm_pos / _np.cos(beta)
235
+ + t / 2
236
+ )
237
+ + radius
238
+ )
239
+ / 3
240
+ - (
241
+ 0.5
242
+ * tS
243
+ * (
244
+ -1
245
+ + 1
246
+ / (
247
+ _np.cos(
248
+ _np.arctan(
249
+ (3 * delta_d)
250
+ / (
251
+ Edge
252
+ + (
253
+ arm_pos * _np.tan(beta)
254
+ - arm_pos / _np.cos(beta)
255
+ + t / 2
256
+ )
257
+ + radius
258
+ )
259
+ )
260
+ )
261
+ )
262
+ )
263
+ )
264
+ / (
265
+ (3 * delta_d)
266
+ / (
267
+ Edge
268
+ + (
269
+ arm_pos * _np.tan(beta)
270
+ - arm_pos / _np.cos(beta)
271
+ + t / 2
272
+ )
273
+ + radius
274
+ )
275
+ ),
276
+ ],
277
+ [-arm_pos - tS / 2 + delta_d, -Edge],
278
+ [
279
+ -arm_pos + delta_tS_gerade * t / 2,
280
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
281
+ + radius,
282
+ ],
283
+ [
284
+ -arm_pos + delta_tS_gerade * t / 6 * 2 + tS / 6,
285
+ -(Edge / 3)
286
+ + 2
287
+ * (
288
+ (
289
+ arm_pos * _np.tan(beta)
290
+ - arm_pos / _np.cos(beta)
291
+ + t / 2
292
+ )
293
+ + radius
294
+ )
295
+ / 3
296
+ + (
297
+ 0.5
298
+ * tS
299
+ * (
300
+ -1
301
+ + 1
302
+ / (
303
+ _np.cos(
304
+ _np.arctan(
305
+ (3 * delta_d)
306
+ / (
307
+ Edge
308
+ + (
309
+ arm_pos * _np.tan(beta)
310
+ - arm_pos / _np.cos(beta)
311
+ + t / 2
312
+ )
313
+ + radius
314
+ )
315
+ )
316
+ )
317
+ )
318
+ )
319
+ )
320
+ / (
321
+ (3 * delta_d)
322
+ / (
323
+ Edge
324
+ + (
325
+ arm_pos * _np.tan(beta)
326
+ - arm_pos / _np.cos(beta)
327
+ + t / 2
328
+ )
329
+ + radius
330
+ )
331
+ ),
332
+ ],
333
+ [
334
+ -arm_pos + delta_tS_gerade * t / 6 + tS / 6 * 2 + delta_d,
335
+ -(2 * Edge / 3)
336
+ + (
337
+ (
338
+ arm_pos * _np.tan(beta)
339
+ - arm_pos / _np.cos(beta)
340
+ + t / 2
341
+ )
342
+ + radius
343
+ )
344
+ / 3
345
+ + (
346
+ 0.5
347
+ * tS
348
+ * (
349
+ -1
350
+ + 1
351
+ / (
352
+ _np.cos(
353
+ _np.arctan(
354
+ (3 * delta_d)
355
+ / (
356
+ Edge
357
+ + (
358
+ arm_pos * _np.tan(beta)
359
+ - arm_pos / _np.cos(beta)
360
+ + t / 2
361
+ )
362
+ + radius
363
+ )
364
+ )
365
+ )
366
+ )
367
+ )
368
+ )
369
+ / (
370
+ (3 * delta_d)
371
+ / (
372
+ Edge
373
+ + (
374
+ arm_pos * _np.tan(beta)
375
+ - arm_pos / _np.cos(beta)
376
+ + t / 2
377
+ )
378
+ + radius
379
+ )
380
+ ),
381
+ ],
382
+ [-arm_pos + tS / 2 + delta_d, -Edge],
383
+ ]
384
+ )
385
+ * _np.array(
386
+ [
387
+ [m1, m2],
388
+ [m1, m2],
389
+ [m1, m2],
390
+ [m1, m2],
391
+ [m1, m2],
392
+ [m1, m2],
393
+ [m1, m2],
394
+ [m1, m2],
395
+ ]
396
+ )
397
+ + _np.array(
398
+ [
399
+ [translationx, translationy],
400
+ [translationx, translationy],
401
+ [translationx, translationy],
402
+ [translationx, translationy],
403
+ [translationx, translationy],
404
+ [translationx, translationy],
405
+ [translationx, translationy],
406
+ [translationx, translationy],
407
+ ]
408
+ ),
409
+ )
410
+ )
411
+
412
+ # Spline 1.3 innerer Radius
413
+ spline_list.append(
414
+ splinepy.Bezier(
415
+ degrees=[2, 1],
416
+ control_points=_np.array(
417
+ [
418
+ [
419
+ -(t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
420
+ * _np.cos(_np.pi / 4 + beta),
421
+ (t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
422
+ * _np.sin(_np.pi / 4 + beta),
423
+ ],
424
+ [
425
+ -t / _np.sqrt(2) * _np.cos(_np.pi / 4 + beta)
426
+ - radius * (2 - _np.sqrt(2)) * _np.cos(beta),
427
+ t / _np.sqrt(2) * _np.sin(_np.pi / 4 + beta)
428
+ + radius * (2 - _np.sqrt(2)) * _np.sin(beta),
429
+ ],
430
+ [
431
+ -t / _np.sqrt(2) * _np.cos(_np.pi / 4 + beta)
432
+ - (radius * _np.cos(beta)),
433
+ t / _np.sqrt(2) * _np.sin(_np.pi / 4 + beta)
434
+ + (radius * _np.sin(beta)),
435
+ ],
436
+ [
437
+ -(t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
438
+ * _np.cos(-_np.pi / 4 + beta),
439
+ (t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
440
+ * _np.sin(-_np.pi / 4 + beta),
441
+ ],
442
+ [
443
+ -t / _np.sqrt(2) * _np.cos(-_np.pi / 4 + beta)
444
+ - radius * (2 - _np.sqrt(2)) * _np.cos(beta),
445
+ t / _np.sqrt(2) * _np.sin(-_np.pi / 4 + beta)
446
+ + radius * (2 - _np.sqrt(2)) * _np.sin(beta),
447
+ ],
448
+ [
449
+ -t / _np.sqrt(2) * _np.cos(-_np.pi / 4 + beta)
450
+ - (radius * _np.cos(beta)),
451
+ t / _np.sqrt(2) * _np.sin(-_np.pi / 4 + beta)
452
+ + (radius * _np.sin(beta)),
453
+ ],
454
+ ]
455
+ )
456
+ * _np.array(
457
+ [[m1, m2], [m1, m2], [m1, m2], [m1, m2], [m1, m2], [m1, m2]]
458
+ )
459
+ + _np.array(
460
+ [
461
+ [translationx, translationy],
462
+ [translationx, translationy],
463
+ [translationx, translationy],
464
+ [translationx, translationy],
465
+ [translationx, translationy],
466
+ [translationx, translationy],
467
+ ]
468
+ ),
469
+ )
470
+ )
471
+
472
+ # Spline 2.1
473
+ spline_list.append(
474
+ splinepy.Bezier(
475
+ degrees=[2, 1],
476
+ control_points=_np.array(
477
+ [
478
+ [
479
+ t / _np.sqrt(2) * _np.sin(_np.pi / 4 + beta)
480
+ + (radius * _np.sin(beta)),
481
+ -t / _np.sqrt(2) * _np.cos(_np.pi / 4 + beta)
482
+ - (radius * _np.cos(beta)),
483
+ ],
484
+ [
485
+ (arm_pos + t / 2) * _np.tan(beta)
486
+ + delta_tO_gerade * t / (2 * _np.sin(_np.pi / 2 - beta)),
487
+ -arm_pos - delta_tO_gerade * t / 2,
488
+ ],
489
+ [
490
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
491
+ + radius,
492
+ -arm_pos - delta_tO_gerade * t / 2,
493
+ ],
494
+ [
495
+ t / _np.sqrt(2) * _np.sin(-_np.pi / 4 + beta)
496
+ + (radius * _np.sin(beta)),
497
+ -t / _np.sqrt(2) * _np.cos(-_np.pi / 4 + beta)
498
+ - (radius * _np.cos(beta)),
499
+ ],
500
+ [
501
+ (arm_pos - t / 2) * _np.tan(beta)
502
+ - delta_tO_gerade * t / (2 * _np.sin(_np.pi / 2 - beta)),
503
+ -arm_pos + delta_tO_knick * t / 2,
504
+ ],
505
+ [
506
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
507
+ + radius,
508
+ -arm_pos + delta_tO_gerade * t / 2,
509
+ ],
510
+ ]
511
+ )
512
+ * _np.array(
513
+ [[-m1, m2], [-m1, m2], [-m1, m2], [-m1, m2], [-m1, m2], [-m1, m2]]
514
+ )
515
+ + _np.array(
516
+ [
517
+ [translationx, translationy],
518
+ [translationx, translationy],
519
+ [translationx, translationy],
520
+ [translationx, translationy],
521
+ [translationx, translationy],
522
+ [translationx, translationy],
523
+ ]
524
+ ),
525
+ )
526
+ )
527
+
528
+ # Spline 2.2 Rundung des Armes außen
529
+ spline_list.append(
530
+ splinepy.Bezier(
531
+ degrees=[3, 1],
532
+ control_points=_np.array(
533
+ [
534
+ [
535
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
536
+ + radius,
537
+ -arm_pos - delta_tO_gerade * t / 2,
538
+ ],
539
+ [
540
+ -(Edge / 3)
541
+ + 2
542
+ * (
543
+ (
544
+ arm_pos * _np.tan(beta)
545
+ - arm_pos / _np.cos(beta)
546
+ + t / 2
547
+ )
548
+ + radius
549
+ )
550
+ / 3
551
+ - (
552
+ 0.5
553
+ * tO
554
+ * (
555
+ -1
556
+ + 1
557
+ / (
558
+ _np.cos(
559
+ _np.arctan(
560
+ (3 * delta_d)
561
+ / (
562
+ Edge
563
+ + (
564
+ arm_pos * _np.tan(beta)
565
+ - arm_pos / _np.cos(beta)
566
+ + t / 2
567
+ )
568
+ + radius
569
+ )
570
+ )
571
+ )
572
+ )
573
+ )
574
+ )
575
+ / (
576
+ (3 * delta_d)
577
+ / (
578
+ Edge
579
+ + (
580
+ arm_pos * _np.tan(beta)
581
+ - arm_pos / _np.cos(beta)
582
+ + t / 2
583
+ )
584
+ + radius
585
+ )
586
+ ),
587
+ -arm_pos - delta_tO_gerade * t / 6 * 2 - tO / 6,
588
+ ],
589
+ [
590
+ -(2 * Edge / 3)
591
+ + (
592
+ (
593
+ arm_pos * _np.tan(beta)
594
+ - arm_pos / _np.cos(beta)
595
+ + t / 2
596
+ )
597
+ + radius
598
+ )
599
+ / 3
600
+ - (
601
+ 0.5
602
+ * tO
603
+ * (
604
+ -1
605
+ + 1
606
+ / (
607
+ _np.cos(
608
+ _np.arctan(
609
+ (3 * delta_d)
610
+ / (
611
+ Edge
612
+ + (
613
+ arm_pos * _np.tan(beta)
614
+ - arm_pos / _np.cos(beta)
615
+ + t / 2
616
+ )
617
+ + radius
618
+ )
619
+ )
620
+ )
621
+ )
622
+ )
623
+ )
624
+ / (
625
+ (3 * delta_d)
626
+ / (
627
+ Edge
628
+ + (
629
+ arm_pos * _np.tan(beta)
630
+ - arm_pos / _np.cos(beta)
631
+ + t / 2
632
+ )
633
+ + radius
634
+ )
635
+ ),
636
+ -arm_pos - delta_tO_gerade * t / 6 - tO / 6 * 2 + delta_d,
637
+ ],
638
+ [-Edge, -arm_pos - tO / 2 + delta_d],
639
+ [
640
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
641
+ + radius,
642
+ -arm_pos + delta_tO_gerade * t / 2,
643
+ ],
644
+ [
645
+ -(Edge / 3)
646
+ + 2
647
+ * (
648
+ (
649
+ arm_pos * _np.tan(beta)
650
+ - arm_pos / _np.cos(beta)
651
+ + t / 2
652
+ )
653
+ + radius
654
+ )
655
+ / 3
656
+ + (
657
+ 0.5
658
+ * tO
659
+ * (
660
+ -1
661
+ + 1
662
+ / (
663
+ _np.cos(
664
+ _np.arctan(
665
+ (3 * delta_d)
666
+ / (
667
+ Edge
668
+ + (
669
+ arm_pos * _np.tan(beta)
670
+ - arm_pos / _np.cos(beta)
671
+ + t / 2
672
+ )
673
+ + radius
674
+ )
675
+ )
676
+ )
677
+ )
678
+ )
679
+ )
680
+ / (
681
+ (3 * delta_d)
682
+ / (
683
+ Edge
684
+ + (
685
+ arm_pos * _np.tan(beta)
686
+ - arm_pos / _np.cos(beta)
687
+ + t / 2
688
+ )
689
+ + radius
690
+ )
691
+ ),
692
+ -arm_pos + delta_tO_gerade * t / 6 * 2 + tO / 6,
693
+ ],
694
+ [
695
+ -(2 * Edge / 3)
696
+ + (
697
+ (
698
+ arm_pos * _np.tan(beta)
699
+ - arm_pos / _np.cos(beta)
700
+ + t / 2
701
+ )
702
+ + radius
703
+ )
704
+ / 3
705
+ + (
706
+ 0.5
707
+ * tO
708
+ * (
709
+ -1
710
+ + 1
711
+ / (
712
+ _np.cos(
713
+ _np.arctan(
714
+ (3 * delta_d)
715
+ / (
716
+ Edge
717
+ + (
718
+ arm_pos * _np.tan(beta)
719
+ - arm_pos / _np.cos(beta)
720
+ + t / 2
721
+ )
722
+ + radius
723
+ )
724
+ )
725
+ )
726
+ )
727
+ )
728
+ )
729
+ / (
730
+ (3 * delta_d)
731
+ / (
732
+ Edge
733
+ + (
734
+ arm_pos * _np.tan(beta)
735
+ - arm_pos / _np.cos(beta)
736
+ + t / 2
737
+ )
738
+ + radius
739
+ )
740
+ ),
741
+ -arm_pos + delta_tO_gerade * t / 6 + tO / 6 * 2 + delta_d,
742
+ ],
743
+ [-Edge, -arm_pos + tO / 2 + delta_d],
744
+ ]
745
+ )
746
+ * _np.array(
747
+ [
748
+ [-m1, m2],
749
+ [-m1, m2],
750
+ [-m1, m2],
751
+ [-m1, m2],
752
+ [-m1, m2],
753
+ [-m1, m2],
754
+ [-m1, m2],
755
+ [-m1, m2],
756
+ ]
757
+ )
758
+ + _np.array(
759
+ [
760
+ [translationx, translationy],
761
+ [translationx, translationy],
762
+ [translationx, translationy],
763
+ [translationx, translationy],
764
+ [translationx, translationy],
765
+ [translationx, translationy],
766
+ [translationx, translationy],
767
+ [translationx, translationy],
768
+ ]
769
+ ),
770
+ )
771
+ )
772
+
773
+ # Spline 2.3
774
+ spline_list.append(
775
+ splinepy.Bezier(
776
+ degrees=[2, 1],
777
+ control_points=_np.array(
778
+ [
779
+ [
780
+ (t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
781
+ * _np.sin(_np.pi / 4 + beta),
782
+ -(t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
783
+ * _np.cos(_np.pi / 4 + beta),
784
+ ],
785
+ [
786
+ t / _np.sqrt(2) * _np.sin(_np.pi / 4 + beta)
787
+ + radius * (2 - _np.sqrt(2)) * _np.sin(beta),
788
+ -t / _np.sqrt(2) * _np.cos(_np.pi / 4 + beta)
789
+ - radius * (2 - _np.sqrt(2)) * _np.cos(beta),
790
+ ],
791
+ [
792
+ t / _np.sqrt(2) * _np.sin(_np.pi / 4 + beta)
793
+ + (radius * _np.sin(beta)),
794
+ -t / _np.sqrt(2) * _np.cos(_np.pi / 4 + beta)
795
+ - (radius * _np.cos(beta)),
796
+ ],
797
+ [
798
+ (t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
799
+ * _np.sin(-_np.pi / 4 + beta),
800
+ -(t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
801
+ * _np.cos(-_np.pi / 4 + beta),
802
+ ],
803
+ [
804
+ t / _np.sqrt(2) * _np.sin(-_np.pi / 4 + beta)
805
+ + radius * (2 - _np.sqrt(2)) * _np.sin(beta),
806
+ -t / _np.sqrt(2) * _np.cos(-_np.pi / 4 + beta)
807
+ - radius * (2 - _np.sqrt(2)) * _np.cos(beta),
808
+ ],
809
+ [
810
+ t / _np.sqrt(2) * _np.sin(-_np.pi / 4 + beta)
811
+ + (radius * _np.sin(beta)),
812
+ -t / _np.sqrt(2) * _np.cos(-_np.pi / 4 + beta)
813
+ - (radius * _np.cos(beta)),
814
+ ],
815
+ ]
816
+ )
817
+ * _np.array(
818
+ [[-m1, m2], [-m1, m2], [-m1, m2], [-m1, m2], [-m1, m2], [-m1, m2]]
819
+ )
820
+ + _np.array(
821
+ [
822
+ [translationx, translationy],
823
+ [translationx, translationy],
824
+ [translationx, translationy],
825
+ [translationx, translationy],
826
+ [translationx, translationy],
827
+ [translationx, translationy],
828
+ ]
829
+ ),
830
+ )
831
+ )
832
+
833
+ # Spline 3.1
834
+ spline_list.append(
835
+ splinepy.Bezier(
836
+ degrees=[2, 1],
837
+ control_points=_np.array(
838
+ [
839
+ [
840
+ -t / _np.sqrt(2) * _np.cos(_np.pi / 4 + beta)
841
+ - (radius * _np.cos(beta)),
842
+ t / _np.sqrt(2) * _np.sin(_np.pi / 4 + beta)
843
+ + (radius * _np.sin(beta)),
844
+ ],
845
+ [
846
+ -arm_pos - delta_tN_knick * t / 2,
847
+ (arm_pos + t / 2) * _np.tan(beta)
848
+ + delta_tN_knick * t / (2 * _np.sin(_np.pi / 2 - beta)),
849
+ ],
850
+ [
851
+ -arm_pos - delta_tN_gerade * t / 2,
852
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
853
+ + radius,
854
+ ],
855
+ [
856
+ -t / _np.sqrt(2) * _np.cos(-_np.pi / 4 + beta)
857
+ - (radius * _np.cos(beta)),
858
+ t / _np.sqrt(2) * _np.sin(-_np.pi / 4 + beta)
859
+ + (radius * _np.sin(beta)),
860
+ ],
861
+ [
862
+ -arm_pos + delta_tN_knick * t / 2,
863
+ (arm_pos - t / 2) * _np.tan(beta)
864
+ - delta_tN_knick * t / (2 * _np.sin(_np.pi / 2 - beta)),
865
+ ],
866
+ [
867
+ -arm_pos + delta_tN_gerade * t / 2,
868
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
869
+ + radius,
870
+ ],
871
+ ]
872
+ )
873
+ * -1
874
+ * _np.array(
875
+ [[m1, m2], [m1, m2], [m1, m2], [m1, m2], [m1, m2], [m1, m2]]
876
+ )
877
+ + _np.array(
878
+ [
879
+ [translationx, translationy],
880
+ [translationx, translationy],
881
+ [translationx, translationy],
882
+ [translationx, translationy],
883
+ [translationx, translationy],
884
+ [translationx, translationy],
885
+ ]
886
+ ),
887
+ )
888
+ )
889
+
890
+ # Spline 3.2 Rundung des Armes außen
891
+ spline_list.append(
892
+ splinepy.Bezier(
893
+ degrees=[3, 1],
894
+ control_points=_np.array(
895
+ [
896
+ [
897
+ -arm_pos - delta_tN_gerade * t / 2,
898
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
899
+ + radius,
900
+ ],
901
+ [
902
+ -arm_pos - delta_tN_gerade * t / 6 * 2 - tN / 6,
903
+ -(Edge / 3)
904
+ + 2
905
+ * (
906
+ (
907
+ arm_pos * _np.tan(beta)
908
+ - arm_pos / _np.cos(beta)
909
+ + t / 2
910
+ )
911
+ + radius
912
+ )
913
+ / 3
914
+ - (
915
+ 0.5
916
+ * tN
917
+ * (
918
+ -1
919
+ + 1
920
+ / (
921
+ _np.cos(
922
+ _np.arctan(
923
+ (3 * delta_d)
924
+ / (
925
+ Edge
926
+ + (
927
+ arm_pos * _np.tan(beta)
928
+ - arm_pos / _np.cos(beta)
929
+ + t / 2
930
+ )
931
+ + radius
932
+ )
933
+ )
934
+ )
935
+ )
936
+ )
937
+ )
938
+ / (
939
+ (3 * delta_d)
940
+ / (
941
+ Edge
942
+ + (
943
+ arm_pos * _np.tan(beta)
944
+ - arm_pos / _np.cos(beta)
945
+ + t / 2
946
+ )
947
+ + radius
948
+ )
949
+ ),
950
+ ],
951
+ [
952
+ -arm_pos - delta_tN_gerade * t / 6 - tN / 6 * 2 + delta_d,
953
+ -(2 * Edge / 3)
954
+ + (
955
+ (
956
+ arm_pos * _np.tan(beta)
957
+ - arm_pos / _np.cos(beta)
958
+ + t / 2
959
+ )
960
+ + radius
961
+ )
962
+ / 3
963
+ - (
964
+ 0.5
965
+ * tN
966
+ * (
967
+ -1
968
+ + 1
969
+ / (
970
+ _np.cos(
971
+ _np.arctan(
972
+ (3 * delta_d)
973
+ / (
974
+ Edge
975
+ + (
976
+ arm_pos * _np.tan(beta)
977
+ - arm_pos / _np.cos(beta)
978
+ + t / 2
979
+ )
980
+ + radius
981
+ )
982
+ )
983
+ )
984
+ )
985
+ )
986
+ )
987
+ / (
988
+ (3 * delta_d)
989
+ / (
990
+ Edge
991
+ + (
992
+ arm_pos * _np.tan(beta)
993
+ - arm_pos / _np.cos(beta)
994
+ + t / 2
995
+ )
996
+ + radius
997
+ )
998
+ ),
999
+ ],
1000
+ [-arm_pos - tN / 2 + delta_d, -Edge],
1001
+ [
1002
+ -arm_pos + delta_tN_gerade * t / 2,
1003
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
1004
+ + radius,
1005
+ ],
1006
+ [
1007
+ -arm_pos + delta_tN_gerade * t / 6 * 2 + tN / 6,
1008
+ -(Edge / 3)
1009
+ + 2
1010
+ * (
1011
+ (
1012
+ arm_pos * _np.tan(beta)
1013
+ - arm_pos / _np.cos(beta)
1014
+ + t / 2
1015
+ )
1016
+ + radius
1017
+ )
1018
+ / 3
1019
+ + (
1020
+ 0.5
1021
+ * tN
1022
+ * (
1023
+ -1
1024
+ + 1
1025
+ / (
1026
+ _np.cos(
1027
+ _np.arctan(
1028
+ (3 * delta_d)
1029
+ / (
1030
+ Edge
1031
+ + (
1032
+ arm_pos * _np.tan(beta)
1033
+ - arm_pos / _np.cos(beta)
1034
+ + t / 2
1035
+ )
1036
+ + radius
1037
+ )
1038
+ )
1039
+ )
1040
+ )
1041
+ )
1042
+ )
1043
+ / (
1044
+ (3 * delta_d)
1045
+ / (
1046
+ Edge
1047
+ + (
1048
+ arm_pos * _np.tan(beta)
1049
+ - arm_pos / _np.cos(beta)
1050
+ + t / 2
1051
+ )
1052
+ + radius
1053
+ )
1054
+ ),
1055
+ ],
1056
+ [
1057
+ -arm_pos + delta_tN_gerade * t / 6 + tN / 6 * 2 + delta_d,
1058
+ -(2 * Edge / 3)
1059
+ + (
1060
+ (
1061
+ arm_pos * _np.tan(beta)
1062
+ - arm_pos / _np.cos(beta)
1063
+ + t / 2
1064
+ )
1065
+ + radius
1066
+ )
1067
+ / 3
1068
+ + (
1069
+ 0.5
1070
+ * tN
1071
+ * (
1072
+ -1
1073
+ + 1
1074
+ / (
1075
+ _np.cos(
1076
+ _np.arctan(
1077
+ (3 * delta_d)
1078
+ / (
1079
+ Edge
1080
+ + (
1081
+ arm_pos * _np.tan(beta)
1082
+ - arm_pos / _np.cos(beta)
1083
+ + t / 2
1084
+ )
1085
+ + radius
1086
+ )
1087
+ )
1088
+ )
1089
+ )
1090
+ )
1091
+ )
1092
+ / (
1093
+ (3 * delta_d)
1094
+ / (
1095
+ Edge
1096
+ + (
1097
+ arm_pos * _np.tan(beta)
1098
+ - arm_pos / _np.cos(beta)
1099
+ + t / 2
1100
+ )
1101
+ + radius
1102
+ )
1103
+ ),
1104
+ ],
1105
+ [-arm_pos + tN / 2 + delta_d, -Edge],
1106
+ ]
1107
+ )
1108
+ * -1
1109
+ * _np.array(
1110
+ [
1111
+ [m1, m2],
1112
+ [m1, m2],
1113
+ [m1, m2],
1114
+ [m1, m2],
1115
+ [m1, m2],
1116
+ [m1, m2],
1117
+ [m1, m2],
1118
+ [m1, m2],
1119
+ ]
1120
+ )
1121
+ + _np.array(
1122
+ [
1123
+ [translationx, translationy],
1124
+ [translationx, translationy],
1125
+ [translationx, translationy],
1126
+ [translationx, translationy],
1127
+ [translationx, translationy],
1128
+ [translationx, translationy],
1129
+ [translationx, translationy],
1130
+ [translationx, translationy],
1131
+ ]
1132
+ ),
1133
+ )
1134
+ )
1135
+
1136
+ # Spline 3.3
1137
+ spline_list.append(
1138
+ splinepy.Bezier(
1139
+ degrees=[2, 1],
1140
+ control_points=_np.array(
1141
+ [
1142
+ [
1143
+ -(t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1144
+ * _np.cos(_np.pi / 4 + beta),
1145
+ (t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1146
+ * _np.sin(_np.pi / 4 + beta),
1147
+ ],
1148
+ [
1149
+ -t / _np.sqrt(2) * _np.cos(_np.pi / 4 + beta)
1150
+ - radius * (2 - _np.sqrt(2)) * _np.cos(beta),
1151
+ t / _np.sqrt(2) * _np.sin(_np.pi / 4 + beta)
1152
+ + radius * (2 - _np.sqrt(2)) * _np.sin(beta),
1153
+ ],
1154
+ [
1155
+ -t / _np.sqrt(2) * _np.cos(_np.pi / 4 + beta)
1156
+ - (radius * _np.cos(beta)),
1157
+ t / _np.sqrt(2) * _np.sin(_np.pi / 4 + beta)
1158
+ + (radius * _np.sin(beta)),
1159
+ ],
1160
+ [
1161
+ -(t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1162
+ * _np.cos(-_np.pi / 4 + beta),
1163
+ (t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1164
+ * _np.sin(-_np.pi / 4 + beta),
1165
+ ],
1166
+ [
1167
+ -t / _np.sqrt(2) * _np.cos(-_np.pi / 4 + beta)
1168
+ - radius * (2 - _np.sqrt(2)) * _np.cos(beta),
1169
+ t / _np.sqrt(2) * _np.sin(-_np.pi / 4 + beta)
1170
+ + radius * (2 - _np.sqrt(2)) * _np.sin(beta),
1171
+ ],
1172
+ [
1173
+ -t / _np.sqrt(2) * _np.cos(-_np.pi / 4 + beta)
1174
+ - (radius * _np.cos(beta)),
1175
+ t / _np.sqrt(2) * _np.sin(-_np.pi / 4 + beta)
1176
+ + (radius * _np.sin(beta)),
1177
+ ],
1178
+ ]
1179
+ )
1180
+ * -1
1181
+ * _np.array(
1182
+ [[m1, m2], [m1, m2], [m1, m2], [m1, m2], [m1, m2], [m1, m2]]
1183
+ )
1184
+ + _np.array(
1185
+ [
1186
+ [translationx, translationy],
1187
+ [translationx, translationy],
1188
+ [translationx, translationy],
1189
+ [translationx, translationy],
1190
+ [translationx, translationy],
1191
+ [translationx, translationy],
1192
+ ]
1193
+ ),
1194
+ )
1195
+ )
1196
+
1197
+ # Spline 4.1
1198
+ spline_list.append(
1199
+ splinepy.Bezier(
1200
+ degrees=[2, 1],
1201
+ control_points=_np.array(
1202
+ [
1203
+ [
1204
+ t / _np.sqrt(2) * _np.sin(_np.pi / 4 + beta)
1205
+ + (radius * _np.sin(beta)),
1206
+ -t / _np.sqrt(2) * _np.cos(_np.pi / 4 + beta)
1207
+ - (radius * _np.cos(beta)),
1208
+ ],
1209
+ [
1210
+ (arm_pos + t / 2) * _np.tan(beta)
1211
+ + delta_tW_knick * t / (2 * _np.sin(_np.pi / 2 - beta)),
1212
+ -arm_pos - delta_tW_knick * t / 2,
1213
+ ],
1214
+ [
1215
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
1216
+ + radius,
1217
+ -arm_pos - delta_tW_gerade * t / 2,
1218
+ ],
1219
+ [
1220
+ t / _np.sqrt(2) * _np.sin(-_np.pi / 4 + beta)
1221
+ + (radius * _np.sin(beta)),
1222
+ -t / _np.sqrt(2) * _np.cos(-_np.pi / 4 + beta)
1223
+ - (radius * _np.cos(beta)),
1224
+ ],
1225
+ [
1226
+ (arm_pos - t / 2) * _np.tan(beta)
1227
+ - delta_tW_knick * t / (2 * _np.sin(_np.pi / 2 - beta)),
1228
+ -arm_pos + delta_tW_knick * t / 2,
1229
+ ],
1230
+ [
1231
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
1232
+ + radius,
1233
+ -arm_pos + delta_tW_gerade * t / 2,
1234
+ ],
1235
+ ]
1236
+ )
1237
+ * -1
1238
+ * _np.array(
1239
+ [[-m1, m2], [-m1, m2], [-m1, m2], [-m1, m2], [-m1, m2], [-m1, m2]]
1240
+ )
1241
+ + _np.array(
1242
+ [
1243
+ [translationx, translationy],
1244
+ [translationx, translationy],
1245
+ [translationx, translationy],
1246
+ [translationx, translationy],
1247
+ [translationx, translationy],
1248
+ [translationx, translationy],
1249
+ ]
1250
+ ),
1251
+ )
1252
+ )
1253
+
1254
+ # Spline 4.2 Rundung des Armes außen
1255
+ spline_list.append(
1256
+ splinepy.Bezier(
1257
+ degrees=[3, 1],
1258
+ control_points=_np.array(
1259
+ [
1260
+ [
1261
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
1262
+ + radius,
1263
+ -arm_pos - delta_tW_gerade * t / 2,
1264
+ ],
1265
+ [
1266
+ -(Edge / 3)
1267
+ + 2
1268
+ * (
1269
+ (
1270
+ arm_pos * _np.tan(beta)
1271
+ - arm_pos / _np.cos(beta)
1272
+ + t / 2
1273
+ )
1274
+ + radius
1275
+ )
1276
+ / 3
1277
+ - (
1278
+ 0.5
1279
+ * tW
1280
+ * (
1281
+ -1
1282
+ + 1
1283
+ / (
1284
+ _np.cos(
1285
+ _np.arctan(
1286
+ (3 * delta_d)
1287
+ / (
1288
+ Edge
1289
+ + (
1290
+ arm_pos * _np.tan(beta)
1291
+ - arm_pos / _np.cos(beta)
1292
+ + t / 2
1293
+ )
1294
+ + radius
1295
+ )
1296
+ )
1297
+ )
1298
+ )
1299
+ )
1300
+ )
1301
+ / (
1302
+ (3 * delta_d)
1303
+ / (
1304
+ Edge
1305
+ + (
1306
+ arm_pos * _np.tan(beta)
1307
+ - arm_pos / _np.cos(beta)
1308
+ + t / 2
1309
+ )
1310
+ + radius
1311
+ )
1312
+ ),
1313
+ -arm_pos - delta_tW_gerade * t / 6 * 2 - tW / 6,
1314
+ ],
1315
+ [
1316
+ -(2 * Edge / 3)
1317
+ + (
1318
+ (
1319
+ arm_pos * _np.tan(beta)
1320
+ - arm_pos / _np.cos(beta)
1321
+ + t / 2
1322
+ )
1323
+ + radius
1324
+ )
1325
+ / 3
1326
+ - (
1327
+ 0.5
1328
+ * tW
1329
+ * (
1330
+ -1
1331
+ + 1
1332
+ / (
1333
+ _np.cos(
1334
+ _np.arctan(
1335
+ (3 * delta_d)
1336
+ / (
1337
+ Edge
1338
+ + (
1339
+ arm_pos * _np.tan(beta)
1340
+ - arm_pos / _np.cos(beta)
1341
+ + t / 2
1342
+ )
1343
+ + radius
1344
+ )
1345
+ )
1346
+ )
1347
+ )
1348
+ )
1349
+ )
1350
+ / (
1351
+ (3 * delta_d)
1352
+ / (
1353
+ Edge
1354
+ + (
1355
+ arm_pos * _np.tan(beta)
1356
+ - arm_pos / _np.cos(beta)
1357
+ + t / 2
1358
+ )
1359
+ + radius
1360
+ )
1361
+ ),
1362
+ -arm_pos - delta_tW_gerade * t / 6 - tW / 6 * 2 + delta_d,
1363
+ ],
1364
+ [-Edge, -arm_pos - tW / 2 + delta_d],
1365
+ [
1366
+ (arm_pos * _np.tan(beta) - arm_pos / _np.cos(beta) + t / 2)
1367
+ + radius,
1368
+ -arm_pos + delta_tW_gerade * t / 2,
1369
+ ],
1370
+ [
1371
+ -(Edge / 3)
1372
+ + 2
1373
+ * (
1374
+ (
1375
+ arm_pos * _np.tan(beta)
1376
+ - arm_pos / _np.cos(beta)
1377
+ + t / 2
1378
+ )
1379
+ + radius
1380
+ )
1381
+ / 3
1382
+ + (
1383
+ 0.5
1384
+ * tW
1385
+ * (
1386
+ -1
1387
+ + 1
1388
+ / (
1389
+ _np.cos(
1390
+ _np.arctan(
1391
+ (3 * delta_d)
1392
+ / (
1393
+ Edge
1394
+ + (
1395
+ arm_pos * _np.tan(beta)
1396
+ - arm_pos / _np.cos(beta)
1397
+ + t / 2
1398
+ )
1399
+ + radius
1400
+ )
1401
+ )
1402
+ )
1403
+ )
1404
+ )
1405
+ )
1406
+ / (
1407
+ (3 * delta_d)
1408
+ / (
1409
+ Edge
1410
+ + (
1411
+ arm_pos * _np.tan(beta)
1412
+ - arm_pos / _np.cos(beta)
1413
+ + t / 2
1414
+ )
1415
+ + radius
1416
+ )
1417
+ ),
1418
+ -arm_pos + delta_tW_gerade * t / 6 * 2 + tW / 6,
1419
+ ],
1420
+ [
1421
+ -(2 * Edge / 3)
1422
+ + (
1423
+ (
1424
+ arm_pos * _np.tan(beta)
1425
+ - arm_pos / _np.cos(beta)
1426
+ + t / 2
1427
+ )
1428
+ + radius
1429
+ )
1430
+ / 3
1431
+ + (
1432
+ 0.5
1433
+ * tW
1434
+ * (
1435
+ -1
1436
+ + 1
1437
+ / (
1438
+ _np.cos(
1439
+ _np.arctan(
1440
+ (3 * delta_d)
1441
+ / (
1442
+ Edge
1443
+ + (
1444
+ arm_pos * _np.tan(beta)
1445
+ - arm_pos / _np.cos(beta)
1446
+ + t / 2
1447
+ )
1448
+ + radius
1449
+ )
1450
+ )
1451
+ )
1452
+ )
1453
+ )
1454
+ )
1455
+ / (
1456
+ (3 * delta_d)
1457
+ / (
1458
+ Edge
1459
+ + (
1460
+ arm_pos * _np.tan(beta)
1461
+ - arm_pos / _np.cos(beta)
1462
+ + t / 2
1463
+ )
1464
+ + radius
1465
+ )
1466
+ ),
1467
+ -arm_pos + delta_tW_gerade * t / 6 + tW / 6 * 2 + delta_d,
1468
+ ],
1469
+ [-Edge, -arm_pos + tW / 2 + delta_d],
1470
+ ]
1471
+ )
1472
+ * -1
1473
+ * _np.array(
1474
+ [
1475
+ [-m1, m2],
1476
+ [-m1, m2],
1477
+ [-m1, m2],
1478
+ [-m1, m2],
1479
+ [-m1, m2],
1480
+ [-m1, m2],
1481
+ [-m1, m2],
1482
+ [-m1, m2],
1483
+ ]
1484
+ )
1485
+ + _np.array(
1486
+ [
1487
+ [translationx, translationy],
1488
+ [translationx, translationy],
1489
+ [translationx, translationy],
1490
+ [translationx, translationy],
1491
+ [translationx, translationy],
1492
+ [translationx, translationy],
1493
+ [translationx, translationy],
1494
+ [translationx, translationy],
1495
+ ]
1496
+ ),
1497
+ )
1498
+ )
1499
+
1500
+ # Spline 4.3
1501
+ spline_list.append(
1502
+ splinepy.Bezier(
1503
+ degrees=[2, 1],
1504
+ control_points=_np.array(
1505
+ [
1506
+ [
1507
+ (t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1508
+ * _np.sin(_np.pi / 4 + beta),
1509
+ -(t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1510
+ * _np.cos(_np.pi / 4 + beta),
1511
+ ],
1512
+ [
1513
+ t / _np.sqrt(2) * _np.sin(_np.pi / 4 + beta)
1514
+ + radius * (2 - _np.sqrt(2)) * _np.sin(beta),
1515
+ -t / _np.sqrt(2) * _np.cos(_np.pi / 4 + beta)
1516
+ - radius * (2 - _np.sqrt(2)) * _np.cos(beta),
1517
+ ],
1518
+ [
1519
+ t / _np.sqrt(2) * _np.sin(_np.pi / 4 + beta)
1520
+ + (radius * _np.sin(beta)),
1521
+ -t / _np.sqrt(2) * _np.cos(_np.pi / 4 + beta)
1522
+ - (radius * _np.cos(beta)),
1523
+ ],
1524
+ [
1525
+ (t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1526
+ * _np.sin(-_np.pi / 4 + beta),
1527
+ -(t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1528
+ * _np.cos(-_np.pi / 4 + beta),
1529
+ ],
1530
+ [
1531
+ t / _np.sqrt(2) * _np.sin(-_np.pi / 4 + beta)
1532
+ + radius * (2 - _np.sqrt(2)) * _np.sin(beta),
1533
+ -t / _np.sqrt(2) * _np.cos(-_np.pi / 4 + beta)
1534
+ - radius * (2 - _np.sqrt(2)) * _np.cos(beta),
1535
+ ],
1536
+ [
1537
+ t / _np.sqrt(2) * _np.sin(-_np.pi / 4 + beta)
1538
+ + (radius * _np.sin(beta)),
1539
+ -t / _np.sqrt(2) * _np.cos(-_np.pi / 4 + beta)
1540
+ - (radius * _np.cos(beta)),
1541
+ ],
1542
+ ]
1543
+ )
1544
+ * -1
1545
+ * _np.array(
1546
+ [[-m1, m2], [-m1, m2], [-m1, m2], [-m1, m2], [-m1, m2], [-m1, m2]]
1547
+ )
1548
+ + _np.array(
1549
+ [
1550
+ [translationx, translationy],
1551
+ [translationx, translationy],
1552
+ [translationx, translationy],
1553
+ [translationx, translationy],
1554
+ [translationx, translationy],
1555
+ [translationx, translationy],
1556
+ ]
1557
+ ),
1558
+ )
1559
+ )
1560
+
1561
+ # Spline 5 Middle
1562
+ spline_list.append(
1563
+ splinepy.Bezier(
1564
+ degrees=[1, 1],
1565
+ control_points=_np.array(
1566
+ [
1567
+ [
1568
+ -(t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1569
+ * _np.cos(_np.pi / 4 + beta),
1570
+ (t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1571
+ * _np.sin(_np.pi / 4 + beta),
1572
+ ],
1573
+ [
1574
+ -(t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1575
+ * _np.cos(-_np.pi / 4 + beta),
1576
+ (t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1577
+ * _np.sin(-_np.pi / 4 + beta),
1578
+ ],
1579
+ [
1580
+ (t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1581
+ * _np.cos(-_np.pi / 4 + beta),
1582
+ -(t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1583
+ * _np.sin(-_np.pi / 4 + beta),
1584
+ ],
1585
+ [
1586
+ (t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1587
+ * _np.cos(_np.pi / 4 + beta),
1588
+ -(t / _np.sqrt(2) + radius * (_np.sqrt(2) - 1))
1589
+ * _np.sin(_np.pi / 4 + beta),
1590
+ ],
1591
+ ]
1592
+ )
1593
+ * _np.array([[m1, m2], [m1, m2], [m1, m2], [m1, m2]])
1594
+ + _np.array(
1595
+ [
1596
+ [translationx, translationy],
1597
+ [translationx, translationy],
1598
+ [translationx, translationy],
1599
+ [translationx, translationy],
1600
+ ]
1601
+ ),
1602
+ )
1603
+ )
1604
+
1605
+ extr_spline_list = []
1606
+ for spline in spline_list:
1607
+ if make3D:
1608
+ extr_spline = splinepy.helpme.create.extruded(spline, (0, 0, 1))
1609
+ temp_pts = extr_spline.control_points.copy()
1610
+ extr_spline.control_points[:, 0] = temp_pts[:, 1]
1611
+ extr_spline.control_points[:, 1] = temp_pts[:, 2]
1612
+ extr_spline.control_points[:, 2] = temp_pts[:, 0]
1613
+ else:
1614
+ extr_spline = spline
1615
+ extr_spline_list.append(extr_spline)
1616
+
1617
+ return (extr_spline_list, None)