Answers
Exercise A.
def get_position(self):
position = pygame.Vector3(self.MVM[0, 3],
self.MVM[1, 3],
self.MVM[2, 3])
return position
def get_scale(self):
sx = pygame.Vector3(self.MVM[0, 0], self.MVM[1, 0],
self.MVM[2, 0])
sy = pygame.Vector3(self.MVM[0, 1], self.MVM[1, 1],
self.MVM[2, 1])
sz = pygame.Vector3(self.MVM[0, 2], self.MVM[1, 2],
self.MVM[2, 2])
return pygame.Vector3(sx.magnitude(), sy.magnitude(),
sz.magnitude())
def get_rotation(self):
scale = self.get_scale()
rotation = np.identity(4)
rotation[0, 0] = self.MVM[0, 0] / scale.x
rotation[0, 1] = self.MVM[0, 1] / scale.x
rotation[0, 2] = self.MVM[0, 2] / scale.x
rotation[1, 0] = self.MVM[1, 0] / scale.y
rotation[1, 1] = self.MVM[1, 1] / scale.y
rotation[1, 2] = self.MVM[1, 2] / scale.y
rotation[2, 0...