From 17001f87dadd6a349832db4069d9c4d582c7303f Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Mon, 12 Aug 2024 00:30:14 -0700 Subject: [PATCH] fix: s3 blade geometry --- nhf/touhou/houjuu_nue/wing.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/nhf/touhou/houjuu_nue/wing.py b/nhf/touhou/houjuu_nue/wing.py index 5728eca..fdc4eb5 100644 --- a/nhf/touhou/houjuu_nue/wing.py +++ b/nhf/touhou/houjuu_nue/wing.py @@ -1380,6 +1380,7 @@ class WingR(WingProfile): self, axle_loc: Cq.Location, radius: float, + core_radius: float, angle_span: float, bot: bool = False) -> Cq.Sketch: """ @@ -1391,13 +1392,15 @@ class WingR(WingProfile): axle_loc = axle_loc * Cq.Location.rot2d(-90 if bot else 90) loc_h = Cq.Location.from2d(radius, 0) loc_offset = axle_loc * Cq.Location.from2d(0, margin) + core_start = axle_loc * Cq.Location.rot2d(-angle_span) * Cq.Location.from2d(0, core_radius) + core_end = axle_loc * Cq.Location.rot2d(180) * Cq.Location.from2d(0, core_radius) start = axle_loc * loc_h mid = axle_loc * Cq.Location.rot2d(-sign * angle_span/2) * loc_h end = axle_loc * Cq.Location.rot2d(-sign * angle_span) * loc_h return ( Cq.Sketch() .segment( - loc_offset.to2d_pos(), + core_start.to2d_pos(), start.to2d_pos(), ) .arc( @@ -1407,11 +1410,15 @@ class WingR(WingProfile): ) .segment( end.to2d_pos(), + core_end.to2d_pos(), + ) + .segment( + core_start.to2d_pos(), axle_loc.to2d_pos(), ) .segment( axle_loc.to2d_pos(), - loc_offset.to2d_pos(), + core_end.to2d_pos(), ) .assemble() ) @@ -1425,6 +1432,7 @@ class WingR(WingProfile): profile = self._child_joint_extension_profile( axle_loc=self.wrist_axle_loc, radius=self.wrist_height, + core_radius=3, angle_span=self.wrist_joint.motion_span, bot=False, ) @@ -1435,24 +1443,26 @@ class WingR(WingProfile): """ Implements the blade part on Nue's wing """ - left_bot_loc = self.arrow_bot_loc * Cq.Location.rot2d(-1) + margin = 5 + blade_margin = 10 + + left_top_loc = self.wrist_axle_loc * Cq.Location.rot2d(-15) * Cq.Location.from2d(margin, 0) hole_bot_loc = self.arrow_bot_loc * Cq.Location.rot2d(self.blade_hole_angle) right_bot_loc = self.arrow_bot_loc * Cq.Location.rot2d(self.blade_angle) - h_loc = Cq.Location.from2d(0, self.arrow_height) # Law of sines, uses the triangle of (wrist_bot_loc, arrow_bot_loc, ?) theta_wp = math.radians(90 - self.blade_wrist_approx_tangent_angle) theta_b = math.radians(self.blade_angle) h_blade = math.sin(theta_wp) / math.sin(math.pi - theta_b - theta_wp) * self.arrow_height - h_blade_loc = Cq.Location.from2d(0, h_blade) + h_blade_loc = Cq.Location.from2d(0, h_blade + blade_margin) return ( Cq.Sketch() .segment( self.arrow_bot_loc.to2d_pos(), - (left_bot_loc * h_loc).to2d_pos(), + left_top_loc.to2d_pos(), ) .segment( - (self.arrow_bot_loc * h_loc).to2d_pos(), + self.wrist_axle_loc.to2d_pos(), ) .segment( (right_bot_loc * h_blade_loc).to2d_pos(),