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/blenkernel/intern/mesh.c | |
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/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 6ef557ca879..d5c597b802c 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -70,7 +70,7 @@ #include "BLI_blenlib.h" #include "BLI_editVert.h" -#include "BLI_arithb.h" +#include "BLI_math.h" #include "BLI_edgehash.h" @@ -1086,7 +1086,7 @@ void mesh_to_curve(Scene *scene, Object *ob) /* add points */ vl= polyline.first; for (i=0, bp=nu->bp; i < totpoly; i++, bp++, vl=(VertLink *)vl->next) { - VecCopyf(bp->vec, mverts[vl->index].co); + copy_v3_v3(bp->vec, mverts[vl->index].co); bp->f1= SELECT; bp->radius = bp->weight = 1.0; } @@ -1146,23 +1146,23 @@ void mesh_calc_normals(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float *f_no= &fnors[i*3]; if (mf->v4) - CalcNormFloat4(mverts[mf->v1].co, mverts[mf->v2].co, mverts[mf->v3].co, mverts[mf->v4].co, f_no); + normal_quad_v3( f_no,mverts[mf->v1].co, mverts[mf->v2].co, mverts[mf->v3].co, mverts[mf->v4].co); else - CalcNormFloat(mverts[mf->v1].co, mverts[mf->v2].co, mverts[mf->v3].co, f_no); + normal_tri_v3( f_no,mverts[mf->v1].co, mverts[mf->v2].co, mverts[mf->v3].co); - VecAddf(tnorms[mf->v1], tnorms[mf->v1], f_no); - VecAddf(tnorms[mf->v2], tnorms[mf->v2], f_no); - VecAddf(tnorms[mf->v3], tnorms[mf->v3], f_no); + add_v3_v3v3(tnorms[mf->v1], tnorms[mf->v1], f_no); + add_v3_v3v3(tnorms[mf->v2], tnorms[mf->v2], f_no); + add_v3_v3v3(tnorms[mf->v3], tnorms[mf->v3], f_no); if (mf->v4) - VecAddf(tnorms[mf->v4], tnorms[mf->v4], f_no); + add_v3_v3v3(tnorms[mf->v4], tnorms[mf->v4], f_no); } for (i=0; i<numVerts; i++) { MVert *mv= &mverts[i]; float *no= tnorms[i]; - if (Normalize(no)==0.0) { + if (normalize_v3(no)==0.0) { VECCOPY(no, mv->co); - Normalize(no); + normalize_v3(no); } mv->no[0]= (short)(no[0]*32767.0); @@ -1262,7 +1262,7 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned next= iterv->next; uv2= (tf+iterv->f)->uv[iterv->tfindex]; - Vec2Subf(uvdiff, uv2, uv); + sub_v2_v2v2(uvdiff, uv2, uv); if(fabs(uv[0]-uv2[0]) < limit[0] && fabs(uv[1]-uv2[1]) < limit[1]) { |