/[libvob]/libvob/include/vob/vobs/Fillet.hxx
ViewVC logotype

Diff of /libvob/include/vob/vobs/Fillet.hxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.35 by jvk, Tue Jul 1 13:09:09 2003 UTC revision 1.36 by jvk, Tue Jul 1 14:32:56 2003 UTC
# Line 707  struct Fillet3DBlend { Line 707  struct Fillet3DBlend {
707      };      };
708    
709      ZVec blend(Conn *conns[], int N, float r, ZVec pt) const {      ZVec blend(Conn *conns[], int N, float r, ZVec pt) const {
710          int num = 0;          int i, num = 0;
711          float sum = 0;          float sum = 0;
712            float x[N];
713    
714          for (int i = 0; i < N; i++) {          // Compute distances from the node for each fillet surface
715            for (i = 0; i < N; i++) {
716              bool success;              bool success;
717              float t = conns[i]->rad(pt, success);              float t = conns[i]->rad(pt, success);
718              if (success) {              if (success)
719                  sum += t - r;                  sum += x[num++] = (t - r) / r;
                 num++;  
             }  
720          }          }
721    
722          return pt * (1 + sum / r);          // Compute p for an l^p norm to be used as the blending function
723            // p == 1: sum of distance,
724            // p == \infty: maximum of distances
725            float p = 1.0 + sum;
726    
727            sum = 0;
728            for (i = 0; i < num; i++)
729                sum += pow(x[i], p);
730            
731            return pt * (1 + pow(sum, 1 / p));
732    
733      }      }
734    
# Line 795  struct Fillet3DBlend { Line 804  struct Fillet3DBlend {
804              }              }
805              glNormal(norm[i][0]);              glNormal(norm[i][0]);
806              glVertex(pt[i][0]);              glVertex(pt[i][0]);
807    
808                glNormal(norm[i+1][0]);
809                glVertex(pt[i+1][0]);
810              glEnd();              glEnd();
811          }          }
812    

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26