Changeset 6538
 Timestamp:
 Mar 18, 2009, 8:50:58 AM (14 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

anuga_core/source/anuga/fit_interpolate/test_search_functions.py
r6536 r6538 5 5 from search_functions import search_tree_of_vertices, set_last_triangle 6 6 from search_functions import _search_triangles_of_vertices 7 from search_functions import find_triangle_compute_interpolation 7 8 8 9 from anuga.abstract_2d_finite_volumes.neighbour_mesh import Mesh … … 10 11 from anuga.utilities.polygon import is_inside_polygon 11 12 from anuga.utilities.quad import build_quadtree, Cell 12 13 from anuga.utilities.polygon import is_inside_polygon, is_inside_triangle 14 15 import Numeric as num 13 16 14 17 class Test_search_functions(unittest.TestCase): … … 207 210 assert k == 1 208 211 212 213 def test_triangle_compute_interpolation(self): 214 """test_triangle_compute_interpolation 215 216 Test that triangle can be found if point is inside it 217 """ 218 219 triangle = num.array([[306951.77151059, 6194462.14596986], 220 [306952.58403545, 6194459.65001246], 221 [306953.55109034, 6194462.0041216]]) 222 223 224 n0 = [0.92499377, 0.37998227] 225 n1 = [0.07945684, 0.99683831] 226 n2 = [0.95088404, 0.30954732] 227 228 x = [306953.344, 6194461.5] 229 230 # Test that point is indeed inside triangle 231 assert is_inside_polygon(x, triangle, 232 closed=True, verbose=False) 233 assert is_inside_triangle(x, triangle, 234 closed=True, verbose=False) 235 236 element_found, sigma0, sigma1, sigma2 = \ 237 find_triangle_compute_interpolation(triangle, n0, n1, n2, x) 238 239 msg = 'Point which is clearly inside triangle was not found' 240 assert element_found is True, msg 209 241 210 242 #
Note: See TracChangeset
for help on using the changeset viewer.