Skip to content

Commit fb178f1

Browse files
Fix Style3D anisotropic cloth construction for NumPy 1.x (#4027)
Co-authored-by: zlong-911 <269452159+zlong-911@users.noreply.github.com> Co-authored-by: Wenchao Huang <huangwenchao@linctex.com>
1 parent b74df53 commit fb178f1

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use supported NumPy ufunc names when building anisotropic Style3D cloth.

newton/_src/solvers/style3d/cloth.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ def cross2d(a, b):
142142
return a[:, 0] * b[:, 1] - a[:, 1] * b[:, 0]
143143

144144
if edge_aniso_values is not None:
145-
angle_f0 = np.atan2(panel_x43_f0[:, 1], panel_x43_f0[:, 0])
146-
angle_f1 = np.atan2(panel_x43_f1[:, 1], panel_x43_f1[:, 0])
145+
angle_f0 = np.arctan2(panel_x43_f0[:, 1], panel_x43_f0[:, 0])
146+
angle_f1 = np.arctan2(panel_x43_f1[:, 1], panel_x43_f1[:, 0])
147147
angle = (angle_f0 + angle_f1) * 0.5
148148
sin = np.sin(angle)
149149
cos = np.cos(angle)
150-
sin2 = np.pow(sin, 2)
151-
cos2 = np.pow(cos, 2)
152-
sin12 = np.pow(sin, 12)
153-
cos12 = np.pow(cos, 12)
150+
sin2 = np.power(sin, 2)
151+
cos2 = np.power(cos, 2)
152+
sin12 = np.power(sin, 12)
153+
cos12 = np.power(cos, 12)
154154
aniso_ke = np.array(edge_aniso_values, dtype=float).reshape(-1, 3)
155155
edge_ke = aniso_ke[:, 0] * sin12 + aniso_ke[:, 1] * cos12 + aniso_ke[:, 2] * 4.0 * sin2 * cos2
156156

0 commit comments

Comments
 (0)