diff --git a/Ray.py b/Ray.py index e0f0345..6af0e3a 100644 --- a/Ray.py +++ b/Ray.py @@ -1,11 +1,10 @@ +#py -m pip install scipy numpy + from scipy.integrate import solve_ivp import math import numpy as np from scipy.constants import pi from scipy.interpolate import interp1d -from functools import cache -import copy -from PIL import Image class Ray(): @@ -98,8 +97,18 @@ class Ray(): x = self.x y = self.y - n = None - m = None + fovX = math.radians(self.fovX) + fovY = math.radians(self.fovY) - angle = math.degrees(math.atan2(math.sqrt(n**2 + m**2))) + maxX = math.tan(fovX / 2) + maxY = math.tan(fovY / 2) + + resX = self.res + resY = self.res * (maxY / maxX) + + n = (x / resX) * maxX + m = (y / resY) * maxY + + angle = math.degrees(math.atan(math.sqrt(n**2 + m**2))) + print(angle) return self.interpolation(angle)