diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-09-07 12:31:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-09-07 12:31:03 +0400 |
commit | d779410600de3061539c8c433c7a8c72cff022c0 (patch) | |
tree | 516539b2ca6aafb56121e2d1f2f23eca8c950763 /source/blender/blenlib | |
parent | f5e80e7a80feb4b516792b961c2310210536aef8 (diff) | |
parent | 3b743ac5565663d2fd0be4bbbc92e404afafbce4 (diff) |
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r22935:23022
looks like 2 merges are needed to skip a commit.
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 | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h index 2ab60c6a8d0..2ce4e8e268c 100644 --- a/source/blender/blenlib/BLI_arithb.h +++ b/source/blender/blenlib/BLI_arithb.h @@ -380,6 +380,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); 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 2e60fbba4c9..55bdc32c4e9 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -3374,6 +3374,19 @@ 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) +{ + 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); +} + /* Return the angle in degrees between vecs 1-2 and 2-3 in degrees If v1 is a shoulder, v2 is the elbow and v3 is the hand, this would return the angle at the elbow */ |