Skip to content

Instantly share code, notes, and snippets.

@alejandroave
Created May 24, 2013 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alejandroave/5641466 to your computer and use it in GitHub Desktop.
Save alejandroave/5641466 to your computer and use it in GitHub Desktop.
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