def getCellsForCube(self, typeString, container): x = int(typeString) cells = {} index = 1 for k in range(6): if k == 0: normal = Vector(1, 0, 0) up = Vector(0, 0, 1) elif k == 1: normal = Vector(0, 1, 0) up = Vector(0, 0, 1) elif k == 2: normal = Vector(0, 0, 1) up = Vector(1, 0, 0) elif k == 3: normal = Vector(-1, 0, 0) up = Vector(0, 0, 1) elif k == 4: normal = Vector(0, -1, 0) up = Vector(0, 0, 1) elif k == 5: normal = Vector(0, 0, -1) up = Vector(1, 0, 0) right = normal.cross(up).unit() for j in range(x): for i in range(x): position = Locus(0,0,0).translateByVector(normal.scalarMultiply(x)).translateByVector(up.scalarMultiply(x - 1 - (2 * j))).translateByVector(right.scalarMultiply(x - 1 - (2 * i))) neighborJunctions = [] neighborJunctions.append(position.translateByVector(right)) neighborJunctions.append(position.translateByVector(right.scalarMultiply(-1))) neighborJunctions.append(position.translateByVector(up)) neighborJunctions.append(position.translateByVector(up.scalarMultiply(-1))) cells[index] = Cell(index, position, normal, up, [1,1,1,1], neighborJunctions, 4, container) index += 1 self.cells = cells self.generateNeighbors()