@@ -367,6 +367,39 @@ def compute_forces_and_moments(
367367 M3 += M3_damping
368368 return R1 , R2 , R3 , M1 , M2 , M3
369369
370+ def __compute_leading_edge_position (self , position , _csys ):
371+ """Computes the position of the fin leading edge in a rocket's user,
372+ given its position in a rocket."""
373+ # Point from deflection from cant angle in the plane perpendicular to
374+ # the fuselage where the fin is located in the fin frame
375+ p = Vector (
376+ [
377+ - self .root_chord / 2 * np .sin (self .cant_angle_rad ),
378+ 0 ,
379+ self .root_chord / 2 * (1 - np .cos (self .cant_angle_rad )),
380+ ]
381+ )
382+ # Rotate the point to the body frame orientation
383+ p = self ._rotation_fin_to_body_uncanted @ p
384+
385+ # Rotate the point to the user-defined coordinate system
386+ p = Vector ([p .x * _csys , p .y , p .z * _csys ])
387+
388+ # Calculate the position of the fin leading edge in the user frame
389+ # as if no cant angle was applied
390+ position = Vector (
391+ [
392+ - self .rocket_radius * math .sin (self .angular_position_rad ) * _csys ,
393+ self .rocket_radius * math .cos (self .angular_position_rad ),
394+ position ,
395+ ]
396+ )
397+
398+ # Translate the position of the fin leading edge to the position of the
399+ # fin leading edge with cant angle
400+ position += p
401+ return position
402+
370403 def to_dict (self , include_outputs = False ):
371404 data = {
372405 "angular_position" : self .angular_position ,
0 commit comments