Next, we overload the multiplication operation in the class to define how multiplication between quaternions occurs:
def_mul_(self, other: Quaternion) :
$\mathrm{v} 1=$ pygame.Vector3(self.x, self.y, self.z)
$\mathrm{v} 2$ = pygame.Vector3 (other.x, other.y, other.z)
$\operatorname{cross}=\mathrm{v} 1 \cdot \operatorname{cross}(\mathrm{v} 2)$
$\operatorname{dot}=\mathrm{v} 1 \cdot \operatorname{dot}(\mathrm{v} 2)$
$\mathrm{v} 3=$ cross $+($ self.w * $\mathrm{v} 2)+($ other.w * v1)
result $=$ Quaternion (vector $=($ self $\cdot w$ *
other.w - dot,
v3.x, v3.y, v3.z))
return result