diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-11-10 23:43:45 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-11-10 23:43:45 +0300 |
commit | 37e4a311b0ad9da7177e50620efc3561e2dd7045 (patch) | |
tree | 8aea2cc851ab828ee040d601ed4c776283fd639a /source/blender/editors/gpencil | |
parent | 4617bb68ba4b1c5ab459673fffd98bf7203bb4f2 (diff) |
Math Lib
* Convert all code to use new functions.
* Branch maintainers may want to skip this commit, and run this
conversion script instead, if they use a lot of math functions
in new code:
http://www.pasteall.org/9052/python
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/drawgpencil.c | 10 | ||||
-rw-r--r-- | source/blender/editors/gpencil/editaction_gpencil.c | 2 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_buttons.c | 2 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 14 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 8 |
5 files changed, 18 insertions, 18 deletions
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index dcd57efa926..9a0187dde04 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -37,7 +37,7 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" -#include "BLI_arithb.h" +#include "BLI_math.h" #include "BLI_blenlib.h" #include "DNA_gpencil_types.h" @@ -326,7 +326,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, /* calculate gradient and normal - 'angle'=(ny/nx) */ m1[1]= s1[1] - s0[1]; m1[0]= s1[0] - s0[0]; - Normalize2(m1); + normalize_v2(m1); m2[1]= -m1[0]; m2[0]= m1[1]; @@ -374,7 +374,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, /* calculate gradient of bisector (as average of normals) */ mb[0]= (pm[0] + m2[0]) / 2; mb[1]= (pm[1] + m2[1]) / 2; - Normalize2(mb); + normalize_v2(mb); /* calculate gradient to apply * - as basis, use just pthick * bisector gradient @@ -382,7 +382,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, */ mt[0]= mb[0] * pthick; mt[1]= mb[1] * pthick; - athick= Vec2Length(mt); + athick= len_v2(mt); dfac= pthick - (athick * 2); if ( ((athick * 2) < pthick) && (IS_EQ(athick, pthick)==0) ) { @@ -442,7 +442,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, } /* store stroke's 'natural' normal for next stroke to use */ - Vec2Copyf(pm, m2); + copy_v2_v2(pm, m2); } glEnd(); diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index beb4ed06810..88ceba88827 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -33,7 +33,7 @@ #include "MEM_guardedalloc.h" -#include "BLI_arithb.h" +#include "BLI_math.h" #include "BLI_blenlib.h" #include "DNA_listBase.h" diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c index b25de4d5f1d..4da5ec02ddc 100644 --- a/source/blender/editors/gpencil/gpencil_buttons.c +++ b/source/blender/editors/gpencil/gpencil_buttons.c @@ -32,7 +32,7 @@ #include "MEM_guardedalloc.h" -#include "BLI_arithb.h" +#include "BLI_math.h" #include "BLI_blenlib.h" #include "DNA_gpencil_types.h" diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 6b76c48e1bf..1358ed80f7a 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -37,7 +37,7 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" -#include "BLI_arithb.h" +#include "BLI_math.h" #include "BLI_blenlib.h" #include "DNA_listBase.h" @@ -368,7 +368,7 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi if (gps->flag & GP_STROKE_3DSPACE) { /* directly use 3d-coordinates */ - VecCopyf(p3d, &pt->x); + copy_v3_v3(p3d, &pt->x); } else { float *fp= give_cursor(scene, v3d); @@ -393,7 +393,7 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi */ project_short_noclip(ar, fp, mval); window_to_3d(ar, dvec, mval[0]-mx, mval[1]-my); - VecSubf(p3d, fp, dvec); + sub_v3_v3v3(p3d, fp, dvec); } } @@ -424,7 +424,7 @@ static void gp_stroke_to_path (bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Cur /* get coordinates to add at */ gp_strokepoint_convertcoords(C, gps, pt, p3d); - VecCopyf(bp->vec, p3d); + copy_v3_v3(bp->vec, p3d); /* set settings */ bp->f1= SELECT; @@ -460,9 +460,9 @@ static void gp_stroke_to_bezier (bContext *C, bGPDlayer *gpl, bGPDstroke *gps, C gp_strokepoint_convertcoords(C, gps, pt, p3d); /* TODO: maybe in future the handles shouldn't be in same place */ - VecCopyf(bezt->vec[0], p3d); - VecCopyf(bezt->vec[1], p3d); - VecCopyf(bezt->vec[2], p3d); + copy_v3_v3(bezt->vec[0], p3d); + copy_v3_v3(bezt->vec[1], p3d); + copy_v3_v3(bezt->vec[2], p3d); /* set settings */ bezt->h1= bezt->h2= HD_FREE; diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 92ae2400666..64e68fab508 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -34,7 +34,7 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "BLI_arithb.h" +#include "BLI_math.h" #include "BKE_gpencil.h" #include "BKE_context.h" @@ -169,11 +169,11 @@ static void gp_get_3d_reference (tGPsdata *p, float *vec) /* active Object * - use relative distance of 3D-cursor from object center */ - VecSubf(vec, fp, ob->loc); + sub_v3_v3v3(vec, fp, ob->loc); } else { /* use 3D-cursor */ - VecCopyf(vec, fp); + copy_v3_v3(vec, fp); } } @@ -228,7 +228,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[], float out[]) /* method taken from editview.c - mouse_cursor() */ project_short_noclip(p->ar, rvec, mval); window_to_3d_delta(p->ar, dvec, mval[0]-mx, mval[1]-my); - VecSubf(out, rvec, dvec); + sub_v3_v3v3(out, rvec, dvec); } /* 2d - on 'canvas' (assume that p->v2d is set) */ |