Game Development Reference
In-Depth Information
if (qp[j].v1==ply->p[n] && qp[j].v2==ply->p[m]){
found=TRUE;
break;
}
if (qp[j].v1==ply->p[m] && qp[j].v2==ply->p[n]){
found=TRUE;
break;
}
}
if (!found){
//Add edge
qp[qpTotal].v1 = ply->p[n];
qp[qpTotal].v2 = ply->p[m];
qp[qpTotal].deleted = FALSE;
qpTotal++;
if (qpTotal>=qpMax){
//Enlarge the array
qptmp = new QUADRICPAIR[qpMax * 2];
if (!qptmp) return FALSE;
qpMax *= 2;
memcpy(qptmp, qp, sizeof(QUADRICPAIR)*qpTotal);
delete [] qp;
qp = qptmp;
}
}
}
ply++;
}
if (sqdist>0.0){
//Add any vertex pairs closer than distance
for (i=0; i<oi.numpoints; i++){
for (j=0; j<oi.numpoints; j++){
vsqdist = (i.x - j.x)*(i.x - j.x) + (i.y - j.y)*
(i.y - j.y) + (i.z - j.z)*(i.z - j.z);
if (vsqdist < sqdist){
//Add this pair
qp[qpTotal].v1 = i;
qp[qpTotal].v2 = j;
qpTotal++;
if (qpTotal>=qpMax){
//Enlarge the array
qptmp = new QUADRICPAIR[qpMax * 2];
Search Nedrilad ::




Custom Search