From 437be17f51b8bc7fbf9e79cceff3769e98ac04de Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Fri, 24 Oct 2025 16:21:50 +0100 Subject: [PATCH] Add cross product impleimentation --- src/fancymath/vector.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/fancymath/vector.py b/src/fancymath/vector.py index 6c10466..c027e5b 100644 --- a/src/fancymath/vector.py +++ b/src/fancymath/vector.py @@ -36,6 +36,14 @@ class Vector(object): z = self.z + other.z return self.__class__(x, y, z) + def __mul__(self, other): + if not isinstance(other, Vector): + return NotImplemented + x = self.y * other.z - self.z * other.y + y = self.z * other.x - self.x * other.z + z = self.x * other.y - self.y * other.x + return self.__class__(x, y, z) + if __name__ == "__main__": v1 = Vector(3, 4, 0)