bartekch
bartekch

Reputation: 623

Python. How to find list of line segments in giving convex_hull?

I know how to compute convex_hull, but how to get a list of line segments creating convex_hull?

Upvotes: 0

Views: 330

Answers (1)

fjafjan
fjafjan

Reputation: 84

Well it seems like it basically explains how in the comments of the algorithm?

Output: a list of vertices of the convex hull in counter-clockwise order,
      starting from the vertex with the lexicographically smallest coordinates.

So if it does what it promises to, you can simply start with the first vertex and join it to the next one and so forth until you join the last one to the first.

You can be certain that none of the lines cross through the body since these are the vertexes that make up the convex hull and are listed in counter clockwise order.

Upvotes: 1

Related Questions