Changeset 7954


Ignore:
Timestamp:
Aug 19, 2010, 10:15:38 AM (14 years ago)
Author:
habili
Message:

Minor refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/structures/culvert_polygons.py

    r7939 r7954  
    1111def create_culvert_polygons(end_point0,
    1212                            end_point1,
    13                             width, height=None,
     13                            width,
     14                            height=None,
    1415                            enquiry_gap_factor=0.2,
    1516                            number_of_barrels=1):
     
    5657    dy = y1-y0
    5758
    58     vector = num.array([dx, dy])
    59     length = sqrt(num.sum(vector**2))
     59    dxdy = num.array([dx, dy])
     60    length = sqrt(num.sum(dxdy**2))
    6061
    6162    # Adjust polygon width to number of barrels in this culvert
     
    6465   
    6566    # Unit direction vector and normal
    66     vector /= length                 # Unit vector in culvert direction
     67    dxdy /= length                 # Unit vector in culvert direction
    6768    normal = num.array([-dy, dx])/length # Normal vector
    6869   
    69     culvert_polygons['vector'] = vector
     70    culvert_polygons['vector'] = dxdy
    7071    culvert_polygons['length'] = length
    7172    culvert_polygons['normal'] = normal   
     
    7374    # Short hands
    7475    w = 0.5*width*normal # Perpendicular vector of 1/2 width
    75     h = height*vector    # Vector of length=height in the
    76                          # direction of the culvert
     76    h = height*dxdy # Vector of length=height in the
     77                    # direction of the culvert
    7778    gap = (1 + enquiry_gap_factor)*h
    7879                         
     
    9697
    9798    # Check that enquiry polygons are outside exchange polygons
    98     for key1 in ['exchange_polygon0',
    99                  'exchange_polygon1']:
     99    for key1 in ['exchange_polygon0', 'exchange_polygon1']:
    100100        polygon = culvert_polygons[key1]
    101101        area = polygon_area(polygon)
     
    108108            point = culvert_polygons[key2]
    109109            msg = 'Enquiry point falls inside an enquiry point.'
    110             msg += 'Email Ole.Nielsen@ga.gov.au'
    111110            assert not inside_polygon(point, polygon), msg
    112111
Note: See TracChangeset for help on using the changeset viewer.