diff --git a/nhf/parts/joints.py b/nhf/parts/joints.py index 0a4b47a..2ebb543 100644 --- a/nhf/parts/joints.py +++ b/nhf/parts/joints.py @@ -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), ] diff --git a/nhf/parts/test.py b/nhf/parts/test.py index 0610f8f..bb05e20 100644 --- a/nhf/parts/test.py +++ b/nhf/parts/test.py @@ -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):