From a0a33254e36f4e61b7b736cb6884e7951e70e35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?b=CA=B0edoh=E2=82=82=20sw=C3=A9?= Date: Wed, 3 Apr 2024 18:06:28 +0500 Subject: [PATCH] A commit. --- gyro.py | 10 +++++----- main.py | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/gyro.py b/gyro.py index e58de0e..95fabed 100644 --- a/gyro.py +++ b/gyro.py @@ -1,7 +1,7 @@ -from numpy import complex128 +from numpy import complex256 def ZeroCheck(cN): - if cN == complex128(complex(0,0)): - return complex128(complex(1,0)) + if cN == complex256(complex(0,0)): + return complex256(complex(1,0)) else: return cN @@ -31,8 +31,8 @@ def Poincare2Klein(cN): class GyroVector: def __init__(self, cPos, cRot): - self.cPos = complex128(cPos) - self.cRot = complex128(cRot) + self.cPos = complex256(cPos) + self.cRot = complex256(cRot) self.normalize() def __add__(gA, gB): diff --git a/main.py b/main.py index 24e8f25..5939f13 100755 --- a/main.py +++ b/main.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -from numpy import complex128 +from numpy import complex256 from time import time_ns, sleep from cmath import exp, pi import pygame @@ -11,7 +11,7 @@ from lines import * def deg2rad(rA): return rA/180*PI -I = complex128(complex(0,1)) +I = complex256(complex(0,1)) WHITE = (255,255,255) BLACK = (0,0,0) OFFSET = 0.015625 @@ -37,10 +37,10 @@ class DrawnSegment: self.color = color level = [ - Segment(False,.6,I*.6,(255,0,0)), - Segment(False,.6,-I*.6,(0,255,0)), - Segment(False,-.6,-I*.6,(0,0,255)), - Segment(False,-.6,I*.6,(255,255,0)) + Segment(True,.6,I*.6,(255,0,0)), + Segment(True,.6,-I*.6,(0,255,0)), + Segment(True,-.6,-I*.6,(0,0,255)), + Segment(True,-.6,I*.6,(255,255,0)) ] def draw(level,gPlayer,fov,res): @@ -54,10 +54,12 @@ def draw(level,gPlayer,fov,res): tA = Poincare2Klein(MobiusAdd(j.pointA,-gPlayer.cPos)) tB = Poincare2Klein(MobiusAdd(j.pointB,-gPlayer.cPos)) try: # This function faults from time to time - cInt = cLineIntersection(tA,tB,complex128(0),rot) + cInt = cLineIntersection(tA,tB,complex256(0),rot) except ZeroDivisionError: continue - rDist = cDist(0,cInt) * irot.real + rDist = cDist(0,cInt) + if not (j.isFinite and cBetween(tA,tB,cInt)): + continue if cDot(cInt,rot) > 0: continue if (1 - m.height) > rDist: