80 GLdouble maxVal[3], minVal[3], d1[3], d2[3], tNorm[3];
88 for(
v = vHead->
next;
v != vHead;
v =
v->next ) {
89 for(
i = 0;
i < 3; ++
i ) {
91 if(
c < minVal[
i] ) { minVal[
i] =
c; minVert[
i] =
v; }
92 if(
c > maxVal[
i] ) { maxVal[
i] =
c; maxVert[
i] =
v; }
100 if( maxVal[1] - minVal[1] > maxVal[0] - minVal[0] ) {
i = 1; }
101 if( maxVal[2] - minVal[2] > maxVal[
i] - minVal[
i] ) {
i = 2; }
102 if( minVal[
i] >= maxVal[
i] ) {
104 norm[0] = 0; norm[1] = 0; norm[2] = 1;
114 d1[0] =
v1->coords[0] -
v2->coords[0];
115 d1[1] =
v1->coords[1] -
v2->coords[1];
116 d1[2] =
v1->coords[2] -
v2->coords[2];
117 for(
v = vHead->
next;
v != vHead;
v =
v->next ) {
118 d2[0] =
v->coords[0] -
v2->coords[0];
119 d2[1] =
v->coords[1] -
v2->coords[1];
120 d2[2] =
v->coords[2] -
v2->coords[2];
121 tNorm[0] = d1[1]*d2[2] - d1[2]*d2[1];
122 tNorm[1] = d1[2]*d2[0] - d1[0]*d2[2];
123 tNorm[2] = d1[0]*d2[1] - d1[1]*d2[0];
124 tLen2 = tNorm[0]*tNorm[0] + tNorm[1]*tNorm[1] + tNorm[2]*tNorm[2];
125 if( tLen2 > maxLen2 ) {
135 norm[0] = norm[1] = norm[2] = 0;