Skip to content

Commit

Permalink
Merge branch 'master' into 95-add-comment-in-the-geodat-mentioning-na…
Browse files Browse the repository at this point in the history
…me-of-the-figure
  • Loading branch information
MatoKnap authored Jan 8, 2025
2 parents 6d367a7 + b8a784d commit da86362
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@ cython_debug/
# End of https://www.toptal.com/developers/gitignore/api/python,visualstudiocode,pycharm

**/*.dat
**/info*.json
!tests/shieldhit/resources/expected_shieldhit_output/*.dat
.vscode/settings.json
12 changes: 10 additions & 2 deletions converter/shieldhit/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,16 @@ def _parse_box(box: BoxFigure, number: int) -> str:
x_vec = rotate([box.x_edge_length, 0, 0], box.rotation)
y_vec = rotate([0, box.y_edge_length, 0], box.rotation)
z_vec = rotate([0, 0, box.z_edge_length], box.rotation)
diagonal_vec = [x_vec[i] + y_vec[i] + z_vec[i] for i in range(3)]
start_position = [box.position[i] - diagonal_vec[i] / 2 for i in range(3)]
diagonal_vec = [
x_vec[0] + y_vec[0] + z_vec[0],
x_vec[1] + y_vec[1] + z_vec[1],
x_vec[2] + y_vec[2] + z_vec[2],
]
start_position = (
box.position[0] - diagonal_vec[0] / 2,
box.position[1] - diagonal_vec[1] / 2,
box.position[2] - diagonal_vec[2] / 2,
)

box_template = """
* Box: {name}, Dimensions: {x_edge_length} x {y_edge_length} x {z_edge_length}, Position: {position}, Rotation: {rotation}
Expand Down

0 comments on commit da86362

Please sign in to comment.