Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions structuralcodes/geometry/profiles/_base_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,12 @@ def _find_principals_direction_and_moments(self):
)
max_idx = np.argmax(eigres[0])
min_idx = 0 if max_idx == 1 else 1
self._Icsi = eigres[0][max_idx]
self._Ieta = eigres[0][min_idx]
self._theta = np.arccos(
np.dot(np.array([1, 0]), eigres[1][:, max_idx])
# The principal values are cast to real type to ensure no imaginary
# part is present
self._Icsi = np.real(eigres[0][max_idx])
self._Ieta = np.real(eigres[0][min_idx])
self._theta = np.real(
np.arccos(np.dot(np.array([1, 0]), eigres[1][:, max_idx]))
)

@property
Expand Down
10 changes: 7 additions & 3 deletions structuralcodes/sections/_beam_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,13 @@ def find_principal_axes_moments(iyy, izz, iyz):
eigres = np.linalg.eig(np.array([[iyy, iyz], [iyz, izz]]))
max_idx = np.argmax(eigres[0])
min_idx = 0 if max_idx == 1 else 1
i11 = eigres[0][max_idx]
i22 = eigres[0][min_idx]
theta = np.arccos(np.dot(np.array([1, 0]), eigres[1][:, max_idx]))
# The principal values are cast to real type to ensure no imaginary
# part is present
i11 = np.real(eigres[0][max_idx])
i22 = np.real(eigres[0][min_idx])
theta = np.real(
np.arccos(np.dot(np.array([1, 0]), eigres[1][:, max_idx]))
)
return i11, i22, theta

gp.i11, gp.i22, gp.theta = find_principal_axes_moments(
Expand Down
Loading