-
Notifications
You must be signed in to change notification settings - Fork 2
/
orderedSkeleton.vfl
56 lines (48 loc) · 1.73 KB
/
orderedSkeleton.vfl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
int copyPoint(int geosource;int geodestination; int index){//currently will lose info about all other attributes, but those can be added quite easily.
vector position = point(geosource, "P", index);
int newpoint = addpoint(geodestination, position);
return(newpoint);
}
void stringToIntArray(string input;int r[]){
r={};
string splits[] = split(input,",");
for(int splice = 0; splice<len(splits);splice++){
push(r,atoi(splits[splice]));
}
}
string intArrayToString(int input[]){
string output = "";
for(int index = 0;index<len(input);index++){
output = output + itoa(input[index]) + ",";
}
return output;
}
//The goal of this wrangle is to take input geometry, and create ordered lists to output.
int inputGeo = 1;
int outputGeo = 0;
//gather zero points
int zeropoints[];
for(int i=0; i<npoints(inputGeo);i++){
if(neighbourcount(inputGeo,i)==1){
push(zeropoints,i);
}
}
int prims[];// * -1 if inactive.
int endPoints[]; //last point of each prim. could have end/merge datastructure.
int startPoints[];//first point of each prim.
string mergePoints[];//list of points that endpoint joins to. (multi-dimensional) "s,1,2,3,e,50,40" <possible
int dirtyPoints[];//global list of points that have been used
//start walking the mesh (we begin at the first zeropoint) if curve system is not a loop or series of loops within larger loop.
int currentPoint;
if(len(zeropoints)>0){
zeropoints[0];
int prim_1 = addprim(outputGeo,"polyline");
int v = addvertex(outputGeo,prim_1,copyPoint(inputGeo,outputGeo,currentPoint));
push(prims,prim_1);
push(endPoints,currentPoint);
push(startPoints,currentPoint);
push(precidents,itoa(currentPoint));
}else{
int currentPoint = primpoints(1,0)[0];
printf("currentPoint:%f",currentPoint);
}