def genRandomPoint(self): """Returns random coordinate inside domain. :returns: array -- coordinate """ xmin,xmax,ymin,ymax=self.getExtend() poly=self.verticesCoordsToList() outside=True while outside: xrand=(xmax - xmin) * np.random.random() + xmin yrand=(ymax - ymin) * np.random.random() + ymin if self.typ=='poly': if rwe.checkInsidePoly([xrand,yrand],poly): return np.array([xrand,yrand]) if self.typ=='circle': if rwe.checkInsideCircle([xrand,yrand],self.edges[0].vcenter.x,0.999*self.edges[0].radius,tol=0.)<0: return np.array([xrand,yrand]) else: print "Warning, can not generate random points for geometry of typ = ", self.typ return False,False
def genRandomPoint(self): """Returns random coordinate inside domain. :returns: array -- coordinate """ xmin, xmax, ymin, ymax = self.getExtend() poly = self.verticesCoordsToList() outside = True while outside: xrand = (xmax - xmin) * np.random.random() + xmin yrand = (ymax - ymin) * np.random.random() + ymin if self.typ == 'poly': if rwe.checkInsidePoly([xrand, yrand], poly): return np.array([xrand, yrand]) if self.typ == 'circle': if rwe.checkInsideCircle([xrand, yrand], self.edges[0].vcenter.x, 0.999 * self.edges[0].radius, tol=0.) < 0: return np.array([xrand, yrand]) else: print "Warning, can not generate random points for geometry of typ = ", self.typ return False, False
def circCheck(self, x, center, radius, tol=1E-30, debug=False): return rwe.checkInsideCircle(x, center, radius, tol=tol, debug=debug)
def circCheck(self,x,center,radius,tol=1E-30,debug=False): return rwe.checkInsideCircle(x,center,radius,tol=tol,debug=debug)