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