我这里2000个点都没到10秒。估计我内存和CPU比你好点的原因
改了下代码。现在少了一个没必要的步骤
- import random
- import Rhino.Geometry as rg
- def ptRange(pt01,pt02):
- xB = random.uniform(pt01[0],pt02[0])
- yB = random.uniform(pt01[1],pt02[1])
- zB = random.uniform(pt01[2],pt02[2])
- return rg.Point3d(xB,yB,zB)
- box = geo_brep.GetBoundingBox(True)
- a = []
- while (len(a)<= randomPtsNum):
- pt = ptRange(box.Min,box.Max)
- if geo_brep.IsPointInside(pt,0.0001,True):
- a.append(pt)
复制代码
|