Game Development Reference
In-Depth Information
pts[pc1.p[1]].y * (0.125 + 2*w) +
pts[pc1.p[5]].y * (0.125 + 2*w) +
pts[pc1.p[2]].y * (-0.0625 - w) +
pts[pc2.p[2]].y * (-0.0625 - w) +
pts[pc1.p[4]].y * (-0.0625 - w) +
pts[pc2.p[4]].y * (-0.0625 - w) +
pts[pc1.p[3]].y * w +
pts[pc2.p[3]].y * w;
v->z = pts[pc1.p[0]].z * (0.5-w) +
pts[pc2.p[0]].z * (0.5-w) +
pts[pc1.p[1]].z * (0.125 + 2*w) +
pts[pc1.p[5]].z * (0.125 + 2*w) +
pts[pc1.p[2]].z * (-0.0625 - w) +
pts[pc2.p[2]].z * (-0.0625 - w) +
pts[pc1.p[4]].z * (-0.0625 - w) +
pts[pc2.p[4]].z * (-0.0625 - w) +
pts[pc1.p[3]].z * w +
pts[pc2.p[3]].z * w;
}else{
v->x=pt1.x; v->y=pt1.y; v->z=pt1.z;
}
break;
case 5:
default:
//v2=3/4,cb[n]=(1/4+cos(2pi*n/valence)+1/2(cos(4pi*n/
valence))/valence
valence = pc2.valence;
pt2.x = pts[v2].x * 0.75;
pt2.y = pts[v2].y * 0.75;
pt2.z = pts[v2].z * 0.75;
for ( i=0; i<pc2.valence; i++){
weight = (0.25 + cos((PI2 * (double)i)/valence) +
0.5 * cos((PI2 * 2 * (double)i)/valence))/valence;
pt2.x += pts[pc2.p[i]].x * weight;
pt2.y += pts[pc2.p[i]].y * weight;
pt2.z += pts[pc2.p[i]].z * weight;
}
if (pc1.valence==6){