Changeset 8037


Ignore:
Timestamp:
Oct 15, 2010, 5:16:59 PM (12 years ago)
Author:
habili
Message:

added polyline_overlap routines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/geometry/polygon.py

    r8031 r8037  
    257257    return indices[count:]   
    258258
     259def polyline_overlap(triangles, polyline, verbose=False):
     260    """Determine if a polygon and triangle overlap
     261
     262    """
     263    polyline = ensure_numeric(polyline)
     264    triangles = ensure_numeric(triangles)
     265   
     266    M = triangles.shape[0]/3  # Number of triangles
     267
     268    indices = num.zeros(M, num.int)
     269
     270    count = _polyline_overlap(polyline, triangles, indices)
     271
     272    if verbose:
     273        log.critical('Found %d triangles (out of %d) that polygon' % (count, M))
     274
     275    return indices[:count]
     276   
     277def not_polyline_overlap(triangles, polyline, verbose=False):
     278    """Determine if a polyline and triangle overlap
     279
     280    """
     281    polyline = ensure_numeric(polyline)
     282    triangles = ensure_numeric(triangles)
     283   
     284    M = triangles.shape[0]/3  # Number of triangles
     285
     286    indices = num.zeros(M, num.int)
     287
     288    count = _polyline_overlap(polyline, triangles, indices)
     289
     290    if verbose:
     291        log.critical('Found %d triangles (out of %d) that polygon' % (count, M))
     292
     293    return indices[count:]   
     294   
     295
    259296def is_inside_triangle(point, triangle,
    260297                       closed=True,
     
    11351172    from polygon_ext import _interpolate_polyline   
    11361173    from polygon_ext import _polygon_overlap
     1174    from polygon_ext import _polyline_overlap
    11371175    from polygon_ext import _is_inside_triangle       
    11381176    #from polygon_ext import _intersection
Note: See TracChangeset for help on using the changeset viewer.