diff options
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_arithb.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/arithb.c | 9 |
3 files changed, 9 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 709507a9b26..25af0cb5ce3 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1903,7 +1903,7 @@ void makeBevelList(Object *ob) } /* this has to be >2 points */ else if(cu->flag & CU_NO_TWIST && cu->flag & CU_3D && bl->poly != -1) { - /* Special case, cyclic curve with no twisy. tricky... */ + /* Special case, cyclic curve with no twist. tricky... */ float quat[4], q[4], cross[3]; @@ -1924,7 +1924,7 @@ void makeBevelList(Object *ob) while(nr--) { /* Normalizes */ - Vec3ToTangent(vec, &bevp0->x, &bevp1->x, &bevp2->x); + VecBisect3(vec, &bevp0->x, &bevp1->x, &bevp2->x); if(bl->nr==nr+1) { /* first time */ vectoquat(vec, 5, 1, quat); @@ -1976,7 +1976,7 @@ void makeBevelList(Object *ob) nr= bl->nr; while(nr--) { - Vec3ToTangent(vec, &bevp0->x, &bevp1->x, &bevp2->x); + VecBisect3(vec, &bevp0->x, &bevp1->x, &bevp2->x); quat_tmp1= (float *)bevp1->mat; quat_tmp2= quat_tmp1+4; @@ -2014,7 +2014,7 @@ void makeBevelList(Object *ob) if(cu->flag & CU_3D) { /* 3D */ /* Normalizes */ - Vec3ToTangent(vec, &bevp0->x, &bevp1->x, &bevp2->x); + VecBisect3(vec, &bevp0->x, &bevp1->x, &bevp2->x); if(bl->nr==nr+1 || !(cu->flag & CU_NO_TWIST)) { /* first time */ vectoquat(vec, 5, 1, quat); diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h index 63b351016d4..86b626dabdf 100644 --- a/source/blender/blenlib/BLI_arithb.h +++ b/source/blender/blenlib/BLI_arithb.h @@ -270,7 +270,7 @@ void AxisAngleToQuat(float *q, float *axis, float angle); void RotationBetweenVectorsToQuat(float *q, float v1[3], float v2[3]); void vectoquat(float *vec, short axis, short upflag, float *q); -void Vec3ToTangent(float *v, float *v1, float *v2, float *v3); +void VecBisect3(float *v, float *v1, float *v2, float *v3); float VecAngle2(float *v1, float *v2); float VecAngle3(float *v1, float *v2, float *v3); float NormalizedVecAngle2(float *v1, float *v2); diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index 970d8f7d0de..c20794953b9 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -2969,17 +2969,16 @@ void VecRotToQuat( float *vec, float phi, float *quat) } } -/* get a direction from 3 vectors that wont depend - * on the distance between the points */ -void Vec3ToTangent(float *v, float *v1, float *v2, float *v3) +/* Returns a vector bisecting the angle at v2 formed by v1, v2 and v3 */ +void VecBisect3(float *out, float *v1, float *v2, float *v3) { float d_12[3], d_23[3]; VecSubf(d_12, v2, v1); VecSubf(d_23, v3, v2); Normalize(d_12); Normalize(d_23); - VecAddf(v, d_12, d_23); - Normalize(v); + VecAddf(out, d_12, d_23); + Normalize(out); } /* Return the angle in degrees between vecs 1-2 and 2-3 in degrees |