Rev | Line | |
---|
[7859] | 1 | """ |
---|
| 2 | Fit a boundary polygon around arbitrary points. |
---|
| 3 | """ |
---|
| 4 | |
---|
| 5 | |
---|
[7776] | 6 | def load_pts_as_polygon(points_file, minimum_triangle_angle=3.0): |
---|
| 7 | """ |
---|
| 8 | WARNING: This function is not fully working. |
---|
| 9 | |
---|
| 10 | Function to return a polygon returned from alpha shape, given a points file. |
---|
| 11 | |
---|
| 12 | WARNING: Alpha shape returns multiple polygons, but this function only |
---|
| 13 | returns one polygon. |
---|
| 14 | """ |
---|
| 15 | |
---|
[7859] | 16 | from anuga.pmesh.mesh import importMeshFromFile |
---|
[7778] | 17 | from anuga.shallow_water.shallow_water_domain import Domain |
---|
[7776] | 18 | |
---|
| 19 | mesh = importMeshFromFile(points_file) |
---|
| 20 | mesh.auto_segment() |
---|
| 21 | mesh.exportASCIIsegmentoutlinefile("outline.tsh") |
---|
| 22 | mesh2 = importMeshFromFile("outline.tsh") |
---|
| 23 | mesh2.generate_mesh(maximum_triangle_area=1000000000, |
---|
| 24 | minimum_triangle_angle=minimum_triangle_angle, |
---|
| 25 | verbose=False) |
---|
| 26 | mesh2.export_mesh_file('outline_meshed.tsh') |
---|
| 27 | domain = Domain("outline_meshed.tsh", use_cache = False) |
---|
| 28 | polygon = domain.get_boundary_polygon() |
---|
| 29 | return polygon |
---|
Note: See
TracBrowser
for help on using the repository browser.