fix: Torsion joint directrix

This commit is contained in:
Leni Aniva 2024-07-07 09:44:54 -07:00
parent dc6e2a8933
commit fc0edd995b
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
2 changed files with 7 additions and 9 deletions

View File

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