Skip to content

Commit 00d3770

Browse files
authored
Removing the generated unuseful comment
1 parent 9d8f444 commit 00d3770

File tree

1 file changed

+32
-47
lines changed

1 file changed

+32
-47
lines changed

rocketpy/plots/rocket_plots.py

Lines changed: 32 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,7 @@ def __validate_aerodynamic_surfaces(self):
225225
def _draw_aerodynamic_surfaces(self, ax, vis_args, plane):
226226
"""Draws the aerodynamic surfaces and saves the position of the points
227227
of interest for the tubes."""
228-
# List of drawn surfaces with the position of points of interest
229-
# and the radius of the rocket at that point
230228
drawn_surfaces = []
231-
# Idea is to get the shape of each aerodynamic surface in their own
232-
# coordinate system and then plot them in the rocket coordinate system
233-
# using the position of each surface
234-
# For the tubes, the surfaces need to be checked in order to check for
235-
# diameter changes. The final point of the last surface is the final
236-
# point of the last tube
237229

238230
for surface, position in self.rocket.aerodynamic_surfaces:
239231
if isinstance(surface, NoseCone):
@@ -265,14 +257,14 @@ def _draw_nose_cone(self, ax, surface, position, drawn_surfaces, vis_args):
265257
color=vis_args["nose"],
266258
linewidth=vis_args["line_width"],
267259
)
268-
# close the nosecone
260+
269261
ax.plot(
270262
[x_nosecone[-1], x_nosecone[-1]],
271263
[y_nosecone[-1], -y_nosecone[-1]],
272264
color=vis_args["nose"],
273265
linewidth=vis_args["line_width"],
274266
)
275-
# Add the nosecone to the list of drawn surfaces
267+
276268
drawn_surfaces.append(
277269
(surface, x_nosecone[-1], surface.rocket_radius, x_nosecone[-1])
278270
)
@@ -288,7 +280,7 @@ def _draw_tail(self, ax, surface, position, drawn_surfaces, vis_args):
288280
ax.plot(
289281
x_tail, -y_tail, color=vis_args["tail"], linewidth=vis_args["line_width"]
290282
)
291-
# close above and below the tail
283+
292284
ax.plot(
293285
[x_tail[-1], x_tail[-1]],
294286
[y_tail[-1], -y_tail[-1]],
@@ -301,7 +293,7 @@ def _draw_tail(self, ax, surface, position, drawn_surfaces, vis_args):
301293
color=vis_args["tail"],
302294
linewidth=vis_args["line_width"],
303295
)
304-
# Add the tail to the list of drawn surfaces
296+
305297
drawn_surfaces.append((surface, position, surface.bottom_radius, x_tail[-1]))
306298

307299
def _draw_fins(self, ax, surface, position, drawn_surfaces, vis_args):
@@ -313,16 +305,15 @@ def _draw_fins(self, ax, surface, position, drawn_surfaces, vis_args):
313305
rotation_angles = [2 * np.pi * i / num_fins for i in range(num_fins)]
314306

315307
for angle in rotation_angles:
316-
# Create a rotation matrix for the current angle around the x-axis
308+
317309
rotation_matrix = np.array([[1, 0], [0, np.cos(angle)]])
318310

319-
# Apply the rotation to the original fin points
311+
320312
rotated_points_2d = np.dot(rotation_matrix, np.vstack((x_fin, y_fin)))
321313

322-
# Extract x and y coordinates of the rotated points
323314
x_rotated, y_rotated = rotated_points_2d
324315

325-
# Project points above the XY plane back into the XY plane (set z-coordinate to 0)
316+
326317
x_rotated = np.where(
327318
rotated_points_2d[1] > 0, rotated_points_2d[0], x_rotated
328319
)
@@ -344,20 +335,20 @@ def _draw_generic_surface(
344335
surface,
345336
position,
346337
drawn_surfaces,
347-
vis_args, # pylint: disable=unused-argument
338+
vis_args,
348339
plane,
349340
):
350341
"""Draws the generic surface and saves the position of the points of interest
351342
for the tubes."""
352343
if plane == "xz":
353-
# z position of the sensor is the x position in the plot
344+
354345
x_pos = position[2]
355-
# x position of the surface is the y position in the plot
346+
356347
y_pos = position[0]
357348
elif plane == "yz":
358-
# z position of the surface is the x position in the plot
349+
359350
x_pos = position[2]
360-
# y position of the surface is the y position in the plot
351+
361352
y_pos = position[1]
362353
else: # pragma: no cover
363354
raise ValueError("Plane must be 'xz' or 'yz'.")
@@ -376,22 +367,19 @@ def _draw_tubes(self, ax, drawn_surfaces, vis_args):
376367
radius = 0
377368
last_x = 0
378369
for i, d_surface in enumerate(drawn_surfaces):
379-
# Draw the tubes, from the end of the first surface to the beginning
380-
# of the next surface, with the radius of the rocket at that point
370+
381371
surface, position, radius, last_x = d_surface
382372

