learningawk
Technical User
I have a series of random placed xy coordinates in a file that reflect 2 points for opposite ends of a vector line.
The input data files looks similar to this:
1842 1841.5 1 aaa
2338.5 1841.5 2 aaa
1891.5 1922.5 1 ccc
2394.5 1928.5 2 ccc
1798.5 2158.5 1 bbb
2251.5 2152 2 bbb
1693 2295 2 ddd
2270.5 2282.5 1 ddd
1724 2028 2 fff
2270.5 2028 1 fff
1724 2375.5 2 eee
2388 2369.5 1 eee
field 1 = x
field 2 = y
field 3 = point number
field 4 = string name
In this test file I've named field 3 as 1 for begining point and 2 for end point for each vector line. The actual numbers can be up to 6 characters in length.
I want to connect the outer points of each first/last point and create a closed polygon that would show an outline of the original vector lines.
The problem I have with trying to analyze this is that the vector lines sometimes cannot be sorted by any order of the 4th and 3rd fields. In other words, the placement of the lines aaa through fff are not consective in incrementing by x or y.
Thanks for any help on this.
The input data files looks similar to this:
1842 1841.5 1 aaa
2338.5 1841.5 2 aaa
1891.5 1922.5 1 ccc
2394.5 1928.5 2 ccc
1798.5 2158.5 1 bbb
2251.5 2152 2 bbb
1693 2295 2 ddd
2270.5 2282.5 1 ddd
1724 2028 2 fff
2270.5 2028 1 fff
1724 2375.5 2 eee
2388 2369.5 1 eee
field 1 = x
field 2 = y
field 3 = point number
field 4 = string name
In this test file I've named field 3 as 1 for begining point and 2 for end point for each vector line. The actual numbers can be up to 6 characters in length.
I want to connect the outer points of each first/last point and create a closed polygon that would show an outline of the original vector lines.
The problem I have with trying to analyze this is that the vector lines sometimes cannot be sorted by any order of the 4th and 3rd fields. In other words, the placement of the lines aaa through fff are not consective in incrementing by x or y.
Thanks for any help on this.