Game Development Reference
In-Depth Information
pc1.p[0] = -1;
pc1.valence = con[v1].valence;
//Set pc1 so that the opposite vertex is v2
for (i=0; i<con[v1].valence; i++){
if (con[v1].p[i]==v2){
index = 0;
for (j=i; j<con[v1].valence; j++){
pc1.p[index++] = con[v1].p[j];
}
for (j=0; j<i; j++){
pc1.p[index++] = con[v1].p[j];
}
}
}
if (pc1.p[0]==-1) return -1; //Error
pc2.p[0] = -1;
pc2.valence = con[v2].valence;
//Set pc2 so that the opposite vertex is v1
for (i=0; i<con[v2].valence; i++){
if (con[v2].p[i]==v1){
index = 0;
for (j=i; j<con[v2].valence; j++){
pc2.p[index++] = con[v2].p[j];
}
for (j=0; j<i; j++){
pc2.p[index++] = con[v2].p[j];
}
}
}
if (pc2.p[0]==-1) return -1; //Error
if (con[v1].border && con[v2].border){
//Must be boundary edge
//Based on 9/16 * v1 + 9/16 * v2 -
//1/16 * ca[valence-1] - 1/16 * cb[0]
v->x = 0.5625 * pts[v1].x +
0.5625 * pts[v2].x -
0.0625 * pts[pc1.p[pc1.valence-1]].x -
0.0625 * pts[pc2.p[0]].x;
Search Nedrilad ::




Custom Search