42 lines
816 B
Python
42 lines
816 B
Python
from baker import get_phis
|
|
|
|
TOL = 1e-3
|
|
|
|
def contains(X, R):
|
|
phis = get_phis(X, R)
|
|
r = True
|
|
if [i for i in phis if i < 0.0 - TOL]:
|
|
r = False
|
|
return r
|
|
|
|
|
|
class face(object):
|
|
def __init__(self, name):
|
|
self.name = name
|
|
self.verts = []
|
|
self.neighbors = []
|
|
|
|
def add_vert(self, v):
|
|
"""
|
|
v should be an index into grid.points
|
|
"""
|
|
self.verts.append(v)
|
|
|
|
def add_neighbor(self, n):
|
|
"""
|
|
reference to another face object
|
|
"""
|
|
self.neighbors.append(n)
|
|
|
|
def contains(self, X, grid):
|
|
return contains(X, grid.points)
|
|
|
|
def __str__(self):
|
|
neighbors = [i.name for i in self.neighbors]
|
|
return '%s: verts: %s neighbors: [%s]' %\
|
|
(
|
|
self.name,
|
|
self.verts,
|
|
", ".join(neighbors)
|
|
)
|