383373
if i == len(drawn_surfaces) - 1:
384-
# If the last surface is a tail, do nothing
374+
385375
if isinstance(surface, Tail):
386376
continue
387-
# Else goes to the end of the surface
377+
388378
x_tube = [position, last_x]
389379
y_tube = [radius, radius]
390380
y_tube_negated = [-radius, -radius]
391381
else:
392-
# If it is not the last surface, the tube goes to the beginning
393-
# of the next surface
394-
# [next_surface, next_position, next_radius, next_last_x]
382+
395383
next_position = drawn_surfaces[i + 1][1]
396384
x_tube = [last_x, next_position]
397385
y_tube = [radius, radius]
@@ -469,7 +457,7 @@ def _generate_motor_patches(self, ax, plane="xz"):
469457

470458
if isinstance(self.rocket.motor, ClusterMotor):
471459
cluster = self.rocket.motor
472-
all_sub_patches = [] # Pour l'outline global
460+
all_sub_patches = []
473461

474462
for sub_motor, sub_pos in zip(cluster.motors, cluster.positions):
475463

@@ -541,7 +529,7 @@ def _generate_motor_patches(self, ax, plane="xz"):
541529
)
542530

543531
chamber = self.rocket.motor.plots._generate_combustion_chamber(
544-
translate=(grains_cm_position.real, 0), label=None
532+
translate=(grains_cm_position.real, 0), label=None
545533
)
546534
grains = self.rocket.motor.plots._generate_grains(
547535
translate=(grains_cm_position.real, 0)
@@ -555,7 +543,7 @@ def _generate_motor_patches(self, ax, plane="xz"):
555543
+ self.rocket.motor.grains_center_of_mass_position * total_csys
556544
)
557545
ax.scatter(
558-
grains_cm_position.real,
546+
grains_cm_position.real,
559547
0,
560548
color="brown",
561549
label="Grains Center of Mass",
@@ -567,7 +555,7 @@ def _generate_motor_patches(self, ax, plane="xz"):
567555
translate=(self.rocket.motor_position, 0), csys=total_csys
568556
)
569557
chamber = self.rocket.motor.plots._generate_combustion_chamber(
570-
translate=(grains_cm_position.real, 0), label=None
558+
translate=(grains_cm_position.real, 0), label=None
571559
)
572560
grains = self.rocket.motor.plots._generate_grains(
573561
translate=(grains_cm_position.real, 0)
@@ -603,8 +591,6 @@ def _generate_motor_patches(self, ax, plane="xz"):
603591

604592
def _draw_nozzle_tube(self, last_radius, last_x, nozzle_position, ax, vis_args):
605593
"""Draws the tube from the last surface to the nozzle position."""
606-
# Check if nozzle is beyond the last surface, if so draw a tube
607-
# to it, with the radius of the last surface
608594
if self.rocket._csys == 1:
609595
if nozzle_position < last_x:
610596
x_tube = [last_x, nozzle_position]
@@ -623,7 +609,7 @@ def _draw_nozzle_tube(self, last_radius, last_x, nozzle_position, ax, vis_args):
623609
color=vis_args["body"],
624610
linewidth=vis_args["line_width"],
625611
)
626-
else: # if self.rocket._csys == -1:
612+
else:
627613
if nozzle_position > last_x:
628614
x_tube = [last_x, nozzle_position]
629615
y_tube = [last_radius, last_radius]
@@ -680,23 +666,22 @@ def _draw_sensors(self, ax, sensors, plane):
680666
sensor = sensor_pos[0]
681667
pos = sensor_pos[1]
682668
if plane == "xz":
683-
# z position of the sensor is the x position in the plot
669+
684670
x_pos = pos[2]
685671
normal_x = sensor.normal_vector.z
686-
# x position of the sensor is the y position in the plot
672+
687673
y_pos = pos[0]
688674
normal_y = sensor.normal_vector.x
689675
elif plane == "yz":
690-
# z position of the sensor is the x position in the plot
676+
691677
x_pos = pos[2]
692678
normal_x = sensor.normal_vector.z
693-
# y position of the sensor is the y position in the plot
679+
694680
y_pos = pos[1]
695681
normal_y = sensor.normal_vector.y
696-
else: # pragma: no cover
682+
else:
697683
raise ValueError("Plane must be 'xz' or 'yz'.")
698684

699-
# line length is 2/5 of the rocket radius
700685
line_length = self.rocket.radius / 2.5
701686

702687
ax.plot(
@@ -731,34 +716,34 @@ def all(self):
731716
None
732717
"""
733718

734-
# Rocket draw
719+
735720
if len(self.rocket.aerodynamic_surfaces) > 0:
736721
print("\nRocket Draw")
737722
print("-" * 40)
738723
self.draw()
739724

740-
# Mass Plots
725+
741726
print("\nMass Plots")
742727
print("-" * 40)
743728
self.total_mass()
744729
self.reduced_mass()
745730

746-
# Aerodynamics Plots
731+
747732
print("\nAerodynamics Plots")
748733
print("-" * 40)
749734

750735
# Drag Plots
751736
print("Drag Plots")
752-
print("-" * 20) # Separator for Drag Plots
737+
print("-" * 20)
753738
self.drag_curves()
754739

755740
# Stability Plots
756741
print("\nStability Plots")
757-
print("-" * 20) # Separator for Stability Plots
742+
print("-" * 20)
758743
self.static_margin()
759744
self.stability_margin()
760745

761-
# Thrust-to-Weight Plot
746+
762747
print("\nThrust-to-Weight Plot")
763748
print("-" * 40)
764749
self.thrust_to_weight()

0 commit comments

Comments
 (0)