diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-06 19:17:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-06 19:17:43 +0400 |
commit | ec3b0c6a968210512e0c36e1e62eefcbe0cf1ea0 (patch) | |
tree | 8539e5cf67d14b2256d3171ffb3d1f22d371bf82 /source/blender/editors | |
parent | 0634d8a7458c9fed536f3240edf610587ec63067 (diff) |
misc macro --> bli math lib functions
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 56 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawvolume.c | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 2 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_draw.c | 28 |
5 files changed, 47 insertions, 46 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 4a12206d404..0556291c197 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -816,7 +816,7 @@ static void calc_shapeKeys(Object *obedit) if (oldbezt) { int j; for (j= 0; j < 3; ++j) { - VECSUB(ofs[i], bezt->vec[j], oldbezt->vec[j]); + sub_v3_v3v3(ofs[i], bezt->vec[j], oldbezt->vec[j]); i++; } ofs[i++][0]= bezt->alfa - oldbezt->alfa; @@ -832,7 +832,7 @@ static void calc_shapeKeys(Object *obedit) while(a--) { oldbp= getKeyIndexOrig_bp(editnurb, bp); if (oldbp) { - VECSUB(ofs[i], bp->vec, oldbp->vec); + sub_v3_v3v3(ofs[i], bp->vec, oldbp->vec); ofs[i+1][0]= bp->alfa - oldbp->alfa; } i += 2; @@ -866,10 +866,10 @@ static void calc_shapeKeys(Object *obedit) oldbezt= getKeyIndexOrig_bezt(editnurb, bezt); for (j= 0; j < 3; ++j, ++i) { - VECCOPY(fp, bezt->vec[j]); + copy_v3_v3(fp, bezt->vec[j]); if (restore && oldbezt) { - VECCOPY(bezt->vec[j], oldbezt->vec[j]); + copy_v3_v3(bezt->vec[j], oldbezt->vec[j]); } fp+= 3; @@ -890,12 +890,12 @@ static void calc_shapeKeys(Object *obedit) while(a--) { oldbp= getKeyIndexOrig_bp(editnurb, bp); - VECCOPY(fp, bp->vec); + copy_v3_v3(fp, bp->vec); fp[3]= bp->alfa; if(restore && oldbp) { - VECCOPY(bp->vec, oldbp->vec); + copy_v3_v3(bp->vec, oldbp->vec); bp->alfa= oldbp->alfa; } @@ -921,10 +921,10 @@ static void calc_shapeKeys(Object *obedit) curofp= ofp + index; for (j= 0; j < 3; ++j, ++i) { - VECCOPY(fp, curofp); + copy_v3_v3(fp, curofp); if(apply_offset) { - VECADD(fp, fp, ofs[i]); + add_v3_v3(fp, ofs[i]); } fp+= 3; curofp+= 3; @@ -933,7 +933,7 @@ static void calc_shapeKeys(Object *obedit) if(apply_offset) { /* apply alfa offsets */ - VECADD(fp, fp, ofs[i]); + add_v3_v3(fp, ofs[i]); ++i; } @@ -941,7 +941,7 @@ static void calc_shapeKeys(Object *obedit) } else { int j; for (j= 0; j < 3; ++j, ++i) { - VECCOPY(fp, bezt->vec[j]); + copy_v3_v3(fp, bezt->vec[j]); fp+= 3; } fp[0]= bezt->alfa; @@ -959,15 +959,15 @@ static void calc_shapeKeys(Object *obedit) if (index >= 0) { curofp= ofp + index; - VECCOPY(fp, curofp); + copy_v3_v3(fp, curofp); fp[3]= curofp[3]; if(apply_offset) { - VECADD(fp, fp, ofs[i]); + add_v3_v3(fp, ofs[i]); fp[3]+=ofs[i+1][0]; } } else { - VECCOPY(fp, bp->vec); + copy_v3_v3(fp, bp->vec); fp[3]= bp->alfa; } @@ -2890,14 +2890,14 @@ static void subdividenurb(Object *obedit, int number_cuts) interp_v3_v3v3(vec+12, vec+3, vec+6, factor); /* change handle of prev beztn */ - VECCOPY((beztn-1)->vec[2], vec); + copy_v3_v3((beztn-1)->vec[2], vec); /* new point */ - VECCOPY(beztn->vec[0], vec+9); + copy_v3_v3(beztn->vec[0], vec+9); interp_v3_v3v3(beztn->vec[1], vec+9, vec+12, factor); - VECCOPY(beztn->vec[2], vec+12); + copy_v3_v3(beztn->vec[2], vec+12); /* handle of next bezt */ - if(a==0 && i == number_cuts - 1 && (nu->flagu & CU_NURB_CYCLIC)) {VECCOPY(beztnew->vec[0], vec+6);} - else {VECCOPY(bezt->vec[0], vec+6);} + if(a==0 && i == number_cuts - 1 && (nu->flagu & CU_NURB_CYCLIC)) {copy_v3_v3(beztnew->vec[0], vec+6);} + else {copy_v3_v3(bezt->vec[0], vec+6);} beztn->radius = (prevbezt->radius + bezt->radius)/2; beztn->weight = (prevbezt->weight + bezt->weight)/2; @@ -3381,7 +3381,7 @@ static int convertspline(short type, Nurb *nu) a= nr; bp= nu->bp; while(a--) { - VECCOPY(bezt->vec[1], bp->vec); + copy_v3_v3(bezt->vec[1], bp->vec); bezt->f1=bezt->f2=bezt->f3= bp->f1; bezt->h1= bezt->h2= HD_VECT; bezt->weight= bp->weight; @@ -3418,7 +3418,7 @@ static int convertspline(short type, Nurb *nu) while(a--) { if(type==CU_POLY && bezt->h1==HD_VECT && bezt->h2==HD_VECT) { /* vector handle becomes 1 poly vertice */ - VECCOPY(bp->vec, bezt->vec[1]); + copy_v3_v3(bp->vec, bezt->vec[1]); bp->vec[3]= 1.0; bp->f1= bezt->f2; nr-= 2; @@ -3428,7 +3428,7 @@ static int convertspline(short type, Nurb *nu) } else { for(c=0;c<3;c++) { - VECCOPY(bp->vec, bezt->vec[c]); + copy_v3_v3(bp->vec, bezt->vec[c]); bp->vec[3]= 1.0; if(c==0) bp->f1= bezt->f1; else if(c==1) bp->f1= bezt->f2; @@ -3475,13 +3475,13 @@ static int convertspline(short type, Nurb *nu) a= nr; bp= nu->bp; while(a--) { - VECCOPY(bezt->vec[0], bp->vec); + copy_v3_v3(bezt->vec[0], bp->vec); bezt->f1= bp->f1; bp++; - VECCOPY(bezt->vec[1], bp->vec); + copy_v3_v3(bezt->vec[1], bp->vec); bezt->f2= bp->f1; bp++; - VECCOPY(bezt->vec[2], bp->vec); + copy_v3_v3(bezt->vec[2], bp->vec); bezt->f3= bp->f1; bezt->radius= bp->radius; bezt->weight= bp->weight; @@ -4472,7 +4472,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) (BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb"); ED_curve_beztcpy(editnurb, newbezt, nu->bezt, nu->pntsu); *(newbezt+nu->pntsu)= *bezt; - VECCOPY(temp, bezt->vec[1]); + copy_v3_v3(temp, bezt->vec[1]); MEM_freeN(nu->bezt); nu->bezt= newbezt; newbezt+= nu->pntsu; @@ -4491,7 +4491,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) BEZ_SEL(newbezt); cu->lastsel= newbezt; newbezt->h2= newbezt->h1; - VECCOPY(temp, bezt->vec[1]); + copy_v3_v3(temp, bezt->vec[1]); MEM_freeN(nu->bezt); nu->bezt= newbezt; bezt= newbezt+1; @@ -4503,7 +4503,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) *newbezt= *bezt; BEZ_SEL(newbezt); newbezt->h2= newbezt->h1; - VECCOPY(temp, bezt->vec[1]); + copy_v3_v3(temp, bezt->vec[1]); newnu= (Nurb*)MEM_mallocN(sizeof(Nurb), "addvert_Nurb newnu"); memcpy(newnu, nu, sizeof(Nurb)); @@ -6189,7 +6189,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) if(rv3d) { copy_m4_m4(viewmat, rv3d->viewmat); - VECCOPY(zvec, rv3d->viewinv[2]); + copy_v3_v3(zvec, rv3d->viewinv[2]); } setflagsNurb(editnurb, 0); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index c26a4d52a9e..754ccd1fd5e 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2297,8 +2297,9 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3]) ofs= key_to_vertcos(ob, kb); /* calculate key coord offsets (from previous location) */ - for (a= 0; a < me->totvert; a++) - VECSUB(ofs[a], vertCos[a], ofs[a]); + for (a= 0; a < me->totvert; a++) { + sub_v3_v3v3(ofs[a], vertCos[a], ofs[a]); + } /* apply offsets on other keys */ currkey = me->key->block.first; diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 7c89ce0f689..6605d488d36 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -242,7 +242,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3 tstart(); - VECSUB(size, max, min); + sub_v3_v3v3(size, max, min); // maxx, maxy, maxz cv[0][0] = max[0]; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index c3a77dc67a5..5d3e05dcaab 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -3882,7 +3882,7 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2])) else { d = distance; } - VECADDFAC(td->loc,td->center,td->axismtx[0],(*td->val)*d); + madd_v3_v3v3fl(td->loc, td->center, td->axismtx[0], (*td->val) * d); } recalcData(t); diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 8a50ec28bd6..0f21aa3759c 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -267,10 +267,10 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac #endif /* uv angles */ - VECSUB2D(av1, tf_uv[3], tf_uv[0]); normalize_v2(av1); - VECSUB2D(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2); - VECSUB2D(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3); - VECSUB2D(av4, tf_uv[2], tf_uv[3]); normalize_v2(av4); + sub_v2_v2v2(av1, tf_uv[3], tf_uv[0]); normalize_v2(av1); + sub_v2_v2v2(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2); + sub_v2_v2v2(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3); + sub_v2_v2v2(av4, tf_uv[2], tf_uv[3]); normalize_v2(av4); /* This is the correct angle however we are only comparing angles * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * RAD2DEGF(1.0f))-90);*/ @@ -280,10 +280,10 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac uvang4 = angle_normalized_v2v2(av4, av1); /* 3d angles */ - VECSUB(av1, efa->v4->co, efa->v1->co); normalize_v3(av1); - VECSUB(av2, efa->v1->co, efa->v2->co); normalize_v3(av2); - VECSUB(av3, efa->v2->co, efa->v3->co); normalize_v3(av3); - VECSUB(av4, efa->v3->co, efa->v4->co); normalize_v3(av4); + sub_v3_v3v3(av1, efa->v4->co, efa->v1->co); normalize_v3(av1); + sub_v3_v3v3(av2, efa->v1->co, efa->v2->co); normalize_v3(av2); + sub_v3_v3v3(av3, efa->v2->co, efa->v3->co); normalize_v3(av3); + sub_v3_v3v3(av4, efa->v3->co, efa->v4->co); normalize_v3(av4); /* This is the correct angle however we are only comparing angles * ang1 = 90-((angle_normalized_v3v3(av1, av2) * RAD2DEGF(1.0f))-90);*/ @@ -328,9 +328,9 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac #endif /* uv angles */ - VECSUB2D(av1, tf_uv[2], tf_uv[0]); normalize_v2(av1); - VECSUB2D(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2); - VECSUB2D(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3); + sub_v2_v2v2(av1, tf_uv[2], tf_uv[0]); normalize_v2(av1); + sub_v2_v2v2(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2); + sub_v2_v2v2(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3); /* This is the correct angle however we are only comparing angles * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90); */ @@ -339,9 +339,9 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac uvang3 = angle_normalized_v2v2(av3, av1); /* 3d angles */ - VECSUB(av1, efa->v3->co, efa->v1->co); normalize_v3(av1); - VECSUB(av2, efa->v1->co, efa->v2->co); normalize_v3(av2); - VECSUB(av3, efa->v2->co, efa->v3->co); normalize_v3(av3); + sub_v3_v3v3(av1, efa->v3->co, efa->v1->co); normalize_v3(av1); + sub_v3_v3v3(av2, efa->v1->co, efa->v2->co); normalize_v3(av2); + sub_v3_v3v3(av3, efa->v2->co, efa->v3->co); normalize_v3(av3); /* This is the correct angle however we are only comparing angles * ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90); */ ang1 = angle_normalized_v3v3(av1, av2); |