2011-02-02 09:56:20 -08:00
|
|
|
from interp.baker import get_phis
|
2010-03-18 22:32:24 -07:00
|
|
|
|
2010-03-20 19:09:46 -07:00
|
|
|
TOL = 1e-8
|
2010-03-20 16:10:02 -07:00
|
|
|
|
|
|
|
def contains(X, R):
|
2010-03-20 19:09:46 -07:00
|
|
|
"""
|
2011-03-23 10:23:32 -07:00
|
|
|
tests if X (point) is in R
|
|
|
|
|
|
|
|
R is a simplex, represented by a list of n-degree coordinates
|
2010-04-29 22:29:35 -07:00
|
|
|
|
2010-10-23 16:06:57 -07:00
|
|
|
it now correctly checks for 2/3-D verts
|
2011-02-02 09:56:20 -08:00
|
|
|
|
|
|
|
TODO: write unit test ...
|
2010-03-20 19:09:46 -07:00
|
|
|
"""
|
2011-02-02 09:56:20 -08:00
|
|
|
phis = get_phis(X, R)
|
2010-04-29 22:29:35 -07:00
|
|
|
|
2010-03-20 19:09:46 -07:00
|
|
|
r = True
|
|
|
|
if [i for i in phis if i < 0.0 - TOL]:
|
|
|
|
r = False
|
|
|
|
return r
|