Created
May 24, 2013 05:35
-
-
Save alejandroave/5641466 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from mpl_toolkits.mplot3d import Axes3D | |
import matplotlib.pyplot as plt | |
import random | |
class Baliada():##nodos principales | |
def __init__(self, posx,posy,posz,ran): | |
self.posx = posx ## pos x | |
self.posy = posy ## pos y | |
self.posz = posz ## pos z | |
self.ran = ran ## rango | |
self.cond = 0 ##saber si fue avisado | |
self.ttl = 0 ##ttl actual del nodo | |
##función para sacar si se encuentra dentro del rango | |
def calcud(x1,x2,y1,y2,z1,z2,lim): | |
d = (abs(x1-x2)**2 + abs(y1-y2)**2 + abs(z1-z2)**2)**0.5 | |
if d < lim: | |
return 1 | |
else: | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment