Exemple #1
0
    def __initialize(self):
        s = self.sch[0] / self.peg.getRadiusOfCurvature()
        c = self.sch[1] / self.peg.getRadiusOfCurvature()

        schxyzp = [[0 for i in range(3)] for j in range(3)]
        schxyzp[0][0] = -math.sin(s)
        schxyzp[0][1] = -math.sin(c) * math.cos(s)
        schxyzp[0][1] = math.cos(s) * math.cos(c)
        schxyzp[1][0] = math.cos(s)
        schxyzp[1][1] = -math.sin(c) * math.sin(s)
        schxyzp[1][2] = math.sin(s) * math.cos(c)
        schxyzp[2][0] = 0.0
        schxyzp[2][1] = math.cos(c)
        schxyzp[2][2] = math.sin(c)

        self.sch2xyz = MM.multiplyMatrices(self.M, schxyzp)
        self.xyz2sch = MM.matrixTranspose(self.sch2xyz)
 def testMultiplyMatrices(self):
     ans = [[6, 12, 18], [15, 30, 45], [24, 48, 72]]
     mM = MM.multiplyMatrices(self.M, self.N)
     for i in range(3):
         for j in range(3):
             self.assertAlmostEquals(mM[i][j], ans[i][j], 5)