This commit is contained in:
2024-12-08 20:39:19 +01:00
parent 689cd30393
commit 033c1b3b46

View File

@@ -30,15 +30,15 @@ def isinGrid(pos,maxPos):
return 0 <= pos[0] < maxPos[0] and 0 <= pos[1] < maxPos[1]
def calcAntiNodes(posAntA, posAntB,maxPos):
AX = posAntA[0]
BX = posAntB[0]
AY = posAntA[1]
BY = posAntB[1]
CX = AX + (AX-BX)
CY = AY + (AY-BY)
X1 = posAntA[0]
X2 = posAntB[0]
Y1 = posAntA[1]
Y2 = posAntB[1]
X3 = X1 + (X1-X2)
Y3 = Y1 + (Y1-Y2)
if isinGrid ((CX,CY),maxPos):
return (CX,CY)
if isinGrid ((X3,Y3),maxPos):
return (X3,Y3)
return (-1,-1)
def findAntiNodesA(maxPos,posAntennes):