Guest User

Untitled

a guest
Jan 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. edges = set()
  2. edge_points = []
  3.  
  4. # loop over triangles:
  5. # ia, ib, ic = indices of corner points of the triangle
  6.  
  7. for ia, ib, ic in tri.vertices:
  8. pa = coords[ia]
  9. pb = coords[ib]
  10. pc = coords[ic]
  11. # Lengths of sides of triangle
  12. a = math.sqrt((pa[0]-pb[0])**2 + (pa[1]-pb[1])**2)
  13. b = math.sqrt((pb[0]-pc[0])**2 + (pb[1]-pc[1])**2)
  14. c = math.sqrt((pc[0]-pa[0])**2 + (pc[1]-pa[1])**2)
  15. # Semiperimeter of triangle
  16. s = (a + b + c)/2.0
  17. # Area of triangle by Heron's formula
  18. area = math.sqrt(s*(s-a)*(s-b)*(s-c))
  19. circum_r = a*b*c/(4.0*area)
  20. # Here's the radius filter.
  21. #print circum_r
  22. if circum_r < 1.0/alpha:
  23. add_edge(edges, edge_points, coords, ia, ib)
  24. add_edge(edges, edge_points, coords, ib, ic)
  25. add_edge(edges, edge_points, coords, ic, ia)
  26.  
  27. m = geometry.MultiLineString(edge_points)
  28. triangles = list(polygonize(m))
  29. return cascaded_union(triangles), edge_points
  30.  
  31. Assertion failed: (!static_cast<bool>("should never be reached")),
  32. function itemsTree, file AbstractSTRtree.cpp, line 373.
  33. Abort trap: 6
Add Comment
Please, Sign In to add comment