Get the inner and outer boundary coordinates of the surface

As shown in the picture, this is a three-dimensional terrain, which consists of countless triangles. Now I want to process this piece of terrain, not only need to obtain the coordinates of each plane triangle, but also to obtain the boundary coordinates of the outermost circle of the entire surface, what should I do?

I think this has been asked already. Have you searched this category ?

@skyfire Jason, you also participated in the following topic …

If you found no older topic thread, then look at the surface above, and think what is different about the edges that are along the border ?

1 Like

My “usual” dirty…

# Assuming the terrain is consist of a raw geometry 
# and selected
def get_triangles_bound_vertex_of_terr
  model = Sketchup.active_model
  sel = model.selection
  faces = sel.grep(Sketchup::Face)
  triangles_pts = faces.map{|f| f.vertices.map(&:position)}
  p "Triangles, point trios: #{triangles_pts}" 
  # could be other polygon as well
  
  all_edges = sel.grep(Sketchup::Edge)
  bound_edges = all_edges.find_all{|edge| edge.faces.size == 1}
  bound_vertice_pairs = bound_edges.map{|e| e.vertices.map(&:position)}
  p "Boundary, point pairs: #{bound_vertice_pairs}"
  sel.clear
  sel.add(bound_edges)
end
get_triangles_bound_vertex_of_terr

You may also want the point coordinates in sorted order if you want to reconstruct boundary edges or visualize (or export them):

There’s an echo in here … in here …

2 Likes