class Vector4d: def __init__(self, x, y, z, w): self.x = x self.y = y self.z = z self.w = w class Vector3d: def __init__(self, x, y, z): self.x = x self.y = y self.z = z def cross_product(self, vector3d): # Returns a line that is perpendicular to the parameter # and self. # Returns the 'normal'. x = self.y * vector3d.z - self.z * vector3d.y y = self.z * vector3d.x - self.x * vector3d.z z = self.x * vector3d.y - self.y * vector3d.x return Vector3d(x, y, z) def dot_product(self, vector3d): # Returns a scalar that defines how similar two # vectors are to one another. return self.x * vector3d.x + self.y * vector3d.y + self.z * vector3d.z class Vector2d: def __init__(self, x, y): self.x = x self.y = y