fix for own bugs in curves.
[blender.git] / source / blender / blenkernel / intern / curve.c
index c29a92558d644a21eeac5c57efd317efa8e1a799..b090ac2b538466081caa7dc58f167af137fbe179 100644 (file)
@@ -832,7 +832,9 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
        if(len==0) return;
        sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbcurve1");
        
-       resolu= (resolu*SEGMENTSU(nu))+1;
+       resolu= (resolu*SEGMENTSU(nu));
+       if((nu->flagu & CU_CYCLIC)==0) resolu++;
+       
        if(resolu==0) {
                MEM_freeN(sum);
                return;
@@ -842,7 +844,8 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
        ustart= fp[nu->orderu-1];
        if(nu->flagu & CU_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
        else uend= fp[nu->pntsu];
-       ustep= (uend-ustart)/(resolu-1);
+       ustep= (uend-ustart)/(resolu - ((nu->flagu & CU_CYCLIC) ? 0 : 1));
+       
        basisu= (float *)MEM_mallocN(sizeof(float)*KNOTSU(nu), "makeNurbcurve3");
 
        if(nu->flagu & CU_CYCLIC) cycl= nu->orderu-1; 
@@ -1678,7 +1681,9 @@ void makeBevelList(Object *ob)
                        }
                        else if((nu->type & 7)==CU_NURBS) {
                                if(nu->pntsv==1) {
-                                       len= (resolu*SEGMENTSU(nu))+1;
+                                       len= (resolu*SEGMENTSU(nu));
+                                       if((nu->flagu & CU_CYCLIC)==0) len++;
+                                       
                                        bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList3");
                                        BLI_addtail(&(cu->bev), bl);
                                        bl->nr= len;