Skip to content

Commit

Permalink
Improve roboustness in automatic orientation detection in create_beam…
Browse files Browse the repository at this point in the history
…_mesh_line
  • Loading branch information
isteinbrecher committed Apr 24, 2024
1 parent d924efe commit 3243610
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion meshpy/mesh_creation_functions/beam_basic_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ def create_beam_mesh_line(
t1 = direction / line_length

# Check if the z or y axis are larger projected onto the direction.
if abs(np.dot(t1, [0, 0, 1])) < abs(np.dot(t1, [0, 1, 0])):
# The tolerance is used here to ensure that round-off changes in the last digits of
# the floating point values don't switch the case. This increases the robustness in
# testing.
if abs(np.dot(t1, [0, 0, 1])) < abs(np.dot(t1, [0, 1, 0])) - mpy.eps_quaternion:
t2 = [0, 0, 1]
else:
t2 = [0, 1, 0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ NODE 5 COORD -1.96334800942 -0.381135925751 6.66666666667
NODE 6 COORD -1.03807125077 -1.70950521448 8.33333333333
NODE 7 COORD 0.567324370926 -1.91784854933 10
--------------------------------------------------------------STRUCTURE ELEMENTS
1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS 1.75998840379 0.729011066468 1.75998840379 -0.633874850223 -1.76514699225 -1.69636461303 -1.51638250626 -1.59087011094 -2.19715939648
2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS -0.633874850223 -1.76514699225 -1.69636461303 0.746212769126 -1.40383785444 -0.465011157306 0.121031100845 -1.68035914483 -1.10261143399
3 BEAM3R HERM2LINE3 5 7 6 MAT 1 TRIADS 0.746212769126 -1.40383785444 -0.465011157306 1.58368887616 -0.402516203743 0.835215206421 1.23796977269 -0.971871890386 0.188159617035
1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS -0.613943125569 -1.48218982027 0.613943125569 0.825845001377 -1.75132059139 1.82233126689 0.0412003090647 -1.71867210284 1.24441771648
2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS 0.825845001377 -1.75132059139 1.82233126689 -1.76693362712 0.540443031687 -1.63156168219 -1.62734522345 1.40867035905 -2.14678720617
3 BEAM3R HERM2LINE3 5 7 6 MAT 1 TRIADS -1.76693362712 0.540443031687 -1.63156168219 -1.36158461459 -0.809718268376 -0.390228435716 -1.6574070681 -0.199576520935 -1.03084186572
------------------------------------------------------------------FLUID ELEMENTS
-----------------------------------------------------------------------------END

0 comments on commit 3243610

Please sign in to comment.