daydayup
daydayup

Reputation: 2317

Find the underlying polygon bound given the vertices

Given the coordination of the vertices as shown in fig 1, how can we compute the underlying polygon as shown in fig 2? Suppose all the edges are either vertical or horizontal.

Fig 1:

Fig1

========================================================================

Fig2:

Fig2

Upvotes: 0

Views: 107

Answers (1)

Jason S
Jason S

Reputation: 189626

  • Sort the vertices by x-coordinates
  • Connect vertices with identical x-coordinates
  • Sort the vertices by y-coordinates
  • Connect vertices with identical y-coordinates

Won't work if there are multiple vertices in a line (not just 2), but I'm not sure that's feasible without more information than you gave us.

Upvotes: 2

Related Questions