Revision: 28335
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28335
Author:   eman
Date:     2010-04-22 00:12:21 +0200 (Thu, 22 Apr 2010)

Log Message:
-----------
More small code cleanup.

Modified Paths:
--------------
    branches/nurbs25/intern/nurbana/intern/libNurbana.cpp
    branches/nurbs25/intern/nurbana/intern/nbConstruct.cpp
    branches/nurbs25/intern/nurbana/intern/nbDegree.cpp
    branches/nurbs25/intern/nurbana/intern/nbDegree.h
    branches/nurbs25/intern/nurbana/intern/nbFitting.cpp
    branches/nurbs25/intern/nurbana/intern/nbGenerate.cpp
    branches/nurbs25/intern/nurbana/intern/nbKnot.cpp
    branches/nurbs25/intern/nurbana/intern/nbKnot.h
    branches/nurbs25/intern/nurbana/intern/nbNURBS.cpp
    branches/nurbs25/intern/nurbana/intern/nbNURBS.h
    branches/nurbs25/intern/nurbana/intern/nbNormals.cpp
    branches/nurbs25/intern/nurbana/intern/nbNormals.h

Modified: branches/nurbs25/intern/nurbana/intern/libNurbana.cpp
===================================================================
--- branches/nurbs25/intern/nurbana/intern/libNurbana.cpp       2010-04-21 
21:43:29 UTC (rev 28334)
+++ branches/nurbs25/intern/nurbana/intern/libNurbana.cpp       2010-04-21 
22:12:21 UTC (rev 28335)
@@ -430,31 +430,31 @@
 int NRB_getNumIsoPoints(NurbanaObj_ptr nop) {
        nbNURBS *on;
        on = reinterpret_cast<nbNURBS*>(nop);
-       return (on->IPCTotPts());
+       return (on->getIsolineLen());
 }
 
 void NRB_setIsoResolution(NurbanaObj_ptr nop,int res) {
        nbNURBS *on;
        on = reinterpret_cast<nbNURBS*>(nop);
-       return (on->IPCResolution(res));
+       return (on->setIsolineResolution(res));
 }
 
 void NRB_setIsoDensity(NurbanaObj_ptr nop,int den) {
        nbNURBS *on;
        on = reinterpret_cast<nbNURBS*>(nop);
-       return (on->IPCDensity(den));
+       return (on->setIsolineDensity(den));
 }
 
 int NRB_getIsoResolution(NurbanaObj_ptr nop) {
        nbNURBS *on;
        on = reinterpret_cast<nbNURBS*>(nop);
-       return (on->IPCResolution());
+       return (on->getIsoilineResolution());
 }
 
 int NRB_getIsoDensity(NurbanaObj_ptr nop) {
        nbNURBS *on;
        on = reinterpret_cast<nbNURBS*>(nop);
-       return (on->IPCDensity());
+       return (on->getIsolineDensity());
 }
 
 nbReal* NRB_getIsoPoints(NurbanaObj_ptr nop, nbReal* buffer) {

Modified: branches/nurbs25/intern/nurbana/intern/nbConstruct.cpp
===================================================================
--- branches/nurbs25/intern/nurbana/intern/nbConstruct.cpp      2010-04-21 
21:43:29 UTC (rev 28334)
+++ branches/nurbs25/intern/nurbana/intern/nbConstruct.cpp      2010-04-21 
22:12:21 UTC (rev 28335)
@@ -56,7 +56,7 @@
        u = i > u ? i : u; // Max Order U
        v = n > v ? n : v; // Max Order V
 
-       // Degree Elevate Tmp Surfaces with lower degree
+       // degree Elevate Tmp Surfaces with lower degree
        if (u - tmp1->getOrder(0) || v - tmp1->getOrder(1))
                nbDegree::elevate(tmp1, u - tmp1->getOrder(0), v - 
tmp1->getOrder(1));
        if (u - tmp2->getOrder(0) || v - tmp2->getOrder(1))

Modified: branches/nurbs25/intern/nurbana/intern/nbDegree.cpp
===================================================================
--- branches/nurbs25/intern/nurbana/intern/nbDegree.cpp 2010-04-21 21:43:29 UTC 
(rev 28334)
+++ branches/nurbs25/intern/nurbana/intern/nbDegree.cpp 2010-04-21 22:12:21 UTC 
(rev 28335)
@@ -381,46 +381,46 @@
 }
 
 
