Organising 3 lists

HappyCode

New member
Joined
Apr 21, 2014
Messages
4
Programming Experience
Beginner
Hello everybody,
I have a question regarding how to rearrange lists in an special manner.
I have heard about the hashset but I do not fully understand how that thing works or if it is the best option for this issue.
Basically I have 3 lists: LIST1, LIST2 and LIST3.
LIST1 is a set of xyz points and LIST2 shows how the points are connected (clockwise, counter clockwise, coolinear).
For example the fact that in the first line of LIST2 appears 0, 1, 2,-1 means that the points in LIST1 are connected as follows:
(0 0 128.588459085565)->(25 0 134.979628462965)->(0 0 134.979628462965)
Same for line2 of LIST2: 1, 4, 2,-1
(25 0 134.979628462965)->(25 0 140.100717207301)->(0 0 134.979628462965)
etc...
The value -1 at the end of each line does not mean anything but I need to keep it.
Finally LIST3 tells me if the points are connected counterclockwise (-1), clockwise (1), or coolinear (0).
The thing is that I want to get things as follows:
If the values of list 3=1 then I need to extract all the points in the list 1 that correspond to the value 1 in order. However the values in LIST2 cannot keep being 1, 4, 2,-1 they need to be reorganised starting by zero. Expected result in LIST2= 0,3,1,-1.
We need to do this for each value in list3 (1,-1 and 0).
The idea is to get 3 groups of values:
- Group 1 including all the values that are clockwise (list3) with the points in order in list1 and showing connections starting from zero on in list2.
- Group 2 including all the values that are counterclockwise (list3) with the points in order in list1 and showing connections starting from zero on in list2.
- Group 3 including all the values that are coolinear (list3) with the points in order in list1 and showing connections starting from zero on in list2.
The idea is to be able to print 3 files in the following way:

FILE1:
Points which are clockwise in LIST 1
...

Connections of those points in LIST 2
...
FILE2:

Points which are counterclockwise in LIST 1
...

Connections of those points in LIST 2
...
FILE3:
Points which are coolinear in LIST 1
...

Connections of those points in LIST 2
...


Hope this is clear enough! Any help will be extremely welcome!!!

Many thanks!!


The lists are indicated below:
LIST1
0 0 128.588459085565,
25 0 134.979628462965,
0 0 134.979628462965,
25 0 128.588459085565,
25 0 140.100717207301,
0 0 140.100717207301,
25 0 143.87494372892,
0 0 143.87494372892,
25 0 146.245863353464,
0 0 146.245863353464,
25 0 147.181161545899,
0 0 147.181161545899,
25 0 146.668001779529,
0 0 146.668001779529,
25 0 144.711312619297,
0 0 144.711312619297,
25 0 141.340784276868,
0 0 141.340784276868,
25 0 136.604499944182,
0 0 136.604499944182,
25 0 130.573315654463,
0 0 130.573315654463,
25 0 123.341482952817,
0 0 123.341482952817,
25 0 115.031289382498,
0 0 115.031289382498,
25 0 105.793445439687,
0 0 105.793445439687,
LIST2
0, 1, 2,-1
1, 4, 2,-1
2, 4, 5,-1
4, 6, 5,-1
5, 6, 7,-1
6, 8, 7,-1
7, 8, 9,-1
8, 10, 9,-1
9, 10, 11,-1
10, 12, 11,-1
11, 12, 13,-1
12, 14, 13,-1
13, 14, 15,-1
14, 16, 15,-1
15, 16, 17,-1
16, 18, 17,-1
17, 18, 19,-1
18, 20, 19,-1
19, 20, 21,-1
20, 22, 21,-1
21, 22, 23,-1
22, 24, 23,-1
23, 24, 25,-1
24, 26, 25,-1
25, 26, 27,-1
0, 3, 1,-1
LIST3
1
1
1
-1
-1
-1
1
1
1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
0
0
0
-1
-1
-1
1
1
1
1
 
Back
Top Bottom