Changeset 8053


Ignore:
Timestamp:
Oct 29, 2010, 11:00:13 AM (8 years ago)
Author:
habili
Message:

Addition of line intersect code. This will determine which triangles intersect or which triangle contains a line.

File:
1 edited

Legend:

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

    r8037 r8053  
    257257    return indices[count:]   
    258258
    259 def polyline_overlap(triangles, polyline, verbose=False):
     259def line_intersect(triangles, line, verbose=False):
    260260    """Determine if a polygon and triangle overlap
    261261
    262262    """
    263     polyline = ensure_numeric(polyline)
     263    line = ensure_numeric(line)
    264264    triangles = ensure_numeric(triangles)
    265265   
     
    268268    indices = num.zeros(M, num.int)
    269269
    270     count = _polyline_overlap(polyline, triangles, indices)
     270    count = _line_intersect(line, triangles, indices)
    271271
    272272    if verbose:
    273         log.critical('Found %d triangles (out of %d) that polygon' % (count, M))
     273        log.critical('Found %d triangles (out of %d) that overlap the polygon' % (count, M))
    274274
    275275    return indices[:count]
    276276   
    277 def not_polyline_overlap(triangles, polyline, verbose=False):
     277def not_line_intersect(triangles, line, verbose=False):
    278278    """Determine if a polyline and triangle overlap
    279279
    280280    """
    281     polyline = ensure_numeric(polyline)
     281    line = ensure_numeric(line)
    282282    triangles = ensure_numeric(triangles)
    283283   
     
    286286    indices = num.zeros(M, num.int)
    287287
    288     count = _polyline_overlap(polyline, triangles, indices)
     288    count = _line_intersect(line, triangles, indices)
    289289
    290290    if verbose:
    291         log.critical('Found %d triangles (out of %d) that polygon' % (count, M))
     291        log.critical('Found %d triangles (out of %d) that intersect the line' % (count, M))
    292292
    293293    return indices[count:]   
     
    11721172    from polygon_ext import _interpolate_polyline   
    11731173    from polygon_ext import _polygon_overlap
    1174     from polygon_ext import _polyline_overlap
     1174    from polygon_ext import _line_intersect
    11751175    from polygon_ext import _is_inside_triangle       
    11761176    #from polygon_ext import _intersection
Note: See TracChangeset for help on using the changeset viewer.