fix: Torsion joint directrix
This commit is contained in:
parent
dc6e2a8933
commit
fc0edd995b
|
@ -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),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue