Answers
Exercise A:
normalize(Quaternion q)
length = sqrt( pow(w,2) + pow(x,2) + pow(y,2) + pow(z,2))
q.w /= length
q.x /= length
q.y /= length
q.z /= length
Exercise B:
def rotate_with_mouse(self, yaw, pitch):
right = pygame.Vector3(1, 0, 0)
up = pygame.Vector3(1, 0, 0)
y_rot = Quaternion(axis=up, angle=self.mouse_invert * yaw *
self.mouse_sensitivityY)
x_rot = Quaternion(axis=right,
angle=self.mouse_invert * pitch *
self.mouse_sensitivityX)
m_rot = x_rot * y_rot
self.transform...