Make a separate function for properly determining whether a Poincare point is between two other points.
This commit is contained in:
parent
457f0b9fa0
commit
b5eb207d38
5
draw.py
5
draw.py
@ -1,8 +1,7 @@
|
|||||||
from cmath import exp
|
from cmath import exp
|
||||||
|
|
||||||
from constants import I, BLACK
|
from constants import I, BLACK
|
||||||
from gyro import MobiusInt, MobiusAdd, MobiusDist, cDot, Poincare2Klein
|
from gyro import MobiusInt, MobiusAdd, MobiusBetween, MobiusDist, cDot, Poincare2Klein
|
||||||
from lines import cBetween
|
|
||||||
|
|
||||||
from numba import jit, byte, double, prange, optional
|
from numba import jit, byte, double, prange, optional
|
||||||
from numba.types import UniTuple
|
from numba.types import UniTuple
|
||||||
@ -38,7 +37,7 @@ def draw(level,gPlayer,fov,res,dscale):
|
|||||||
if cDot(rot,MobiusAdd(cInt,-gPlayer.cPos)) > 0:
|
if cDot(rot,MobiusAdd(cInt,-gPlayer.cPos)) > 0:
|
||||||
continue
|
continue
|
||||||
rDist = MobiusDist(cInt,gPlayer.cPos) * dscale
|
rDist = MobiusDist(cInt,gPlayer.cPos) * dscale
|
||||||
if j.isFinite and not cBetween(Poincare2Klein(j.pointA),Poincare2Klein(j.pointB),Poincare2Klein(cInt)):
|
if j.isFinite and not MobiusBetween(j.pointA,j.pointB,cInt):
|
||||||
continue
|
continue
|
||||||
if m is None:
|
if m is None:
|
||||||
m = DrawnSegment(rDist,j.color)
|
m = DrawnSegment(rDist,j.color)
|
||||||
|
6
gyro.py
6
gyro.py
@ -2,7 +2,7 @@ from numba import jit, c16
|
|||||||
from numba.experimental import jitclass
|
from numba.experimental import jitclass
|
||||||
from cmath import sqrt
|
from cmath import sqrt
|
||||||
from math import tanh, atanh, pi
|
from math import tanh, atanh, pi
|
||||||
from lines import cLineIntersection
|
from lines import cLineIntersection, cBetween
|
||||||
|
|
||||||
def deg2rad(rA): return rA/180*pi
|
def deg2rad(rA): return rA/180*pi
|
||||||
def rad2degd(rA): return rA*180/pi
|
def rad2degd(rA): return rA*180/pi
|
||||||
@ -39,6 +39,10 @@ def cDist(cA, cB):
|
|||||||
def MobiusInt(cA,cB,cC,cD): # Bruh
|
def MobiusInt(cA,cB,cC,cD): # Bruh
|
||||||
return Klein2Poincare(cLineIntersection(Poincare2Klein(cA),Poincare2Klein(cB),Poincare2Klein(cC),Poincare2Klein(cD)))
|
return Klein2Poincare(cLineIntersection(Poincare2Klein(cA),Poincare2Klein(cB),Poincare2Klein(cC),Poincare2Klein(cD)))
|
||||||
|
|
||||||
|
@jit(cache=True)
|
||||||
|
def MobiusBetween(cA,cB,cN):
|
||||||
|
return cBetween(Poincare2Klein(cA),Poincare2Klein(cB),Poincare2Klein(cN))
|
||||||
|
|
||||||
@jit(cache=True)
|
@jit(cache=True)
|
||||||
def MobiusAdd(cA, cB):
|
def MobiusAdd(cA, cB):
|
||||||
return (cA + cB) / (1 + cA.conjugate() * cB)
|
return (cA + cB) / (1 + cA.conjugate() * cB)
|
||||||
|
Loading…
Reference in New Issue
Block a user