Ignore:
Timestamp:
Mar 17, 2009, 11:14:17 PM (14 years ago)
Author:
ole
Message:

Added first step in dealing with ticket:314 - a different way of
assessing whether a point is inside a triangle. Next step is to remove
all the now unnecessary epsilon tests in search_functions.py.

Tests using the Okushiri fitting example revealed that this approach is
over 30% faster.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/fit_interpolate/search_functions.py

    r6174 r6536  
    88import time
    99
     10from anuga.utilities.polygon import is_inside_triangle
    1011from anuga.utilities.numerical_tools import get_machine_precision
    1112from anuga.config import max_float
     
    145146    for k, tri_verts_norms in triangles:
    146147        tri = tri_verts_norms[0]
    147         n0, n1, n2 = tri_verts_norms[1]
     148
    148149        # k is the triangle index
    149150        # tri is a list of verts (x, y), representing a tringle
    150151        # Find triangle that contains x (if any) and interpolate
    151         element_found, sigma0, sigma1, sigma2 =\
    152                        find_triangle_compute_interpolation(tri, n0, n1, n2, x)
     152        if is_inside_triangle(x, tri, closed=True):
     153            n0, n1, n2 = tri_verts_norms[1]       
     154            element_found, sigma0, sigma1, sigma2 =\
     155                find_triangle_compute_interpolation(tri, n0, n1, n2, x)
     156        else:
     157            element_found = False
     158
     159           
    153160        if element_found is True:
    154161            # Don't look for any other triangles in the triangle list
Note: See TracChangeset for help on using the changeset viewer.