def test_applyTorsion02(self): """applyTorsion -- apply torsions in any order""" ko1 = Kinematics(self.known_points, self.torTree, tolist=0) ko1.applyTorsion(ko1.torsions[0], 90.) result1 = ko1.applyTorsion(ko1.torsions[1], -90.) ko2 = Kinematics(self.known_points, self.torTree, tolist=0) ko2.applyTorsion(ko2.torsions[1], -90.) result2 = ko2.applyTorsion(ko2.torsions[0], 90.) self.assertArrayEqual(result1, result2)
def test_applyAngList04(self): """applyAngList -- one-at-time equals all-at-once""" ko1 = Kinematics(self.known_points, self.torTree, tolist=0) ko2 = Kinematics(self.known_points, self.torTree, tolist=0) result1 = ko1.applyAngList([90., -90., 0.], self.idmtx)[:, :3] # do the rotations separately ko2.applyAngList([90., 0., 0.]) result2 = ko2.applyAngList([0., -90., 0.], self.idmtx)[:, :3] self.assertArrayEqual(result1, result2)
def test_applyTorsion02(self): """applyTorsion -- return correct coords torsion=1, angle=90.""" ko = Kinematics(self.known_points, self.torTree, tolist=0) result = ko.applyTorsion(ko.torsions[1], 90.)[:, :3] self.known_points[0] = [1., -1., 1.] self.known_points[2] = [1., 0., 2.] self.assertArrayEqual(self.known_points, result)
def test_applyAngList022(self): """applyAngList -- return correct coords ( 0,-90, 0)""" ko = Kinematics(self.known_points, self.torTree, tolist=0) result = ko.applyAngList([0., -90., 0.], self.idmtx)[:, :3] self.known_points[0] = [1., 1., 1.] self.known_points[2] = [1., 0., 0.] self.assertArrayEqual(self.known_points, result)
def test_applyTorsion01(self): """applyTorsion -- return correct coords torsion=0, angle=0.""" ko = Kinematics(self.known_points, self.torTree, tolist=1) self.assertEqual(self.known_points, ko.applyTorsion(ko.torsions[0], 0.))
def test_applyAngList05(self): """applyAngList -- ValueError if len(angList) != len(torsions)""" ko = Kinematics(self.known_points, self.torTree, tolist=1) self.assertRaises(ValueError, ko.applyAngList, ([0, 0], self.idmtx))
def test_applyAngList01(self): """applyAngList -- return correct coords (360., 360., 360.)""" ko = Kinematics(self.known_points, self.torTree, tolist=0) result = ko.applyAngList([360., 360., 360.], self.idmtx)[:, :3] self.assertArrayEqual(self.known_points, result)
def test_applyAngList00(self): """applyAngList -- return correct coords (0., 0., 0.)""" ko = Kinematics(self.known_points, self.torTree, tolist=1) self.assertEqual(self.known_points, ko.applyAngList([0, 0, 0], self.idmtx))