Compare commits

..

No commits in common. "380b9f96a4cf954395898411036f3643efe71544" and "d8347758357298b9d1d0c1a3a4bdcb3512ff8255" have entirely different histories.

2 changed files with 6 additions and 18 deletions

View File

@ -1,8 +1,4 @@
try:
from numpy import complex256
except ImportError:
from numpy import complex128 as complex256
def ZeroCheck(cN):
if cN == complex256(complex(0,0)):
return complex256(complex(1,0))

18
main.py
View File

@ -1,10 +1,6 @@
#!/usr/bin/env python3
try:
from numpy import complex256
except ImportError:
from numpy import complex128 as complex256
print("Warning! Cannot use full precision!")
from numpy import complex256
from time import time_ns, sleep
from cmath import exp, pi
import pygame
@ -60,7 +56,7 @@ def draw(level,gPlayer,fov,res):
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:
@ -102,8 +98,6 @@ def mainLoop():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
gPlayer.cRot *= -1
if event.key == pygame.K_F3:
debugInfo = not debugInfo
keys = pygame.key.get_pressed()
if keys[pygame.K_d]:
gPlayer.rotate(ROT)
@ -113,6 +107,8 @@ def mainLoop():
gPlayer -= GyroVector(OFFSET * gPlayer.cRot, 1)
if keys[pygame.K_s]:
gPlayer += GyroVector(OFFSET * gPlayer.cRot, 1)
if keys[pygame.K_F3]:
debugInfo = not debugInfo
display.fill(WHITE)
#pygame.draw.rect(display,BLACK, c_tr(Poincare2Klein(gPlayer.cPos) * -100) + (100,100),0)
@ -121,7 +117,7 @@ def mainLoop():
pygame.draw.rect(display,GROUND, (0,360,1280,360))
n = 0
for i in drawn:
pygame.draw.rect(display,i.color, (n,(1 - i.height) * 360,8,cap(i.height) * 1280))
pygame.draw.rect(display,i.color, (n,360 - (cap(i.height) * 360),10,cap(i.height) * 1000))
n += 8
if debugInfo:
@ -130,10 +126,6 @@ def mainLoop():
display.blit(fps_surf, (0, 0))
display.blit(cPos_surf, (0, fps_surf.get_height()))
display.blit(cRot_surf, (0, fps_surf.get_height() + fontSize))
for i in level:
a = complex(Poincare2Klein(MobiusAdd(i.pointA,-gPlayer.cPos)))
b = complex(Poincare2Klein(MobiusAdd(i.pointB,-gPlayer.cPos)))
pygame.draw.line(display, WHITE, (a.real * 100 + 100, (a.imag * 100 + 200)), (b.real * 100 + 100, (b.imag * 100 + 200)))
pygame.display.update()