-void nbDegree::bezDegReduce(Point3d *bpts, Point3d *rbpts, int Degree, nbReal 
&MaxErr) {
+void nbDegree::bezDegReduce(Point3d *bpts, Point3d *rbpts, int degree, nbReal 
&maxErr) {
        // Reduce Bezier segment and store in rbpts
        int     i,r;
        nbReal  a,a2,x,y,z,H;
 
-       r= (Degree-1)/2;
+       r= (degree-1)/2;
 
        rbpts[0].x= bpts[0].x;
        rbpts[0].y= bpts[0].y;
        rbpts[0].z= bpts[0].z;
        rbpts[0].H= bpts[0].H;
 
-       rbpts[Degree-1].x= bpts[Degree].x;
-       rbpts[Degree-1].y= bpts[Degree].y;
-       rbpts[Degree-1].z= bpts[Degree].z;
-       rbpts[Degree-1].H= bpts[Degree].H;
+       rbpts[degree-1].x= bpts[degree].x;
+       rbpts[degree-1].y= bpts[degree].y;
+       rbpts[degree-1].z= bpts[degree].z;
+       rbpts[degree-1].H= bpts[degree].H;
 
        // Two cases, Even or Odd
-       if(Degree%2) {
+       if(degree%2) {
                // Odd
                for(i= 1; i <= r-1; i++) {
-                       a= nbReal(i)/nbReal(Degree);
+                       a= nbReal(i)/nbReal(degree);
                        rbpts[i].x= (bpts[i].x-a*rbpts[i-1].x)/(1.0-a);
                        rbpts[i].y= (bpts[i].y-a*rbpts[i-1].y)/(1.0-a);
                        rbpts[i].z= (bpts[i].z-a*rbpts[i-1].z)/(1.0-a);
                        rbpts[i].H= (bpts[i].H-a*rbpts[i-1].H)/(1.0-a);
                } //eof
-               for(i= Degree-2; i >= r+1; i--) {
-                       a= nbReal(i+1)/nbReal(Degree);
+               for(i= degree-2; i >= r+1; i--) {
+                       a= nbReal(i+1)/nbReal(degree);
                        rbpts[i].x= (bpts[i+1].x-(1.0-a)*rbpts[i+1].x)/a;
                        rbpts[i].y= (bpts[i+1].y-(1.0-a)*rbpts[i+1].y)/a;
                        rbpts[i].z= (bpts[i+1].z-(1.0-a)*rbpts[i+1].z)/a;
                        rbpts[i].H= (bpts[i+1].H-(1.0-a)*rbpts[i+1].H)/a;
                } //eof
-               a= nbReal(r)/(nbReal(Degree));
+               a= nbReal(r)/(nbReal(degree));
                rbpts[r].x= (bpts[r].x - a*rbpts[r-1].x)/(1.0-a);
                rbpts[r].y= (bpts[r].y - a*rbpts[r-1].y)/(1.0-a);
                rbpts[r].z= (bpts[r].z - a*rbpts[r-1].z)/(1.0-a);
                rbpts[r].H= (bpts[r].H - a*rbpts[r-1].H)/(1.0-a);
-               a= nbReal(r+1)/(nbReal(Degree));
+               a= nbReal(r+1)/(nbReal(degree));
                rbpts[r].x+= (bpts[r+1].x-(1.0-a)*rbpts[r+1].x)/a;
                rbpts[r].y+= (bpts[r+1].y-(1.0-a)*rbpts[r+1].y)/a;
                rbpts[r].z+= (bpts[r+1].z-(1.0-a)*rbpts[r+1].z)/a;
@@ -433,14 +433,14 @@
        } else {
                // Even
                for(i= 1; i <= r; i++) {
-                       a= nbReal(i)/nbReal(Degree);
+                       a= nbReal(i)/nbReal(degree);
                        rbpts[i].x= (bpts[i].x-a*rbpts[i-1].x)/(1.0-a);
                        rbpts[i].y= (bpts[i].y-a*rbpts[i-1].y)/(1.0-a);
                        rbpts[i].z= (bpts[i].z-a*rbpts[i-1].z)/(1.0-a);
                        rbpts[i].H= (bpts[i].H-a*rbpts[i-1].H)/(1.0-a);
                } //eof
-               for(i= Degree-2; i >= r+1; i--) {
-                       a= nbReal(i+1)/nbReal(Degree);
+               for(i= degree-2; i >= r+1; i--) {
+                       a= nbReal(i+1)/nbReal(degree);
                        rbpts[i].x= (bpts[i+1].x - (1.0-a)*rbpts[i+1].x)/a;
                        rbpts[i].y= (bpts[i+1].y - (1.0-a)*rbpts[i+1].y)/a;
                        rbpts[i].z= (bpts[i+1].z - (1.0-a)*rbpts[i+1].z)/a;
@@ -449,33 +449,33 @@
        } //fi
 
        // Error Calculation // TODO -eman cache _Basis calls
-       if(Degree%2) {
+       if(degree%2) {
                // Odd
-               a= nbReal(r)/(nbReal(Degree));
-               a2= nbReal(r+1)/(nbReal(Degree));
-               x= 
(0.5)*(1.0-a)*((_Basis(r,Degree,0.5)-_Basis(r+1,Degree,0.5))*(((bpts[r].x-a*rbpts[r-1].x)/(1.0-a))-((bpts[r+1].x-(1.0-a2)*rbpts[r+1].x)/(a2))));
-               y= 
(0.5)*(1.0-a)*((_Basis(r,Degree,0.5)-_Basis(r+1,Degree,0.5))*(((bpts[r].y-a*rbpts[r-1].y)/(1.0-a))-((bpts[r+1].y-(1.0-a2)*rbpts[r+1].y)/(a2))));
-               z= 
(0.5)*(1.0-a)*((_Basis(r,Degree,0.5)-_Basis(r+1,Degree,0.5))*(((bpts[r].z-a*rbpts[r-1].z)/(1.0-a))-((bpts[r+1].z-(1.0-a2)*rbpts[r+1].z)/(a2))));
-               H= 
(0.5)*(1.0-a)*((_Basis(r,Degree,0.5)-_Basis(r+1,Degree,0.5))*(((bpts[r].H-a*rbpts[r-1].H)/(1.0-a))-((bpts[r+1].H-(1.0-a2)*rbpts[r+1].H)/(a2))));
+               a= nbReal(r)/(nbReal(degree));
+               a2= nbReal(r+1)/(nbReal(degree));
+               x= 
(0.5)*(1.0-a)*((_Basis(r,degree,0.5)-_Basis(r+1,degree,0.5))*(((bpts[r].x-a*rbpts[r-1].x)/(1.0-a))-((bpts[r+1].x-(1.0-a2)*rbpts[r+1].x)/(a2))));
+               y= 
(0.5)*(1.0-a)*((_Basis(r,degree,0.5)-_Basis(r+1,degree,0.5))*(((bpts[r].y-a*rbpts[r-1].y)/(1.0-a))-((bpts[r+1].y-(1.0-a2)*rbpts[r+1].y)/(a2))));
+               z= 
(0.5)*(1.0-a)*((_Basis(r,degree,0.5)-_Basis(r+1,degree,0.5))*(((bpts[r].z-a*rbpts[r-1].z)/(1.0-a))-((bpts[r+1].z-(1.0-a2)*rbpts[r+1].z)/(a2))));
+               H= 
(0.5)*(1.0-a)*((_Basis(r,degree,0.5)-_Basis(r+1,degree,0.5))*(((bpts[r].H-a*rbpts[r-1].H)/(1.0-a))-((bpts[r+1].H-(1.0-a2)*rbpts[r+1].H)/(a2))));
        } else {
                // Even
-               x= 
_Basis(r+1,Degree,0.5)*(bpts[r+1].x-0.5*(rbpts[r].x+rbpts[r+1].x));
-               y= 
_Basis(r+1,Degree,0.5)*(bpts[r+1].y-0.5*(rbpts[r].y+rbpts[r+1].y));
-               z= 
_Basis(r+1,Degree,0.5)*(bpts[r+1].z-0.5*(rbpts[r].z+rbpts[r+1].z));
-               H= 
_Basis(r+1,Degree,0.5)*(bpts[r+1].H-0.5*(rbpts[r].H+rbpts[r+1].H));
+               x= 
_Basis(r+1,degree,0.5)*(bpts[r+1].x-0.5*(rbpts[r].x+rbpts[r+1].x));
+               y= 
_Basis(r+1,degree,0.5)*(bpts[r+1].y-0.5*(rbpts[r].y+rbpts[r+1].y));
+               z= 
_Basis(r+1,degree,0.5)*(bpts[r+1].z-0.5*(rbpts[r].z+rbpts[r+1].z));
+               H= 
_Basis(r+1,degree,0.5)*(bpts[r+1].H-0.5*(rbpts[r].H+rbpts[r+1].H));
        } //fi
        // Assumption, take the length of the error vector???
        //  printf("Ex: %f, Ey: %f, Ez: %f\n",x,y,z);
-       MaxErr= sqrt(x*x+y*y+z*z+H*H);
+       maxErr= sqrt(x*x+y*y+z*z+H*H);
 }
 
 
 void nbDegree::reduce(nbNURBS *obj, int Udec, int Vdec) {
-       int             Npts,Order,curve,UV,Dec,Length,FnlLU,FnlLV;
-       int             n,i,j,k,s,kj,first,last,ii,q,K,L;
-       int             ph,mh,Degree,kind,r,a,b,cind,mult,m,oldr,lbz,save;
+       int Npts,Order,curve,UV,Dec,Length,FnlLU,FnlLV;
+       int n,i,j,k,s,kj,first,last,ii,q,K,L;
+       int ph,mh,degree,kind,r,a,b,cind,mult,m,oldr,lbz,save;
 
-       nbReal          
*Uh,*error,*alphas,numer,MaxErr,TOL,alfa,beta,delta,Br,*FnlKVU,*FnlKVV,*KnotVector;
+       nbReal 
*Uh,*error,*alphas,numer,maxErr,TOL,alfa,beta,delta,Br,*FnlKVU,*FnlKVV,*KnotVector;
        Point3d *Pts,*bpts,*Temp,*rbpts,*Nextbpts,A,*FnlPts;
 
        TOL= 100.0;
@@ -505,7 +505,7 @@
                        if(UV && Udec) Length-= 
(obj->Length(1)-(obj->getOrder(1)-1))*Udec;
 
                        for(curve= 0; curve < Length; curve++) {
-                               // Load CtlPts for curve into Pts for Degree 
Reduction
+                               // Load CtlPts for curve into Pts for degree 
Reduction
                                if(UV) {
                                        // V Directional Curves
                                        for(i= 0; i < obj->Length(1); i++) {
@@ -544,18 +544,18 @@
                                Order= UV ? obj->getOrder(1) : obj->getOrder(0);
 
                                for(n= 0; n < Dec; n++) {
-                                       Degree= Order-1;
-                                       ph= Degree-1;
+                                       degree= Order-1;
+                                       ph= degree-1;
                                        mh= ph;
 
                                        kind= ph+1;
                                        r= -1;
-                                       a= Degree;
+                                       a= degree;
                                        b= Order;
                                        cind= 1;
-                                       mult= Degree;
+                                       mult= degree;
 
-                                       m= Npts+Degree+1;
+                                       m= Npts+degree+1;
 
                                        Temp[0].x= Pts[0].x;
                                        Temp[0].y= Pts[0].y;
@@ -567,7 +567,7 @@
                                                Uh[i]= KnotVector[0];
 
                                        // Initialize first Bezier segment
-                                       for(i= 0; i <= Degree; i++) {
+                                       for(i= 0; i <= degree; i++) {
                                                bpts[i].x= Pts[i].x;
                                                bpts[i].y= Pts[i].y;
                                                bpts[i].z= Pts[i].z;
@@ -589,7 +589,7 @@
                                                mult= b-i+1;
                                                mh= mh+mult-1;
                                                oldr= r;
-                                               r= Degree-mult;
+                                               r= degree-mult;
 
                                                if(oldr > 0) {
                                                        lbz= (oldr+2)/2;
@@ -600,31 +600,31 @@
                                                if(r > 0) {
                                                        numer= 
KnotVector[b]-KnotVector[a];
 
-                                                       for(k= Degree; k >= 
mult; k--)
+                                                       for(k= degree; k >= 
mult; k--)
                                                                if(k-mult-1 >= 
0) // WTF?
                                                                        
alphas[k-mult-1]= numer/(KnotVector[a+k]-KnotVector[a]);
 
                                                        for(j= 1; j <= r; j++) {
                                                                save= r-j;
                                                                s= mult+j;
-                                                               for(k= Degree; 
k >= s; k--) {
+                                                               for(k= degree; 
k >= s; k--) {
                                                                        
bpts[k].x= alphas[k-s]*bpts[k].x + (1.0-alphas[k-s])*bpts[k-1].x;
                                                                        
bpts[k].y= alphas[k-s]*bpts[k].y + (1.0-alphas[k-s])*bpts[k-1].y;
                                                                        
bpts[k].z= alphas[k-s]*bpts[k].z + (1.0-alphas[k-s])*bpts[k-1].z;
                                                                        
bpts[k].H= alphas[k-s]*bpts[k].H + (1.0-alphas[k-s])*bpts[k-1].H;
                                                                } //eof
 
-                                                               
Nextbpts[save].x= bpts[Degree].x;
-                                                               
Nextbpts[save].y= bpts[Degree].y;
-                                                               
Nextbpts[save].z= bpts[Degree].z;
-                                                               
Nextbpts[save].H= bpts[Degree].H;
+                                                               
Nextbpts[save].x= bpts[degree].x;
+                                                               
Nextbpts[save].y= bpts[degree].y;
+                                                               
Nextbpts[save].z= bpts[degree].z;
+                                                               
Nextbpts[save].H= bpts[degree].H;
                                                        } //eof
                                                } //fi
 
                                                // Degree Reduce Bezier Segment
-                                               
bezDegReduce(bpts,rbpts,Degree,MaxErr);
+                                               
bezDegReduce(bpts,rbpts,degree,maxErr);
 
-                                               error[a]= error[a]+MaxErr;
+                                               error[a]= error[a]+maxErr;
                                                if(error[a] > TOL) {
                                                        // Curve not degree 
reducible

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to