Skip to content

Commit c1f5114

Browse files
committed
ENH: use math instead of numpy in non vector operations
1 parent 9c0dd13 commit c1f5114

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

rocketpy/rocket/aero_surface/fins/_geometry.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,9 @@ def get_data(self, include_outputs=False):
338338
"AR": getattr(self, "AR", None),
339339
"gamma_c": getattr(self, "gamma_c", None),
340340
"Yma": getattr(self, "Yma", None),
341-
"roll_geometrical_constant": getattr(self, "roll_geometrical_constant", None),
341+
"roll_geometrical_constant": getattr(
342+
self, "roll_geometrical_constant", None
343+
),
342344
"tau": getattr(self, "tau", None),
343345
"lift_interference_factor": getattr(self, "lift_interference_factor", None),
344346
"roll_damping_interference_factor": getattr(

rocketpy/rocket/aero_surface/fins/elliptical_fin.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,7 @@ def __init__(
167167
def evaluate_center_of_pressure(self):
168168
"""Calculates and returns the center of pressure of the fin in local
169169
coordinates. The center of pressure position is saved and stored as a
170-
tuple.
171-
172-
Returns
173-
-------
174-
None
175-
"""
170+
tuple."""
176171
# Barrowman elliptical-fin center of pressure location.
177172
cpz = 0.288 * self.root_chord
178173
self.cpx = 0

rocketpy/rocket/aero_surface/fins/fin.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,22 +276,26 @@ def evaluate_rotation_matrix(self):
276276
"""
277277
phi = self.angular_position_rad
278278
delta = self.cant_angle_rad
279+
sin_phi = math.sin(phi)
280+
cos_phi = math.cos(phi)
281+
sin_delta = math.sin(delta)
282+
cos_delta = math.cos(delta)
279283

280284
# Rotation about body Z by angular position
281285
R_phi = Matrix(
282286
[
283-
[np.cos(phi), -np.sin(phi), 0],
284-
[np.sin(phi), np.cos(phi), 0],
287+
[cos_phi, -sin_phi, 0],
288+
[sin_phi, cos_phi, 0],
285289
[0, 0, 1],
286290
]
287291
)
288292

289293
# Cant rotation about body Y
290294
R_delta = Matrix(
291295
[
292-
[np.cos(delta), 0, -np.sin(delta)],
296+
[cos_delta, 0, -sin_delta],
293297
[0, 1, 0],
294-
[np.sin(delta), 0, np.cos(delta)],
298+
[sin_delta, 0, cos_delta],
295299
]
296300
)
297301

0 commit comments

Comments
 (0)