moved the qhull generator into the base grid class
This commit is contained in:
parent
b83dd04e14
commit
e856851f1e
@ -8,26 +8,6 @@ class grid(basegrid):
|
|||||||
def __init__(self, verts, q):
|
def __init__(self, verts, q):
|
||||||
basegrid.__init__(self, verts, q)
|
basegrid.__init__(self, verts, q)
|
||||||
|
|
||||||
def for_qhull_generator(self):
|
|
||||||
"""
|
|
||||||
this returns a generator that should be fed into qdelaunay
|
|
||||||
"""
|
|
||||||
|
|
||||||
yield '3';
|
|
||||||
yield '%d' % len(self.verts)
|
|
||||||
|
|
||||||
for p in self.verts:
|
|
||||||
yield "%f %f %f" % tuple(p)
|
|
||||||
|
|
||||||
def for_qhull(self):
|
|
||||||
"""
|
|
||||||
this returns a single string that should be fed into qdelaunay
|
|
||||||
"""
|
|
||||||
r = '3\n'
|
|
||||||
r += '%d\n' % len(self.verts)
|
|
||||||
for p in self.verts:
|
|
||||||
r += "%f %f %f\n" % tuple(p)
|
|
||||||
return r
|
|
||||||
|
|
||||||
class rect_grid(grid):
|
class rect_grid(grid):
|
||||||
def __init__(self, xres = 5, yres = 5, zres = 5):
|
def __init__(self, xres = 5, yres = 5, zres = 5):
|
||||||
@ -60,26 +40,7 @@ class rect_grid(grid):
|
|||||||
grid.__init__(self, verts, q)
|
grid.__init__(self, verts, q)
|
||||||
# self.construct_connectivity()
|
# self.construct_connectivity()
|
||||||
|
|
||||||
def for_qhull_generator(self):
|
|
||||||
"""
|
|
||||||
this returns a generator that should be fed into qdelaunay
|
|
||||||
"""
|
|
||||||
|
|
||||||
yield '3';
|
|
||||||
yield '%d' % len(self.verts)
|
|
||||||
|
|
||||||
for p in self.verts:
|
|
||||||
yield "%f %f %f" % tuple(p)
|
|
||||||
|
|
||||||
def for_qhull(self):
|
|
||||||
"""
|
|
||||||
this returns a single string that should be fed into qdelaunay
|
|
||||||
"""
|
|
||||||
r = '3\n'
|
|
||||||
r += '%d\n' % len(self.verts)
|
|
||||||
for p in self.verts:
|
|
||||||
r += "%f %f %f\n" % tuple(p)
|
|
||||||
return r
|
|
||||||
|
|
||||||
class random_grid(rect_grid):
|
class random_grid(rect_grid):
|
||||||
def __init__(self, num_verts = 10):
|
def __init__(self, num_verts = 10):
|
||||||
|
@ -135,6 +135,27 @@ class grid(object):
|
|||||||
answer = run_baker(X, R, S, order)
|
answer = run_baker(X, R, S, order)
|
||||||
return answer
|
return answer
|
||||||
|
|
||||||
|
def for_qhull_generator(self):
|
||||||
|
"""
|
||||||
|
this returns a generator that should be fed into qdelaunay
|
||||||
|
"""
|
||||||
|
|
||||||
|
yield '3';
|
||||||
|
yield '%d' % len(self.verts)
|
||||||
|
|
||||||
|
for p in self.verts:
|
||||||
|
yield "%f %f %f" % tuple(p)
|
||||||
|
|
||||||
|
def for_qhull(self):
|
||||||
|
"""
|
||||||
|
this returns a single string that should be fed into qdelaunay
|
||||||
|
"""
|
||||||
|
r = '3\n'
|
||||||
|
r += '%d\n' % len(self.verts)
|
||||||
|
for p in self.verts:
|
||||||
|
r += "%f %f %f\n" % tuple(p)
|
||||||
|
return r
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
r = ''
|
r = ''
|
||||||
assert( len(self.verts) == len(self.q) )
|
assert( len(self.verts) == len(self.q) )
|
||||||
|
Loading…
Reference in New Issue
Block a user