cosplay: Touhou/Houjuu Nue #4

Open
aniva wants to merge 189 commits from touhou/houjuu-nue into main
1 changed files with 17 additions and 7 deletions
Showing only changes of commit 17001f87da - Show all commits

View File

@ -1380,6 +1380,7 @@ class WingR(WingProfile):
self, self,
axle_loc: Cq.Location, axle_loc: Cq.Location,
radius: float, radius: float,
core_radius: float,
angle_span: float, angle_span: float,
bot: bool = False) -> Cq.Sketch: bot: bool = False) -> Cq.Sketch:
""" """
@ -1391,13 +1392,15 @@ class WingR(WingProfile):
axle_loc = axle_loc * Cq.Location.rot2d(-90 if bot else 90) axle_loc = axle_loc * Cq.Location.rot2d(-90 if bot else 90)
loc_h = Cq.Location.from2d(radius, 0) loc_h = Cq.Location.from2d(radius, 0)
loc_offset = axle_loc * Cq.Location.from2d(0, margin) 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 start = axle_loc * loc_h
mid = axle_loc * Cq.Location.rot2d(-sign * angle_span/2) * 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 end = axle_loc * Cq.Location.rot2d(-sign * angle_span) * loc_h
return ( return (
Cq.Sketch() Cq.Sketch()
.segment( .segment(
loc_offset.to2d_pos(), core_start.to2d_pos(),
start.to2d_pos(), start.to2d_pos(),
) )
.arc( .arc(
@ -1407,11 +1410,15 @@ class WingR(WingProfile):
) )
.segment( .segment(
end.to2d_pos(), end.to2d_pos(),
core_end.to2d_pos(),
)
.segment(
core_start.to2d_pos(),
axle_loc.to2d_pos(), axle_loc.to2d_pos(),
) )
.segment( .segment(
axle_loc.to2d_pos(), axle_loc.to2d_pos(),
loc_offset.to2d_pos(), core_end.to2d_pos(),
) )
.assemble() .assemble()
) )
@ -1425,6 +1432,7 @@ class WingR(WingProfile):
profile = self._child_joint_extension_profile( profile = self._child_joint_extension_profile(
axle_loc=self.wrist_axle_loc, axle_loc=self.wrist_axle_loc,
radius=self.wrist_height, radius=self.wrist_height,
core_radius=3,
angle_span=self.wrist_joint.motion_span, angle_span=self.wrist_joint.motion_span,
bot=False, bot=False,
) )
@ -1435,24 +1443,26 @@ class WingR(WingProfile):
""" """
Implements the blade part on Nue's wing 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) 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) 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, ?) # 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_wp = math.radians(90 - self.blade_wrist_approx_tangent_angle)
theta_b = math.radians(self.blade_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 = 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 ( return (
Cq.Sketch() Cq.Sketch()
.segment( .segment(
self.arrow_bot_loc.to2d_pos(), self.arrow_bot_loc.to2d_pos(),
(left_bot_loc * h_loc).to2d_pos(), left_top_loc.to2d_pos(),
) )
.segment( .segment(
(self.arrow_bot_loc * h_loc).to2d_pos(), self.wrist_axle_loc.to2d_pos(),
) )
.segment( .segment(
(right_bot_loc * h_blade_loc).to2d_pos(), (right_bot_loc * h_blade_loc).to2d_pos(),