add logging and main function to fancymath

This commit is contained in:
2025-10-23 11:25:35 -05:00
parent a40a2ff442
commit bac8d74803
2 changed files with 43 additions and 1 deletions

View File

@@ -1,8 +1,11 @@
"""This module defines the Vector class. """
import logging
from math import acos, sqrt
logger = logging.getLogger(__name__)
class Vector(object):
def __init__(self, x, y, z):
"""Constructor method."""
@@ -12,6 +15,9 @@ class Vector(object):
def dot(self, v):
"""Returns the dot product with Vector *v*."""
if not isinstance(v, self.__class__):
logger.error(f"Expected an instance of {self.__class__}, but got {type(v)} instead.")
return None
d = self.x * v.x + self.y * v.y + self.z * v.z
return d