Changeset 8046


Ignore:
Timestamp:
Oct 21, 2010, 10:58:58 AM (9 years ago)
Author:
habili
Message:

bug fix and comments added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/utilities/polygon_ext.c

    r8040 r8046  
    860860  //
    861861 
     862    //def separate_points_by_polygon(points, polygon, closed, verbose, one_point):
     863  //  """Determine whether points are inside or outside a polygon
     864  //
     865  //  Input:
     866  //     point - Tuple of (x, y) coordinates, or list of tuples
     867  //     polygon - list of vertices of polygon
     868  //     closed - (optional) determine whether points on boundary should be
     869  //     regarded as belonging to the polygon (closed = True)
     870  //     or not (closed = False)
     871
     872  //
     873  //  Output:
     874  //     indices: array of same length as points with indices of points falling
     875  //     inside the polygon listed from the beginning and indices of points
     876  //     falling outside listed from the end.
     877  //     
     878  //     count: count of points falling inside the polygon
     879  //     
     880  //     The indices of points inside are obtained as indices[:count]
     881  //     The indices of points outside are obtained as indices[count:]       
     882  //
     883  //  Examples:
     884  //     separate_polygon( [[0.5, 0.5], [1, -0.5], [0.3, 0.2]] )
     885  //     will return the indices [0, 2, 1] as only the first and the last point
     886  //     is inside the unit square
     887  //
     888  //  Remarks:
     889  //     The vertices may be listed clockwise or counterclockwise and
     890  //     the first point may optionally be repeated.
     891  //     Polygons do not need to be convex.
     892  //     Polygons can have holes in them and points inside a hole is
     893  //     regarded as being outside the polygon.
     894  //
     895  //
     896  //  Algorithm is based on work by Darel Finley,
     897  //  http://www.alienryderflex.com/polygon/
     898  //
     899 
     900 
    862901  PyArrayObject
    863902    *polyline,
Note: See TracChangeset for help on using the changeset viewer.