예제 #1
0
def PosCasaMaisProxima(rato):
    minDist = 1.18973149536e+4932
    posCasa = Ponto(0, 0)

    for casa in casas:
        dist = math.hypot(casa.x - rato.x, casa.y - rato.y)
        if (dist < minDist):
            minDist = dist
            posCasa.x = casa.x
            posCasa.y = casa.y

    return posCasa
예제 #2
0
def PosRatoMaisProximo():
    minDist = 1.18973149536e+4932
    posRato = Ponto(0, 0)

    for rato in ratos:
        dist = math.hypot(rato.x - gato.x, rato.y - gato.y)
        if (dist < minDist):
            minDist = dist
            posRato.x = rato.x
            posRato.y = rato.y

    return posRato