Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

polygon outline

Status
Not open for further replies.

learningawk

Technical User
Oct 15, 2002
36
US
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.
 
what's needed to be done? Can you show a desired/sample output of the posted input, pls?


vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Here is a sample display of various vector lines that have end points (1 or 2 ) as they would be mapped in an xy reference. For ease of displaying these first/last points the y is constant for each first/last point on each vector line. Only the x is different.

-------------
--------------
-----------
-----------
------------
----------
------------
------------
-----------------

I want to export a file that has a group of points that would re-create a polygon outline of the end points.

If the data looked like:
-----------
-----------
-----------
-----------
-----------
Then the output would be a square box in shape that would consist of 5 xy point pairs and a sequential id 1 through 5 that you could then import and draw the box outline.

Thanks
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top