def type_vect_5D(self, node): out = vect_5D() # This is weird, but it works. temp = [self.Get(node, 'x'), self.Get(node, 'y'), self.Get(node, 'z'), self.Get(node, 'rate'), self.Get(node, 'course')] for i in range(len(temp)): if temp[i] == '': temp[i] = 0.0 out.x = temp[0] out.y = temp[1] out.z = temp[2] out.course = temp[3] out.rate = temp[4] return out
def RandomPointInside(self, N = 1): ''' Return a/a list of random points that are inside the polygon. ''' mybox = self.BoundingBox() dx = mybox[2]-mybox[0] dy = mybox[3]-mybox[1] out = [] while len(out) < N: temp = vect_5D(mybox[0]+random()*dx,mybox[1]+random()*dy) if self.PointInside(temp): out.append(temp) if N == 1: return out[0] return out
def RandomPointInside(self, N=1): ''' Return a/a list of random points that are inside the polygon. ''' mybox = self.BoundingBox() dx = mybox[2] - mybox[0] dy = mybox[3] - mybox[1] out = [] while len(out) < N: temp = vect_5D(mybox[0] + random() * dx, mybox[1] + random() * dy) if self.PointInside(temp): out.append(temp) if N == 1: return out[0] return out
def type_vect_5D(self, node): out = vect_5D() # This is weird, but it works. temp = [ self.Get(node, 'x'), self.Get(node, 'y'), self.Get(node, 'z'), self.Get(node, 'rate'), self.Get(node, 'course') ] for i in range(len(temp)): if temp[i] == '': temp[i] = 0.0 out.x = temp[0] out.y = temp[1] out.z = temp[2] out.course = temp[3] out.rate = temp[4] return out