Changeset 6187
- Timestamp:
- Jan 17, 2009, 3:32:16 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/fit_interpolate/interpolate.py
r6186 r6187 579 579 """Auxiliary function used by interpolate_polyline 580 580 """ 581 582 for i in range(number_of_points): 583 584 x2, y2 = point_coordinates[i,:] 585 found = False 586 587 for j in range(number_of_nodes): 581 582 for j in range(number_of_nodes): 583 neighbour_id = gauge_neighbour_id[j] 584 585 586 if neighbour_id >= 0: 587 x0, y0 = polyline_nodes[j,:] 588 x1, y1 = polyline_nodes[neighbour_id,:] 588 589 589 neighbour_id = gauge_neighbour_id[j] 590 if neighbour_id >= 0: 591 x0, y0 = polyline_nodes[j,:] 592 x1, y1 = polyline_nodes[neighbour_id,:] 590 segment_len = sqrt((x1-x0)**2 + (y1-y0)**2) 591 segment_delta = f[neighbour_id] - f[j] 592 slope = segment_delta/segment_len 593 593 594 595 for i in range(number_of_points): 596 597 x2, y2 = point_coordinates[i,:] 594 598 if point_on_line([x2, y2], 595 599 [[x0, y0], [x1, y1]], 596 600 rtol=1.0e-6): 597 601 598 found = True 599 segment_len = sqrt((x1-x0)**2 + (y1-y0)**2) 602 600 603 dist = sqrt((x2-x0)**2 + (y2-y0)**2) 601 z[i] = (f[neighbour_id] - f[j])*dist/segment_len + f[j] 602 break 603 604 if not found: 605 z[i] = 0.0 604 z[i] = slope*dist + f[j] 605 606 606 607 607 608
Note: See TracChangeset
for help on using the changeset viewer.