0

I have a set of n 3d line segments [(p1_start,p1_end), (p2_start,p2_end),....(pn_start,pn_end)]. (I believe that they shod be nin-intersecting...) These segments represent a (closed) boundary. I am looking for effective algorithm to generate this boundary, i.e. to find the order of segments for boundary : [pj_start,pj_end, ...p1_start, p1_end.....] (segments can be connected via their ends: start to start , start to end, end to start, end to end) I thought to start from arbitrary segment , say s = (pm_start, pm_end), among all other segment find the one , which distance to pm_start or pm_end is minimal, and add this segment end based on calculated minimum distance and continue this way for all segments The complexity of this approach is not good Can anyone propose effective algorithm for this problem

YAKOVM
  • 9,805
  • 31
  • 116
  • 217
  • are those line connected (all of them) into close loop? you want convex or concave hull? – Spektre Jul 22 '20 at 06:08
  • @Spektre - my task is to connect them. not sure that convex hull should be helpfull - it works with poibts. I need to take all segments just order them. Line segments are not directly connected . they are not ((0,0,0) (1,1,2))((1,1,2),(1,2,3)) etc . but rather ((0,0,0) (1,1,2))((1,1,3),(1,2,3)) – YAKOVM Jul 22 '20 at 10:42
  • but are all the lines touching at their endpoints? or there are gaps or even intersections? – Spektre Jul 22 '20 at 11:34
  • @Spektre ther are gaps – YAKOVM Jul 22 '20 at 12:07
  • that complicates things a lot ... I would try to join segments that are touching by endpoints... and when no such left connect endpoints to closest line not yet connected to it... however depending on input data it might or might not work... as you did not shared input sample we can only guess... If nothing helps I would use convex hull (yes on the line endpoints)... – Spektre Jul 22 '20 at 12:17

0 Answers0