Changeset 6001


Ignore:
Timestamp:
Nov 26, 2008, 3:29:51 PM (16 years ago)
Author:
ole
Message:


Make copy of the polygon in polygon_area to avoid destroying it


File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/utilities/polygon.py

    r6000 r6001  
    482482
    483483
    484 def polygon_area(polygon):
     484def polygon_area(input_polygon):
    485485    """ Determin area of arbitrary polygon
    486486    Reference
     
    489489   
    490490    # Move polygon to origin (0,0) to avoid rounding errors
    491     polygon = ensure_numeric(polygon)
    492     min_x = min(polygon[:,0])
    493     min_y = min(polygon[:,1])   
    494     polygon -= [min_x, min_y]
     491    # This makes a copy of the polygon to avoid destroying it
     492    input_polygon = ensure_numeric(input_polygon)
     493    min_x = min(input_polygon[:,0])
     494    min_y = min(input_polygon[:,1])   
     495    polygon = input_polygon - [min_x, min_y]
    495496
    496497    # Compute area   
Note: See TracChangeset for help on using the changeset viewer.