Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-09-10 06:57:25 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-09-10 06:57:25 +0400
commit2fc4ee354574d52200544eec00aed95442cf4d04 (patch)
tree3a0871054cd05a9ae6cd5fd1c39a2dbd1a62a82a /source/blender/blenkernel/intern/anim.c
parent4cb53d91ea1843dc0cb2c1d4c846e5a1974a20eb (diff)
Curve cleanup
Renamed BevPoint's members * x,y,z -> vec[3]; compatible with other functions. * f1 -> split_tag; used by displist to set the splitting flag. * f2 -> dupe_tag; used in curve.c to remove duplicates. BevList * flag -> dupe_nr; was being used as a counter for duplicate points. * use arithb.c functions where possible. * arrays for coords, tilt and radius were being allocated, then copied into the BevPoint's, now write directly into the values without allocing/freeing arrays.
Diffstat (limited to 'source/blender/blenkernel/intern/anim.c')
-rw-r--r--source/blender/blenkernel/intern/anim.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index e75b31dd892..2e08763821f 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -86,11 +86,11 @@ void free_path(Path *path)
void calc_curvepath(Object *ob)
{
BevList *bl;
- BevPoint *bevp, *bevpn, *bevpfirst, *bevplast, *tempbevp;
+ BevPoint *bevp, *bevpn, *bevpfirst, *bevplast;
Curve *cu;
Nurb *nu;
Path *path;
- float *fp, *dist, *maxdist, x, y, z;
+ float *fp, *dist, *maxdist, xyz[3];
float fac, d=0, fac1, fac2;
int a, tot, cycl=0;
float *ft;
@@ -129,19 +129,12 @@ void calc_curvepath(Object *ob)
*fp= 0;
for(a=0; a<tot; a++) {
fp++;
- if(cycl && a==tot-1) {
- x= bevpfirst->x - bevp->x;
- y= bevpfirst->y - bevp->y;
- z= bevpfirst->z - bevp->z;
- }
- else {
- tempbevp = bevp+1;
- x= (tempbevp)->x - bevp->x;
- y= (tempbevp)->y - bevp->y;
- z= (tempbevp)->z - bevp->z;
- }
- *fp= *(fp-1)+ (float)sqrt(x*x+y*y+z*z);
+ if(cycl && a==tot-1)
+ VecSubf(xyz, bevpfirst->vec, bevp->vec);
+ else
+ VecSubf(xyz, (bevp+1)->vec, bevp->vec);
+ *fp= *(fp-1)+VecLength(xyz);
bevp++;
}
@@ -178,14 +171,11 @@ void calc_curvepath(Object *ob)
fac2= *(fp)-d;
fac1= fac2/fac1;
fac2= 1.0f-fac1;
-
- ft[0]= fac1*bevp->x+ fac2*(bevpn)->x;
- ft[1]= fac1*bevp->y+ fac2*(bevpn)->y;
- ft[2]= fac1*bevp->z+ fac2*(bevpn)->z;
+
+ VecLerpf(ft, bevp->vec, bevpn->vec, fac2);
ft[3]= fac1*bevp->alfa+ fac2*(bevpn)->alfa;
ft+= 4;
-
}
MEM_freeN(dist);