diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-12-16 15:32:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-12-16 15:32:10 +0300 |
commit | 882d85a96827cb50d1fc4a2ac1d63b902aab8f86 (patch) | |
tree | d9c779a282ac712ed4a522ad2380c72c1668fa04 /source/blender/blenlib | |
parent | 4da3c4b9d5ede4369467165cb9f31eee4385a353 (diff) |
Patch from Banlu Kemiyatorn
replace VecMulf(var,-1) with new VecNegf(var) function.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_arithb.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/arithb.c | 11 | ||||
-rw-r--r-- | source/blender/blenlib/intern/graph.c | 6 |
3 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h index e4b983d9ba3..fd58aa318da 100644 --- a/source/blender/blenlib/BLI_arithb.h +++ b/source/blender/blenlib/BLI_arithb.h @@ -241,6 +241,7 @@ int VecLen(int *v1, int *v2); float VecLenf(float *v1, float *v2); float VecLength(float *v); void VecMulf(float *v1, float f); +void VecNegf(float *v1); int VecLenCompare(float *v1, float *v2, float limit); int VecCompare(float *v1, float *v2, float limit); diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index e606092f72d..61cbf791bf1 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -2183,6 +2183,13 @@ void VecMulf(float *v1, float f) v1[2]*= f; } +void VecNegf(float *v1) +{ + v1[0] = -v1[0]; + v1[1] = -v1[1]; + v1[2] = -v1[2]; +} + void VecOrthoBasisf(float *v, float *v1, float *v2) { float f = sqrt(v[0]*v[0] + v[1]*v[1]); @@ -3945,7 +3952,7 @@ int SweepingSphereIntersectsTriangleUV(float p1[3], float p2[3], float radius, f Normalize(nor); /* flip normal */ - if(Inpf(nor,vel)>0.0f) VecMulf(nor,-1.0f); + if(Inpf(nor,vel)>0.0f) VecNegf(nor); a=Inpf(p1,nor)-Inpf(v0,nor); nordotv=Inpf(nor,vel); @@ -4616,7 +4623,7 @@ void tangent_from_uv(float *uv1, float *uv2, float *uv3, float *co1, float *co2, /* check flip */ if ((ct[0]*n[0] + ct[1]*n[1] + ct[2]*n[2]) < 0.0f) - VecMulf(tang, -1.0f); + VecNegf(tang); } /* used for zoom values*/ diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c index 8f35b38379e..bcd8a2ce7cd 100644 --- a/source/blender/blenlib/intern/graph.c +++ b/source/blender/blenlib/intern/graph.c @@ -809,15 +809,15 @@ static void testAxialSymmetry(BGraph *graph, BNode* root_node, BNode* node1, BNo if (abs(nor[0]) > abs(nor[1]) && abs(nor[0]) > abs(nor[2]) && nor[0] < 0) { - VecMulf(nor, -1); + VecNegf(nor); } else if (abs(nor[1]) > abs(nor[0]) && abs(nor[1]) > abs(nor[2]) && nor[1] < 0) { - VecMulf(nor, -1); + VecNegf(nor); } else if (abs(nor[2]) > abs(nor[1]) && abs(nor[2]) > abs(nor[0]) && nor[2] < 0) { - VecMulf(nor, -1); + VecNegf(nor); } /* mirror node2 along axis */ |