From deccefc029e3a8e07e0b37eb6453ffce5e772c74 Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Tue, 22 Jul 2008 17:44:06 +0000 Subject: First draft for control bones repositioning. All bones marked as no deform are repositioned after the retarget based on their "linked" bone (linked bone is constraint owner if control bone is a target, parent bone if not). Arithb: Function to make a quat between two normalized vectors --- source/blender/blenlib/BLI_arithb.h | 1 + source/blender/blenlib/intern/arithb.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h index c22b6f79e08..ccb592bba05 100644 --- a/source/blender/blenlib/BLI_arithb.h +++ b/source/blender/blenlib/BLI_arithb.h @@ -262,6 +262,7 @@ void Vec2Subf(float *v, float *v1, float *v2); void Vec2Copyf(float *v1, float *v2); 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); float VecAngle2(float *v1, float *v2); diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index c97ca3c6a8a..6685e1b6dc5 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -1335,6 +1335,18 @@ void NormalQuat(float *q) } } +void RotationBetweenVectorsToQuat(float *q, float v1[3], float v2[3]) +{ + float axis[3]; + float angle; + + Crossf(axis, v1, v2); + + angle = NormalizedVecAngle2(v1, v2); + + AxisAngleToQuat(q, axis, angle); +} + void AxisAngleToQuat(float *q, float *axis, float angle) { float nor[3]; -- cgit v1.2.3