cosplay: Touhou/Houjuu Nue #4

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

View File

@ -265,7 +265,7 @@ class TorsionJoint:
spring_thickness: float = 2 spring_thickness: float = 2
spring_height: float = 15 spring_height: float = 15
spring_tail_length: float = 40 spring_tail_length: float = 35
groove_radius_outer: float = 35 groove_radius_outer: float = 35
groove_radius_inner: float = 20 groove_radius_inner: float = 20
@ -314,15 +314,11 @@ class TorsionJoint:
l = self.spring_tail_length l = self.spring_tail_length
if self.right_handed: if self.right_handed:
r2 = -r2 r2 = -r2
# This is (0, r2) and (l, r2) transformed by right handed rotation
# matrix `[[c, -s], [s, c]]`
return [ return [
(0, 0, height), (-s * r2, c * r2, height),
(c, s, height) (c * l - s * r2, s * l + c * r2, height),
]
# This is (0, r2) and (l, r2) transformed by rotation matrix
# [[c, s], [-s, c]]
return [
(s * r2, -s * l + c * r2, height),
(c * l + s * r2, -s * l + c * r2, height),
] ]

View File

@ -27,6 +27,8 @@ class TestJoints(unittest.TestCase):
assembly = joint.rider_track_assembly(slot) assembly = joint.rider_track_assembly(slot)
bbox = assembly.toCompound().BoundingBox() bbox = assembly.toCompound().BoundingBox()
self.assertAlmostEqual(bbox.zlen, joint.total_height) self.assertAlmostEqual(bbox.zlen, joint.total_height)
self.assertAlmostEqual(bbox.xlen, joint.radius * 2)
self.assertAlmostEqual(bbox.ylen, joint.radius * 2)
self.assertEqual(pairwise_intersection(assembly), []) self.assertEqual(pairwise_intersection(assembly), [])
def test_torsion_joint(self): def test_torsion_joint(self):