Changeset 7954
 Timestamp:
 Aug 19, 2010, 10:15:38 AM (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/anuga_core/source/anuga/structures/culvert_polygons.py
r7939 r7954 11 11 def create_culvert_polygons(end_point0, 12 12 end_point1, 13 width, height=None, 13 width, 14 height=None, 14 15 enquiry_gap_factor=0.2, 15 16 number_of_barrels=1): … … 56 57 dy = y1y0 57 58 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)) 60 61 61 62 # Adjust polygon width to number of barrels in this culvert … … 64 65 65 66 # Unit direction vector and normal 66 vector/= length # Unit vector in culvert direction67 dxdy /= length # Unit vector in culvert direction 67 68 normal = num.array([dy, dx])/length # Normal vector 68 69 69 culvert_polygons['vector'] = vector70 culvert_polygons['vector'] = dxdy 70 71 culvert_polygons['length'] = length 71 72 culvert_polygons['normal'] = normal … … 73 74 # Short hands 74 75 w = 0.5*width*normal # Perpendicular vector of 1/2 width 75 h = height* vector# Vector of length=height in the76 76 h = height*dxdy # Vector of length=height in the 77 # direction of the culvert 77 78 gap = (1 + enquiry_gap_factor)*h 78 79 … … 96 97 97 98 # 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']: 100 100 polygon = culvert_polygons[key1] 101 101 area = polygon_area(polygon) … … 108 108 point = culvert_polygons[key2] 109 109 msg = 'Enquiry point falls inside an enquiry point.' 110 msg += 'Email Ole.Nielsen@ga.gov.au'111 110 assert not inside_polygon(point, polygon), msg 112 111
Note: See TracChangeset
for help on using the changeset viewer.