From 4efdabfbbc3f4f79328241e8b59002d869ae247a Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Tue, 21 Oct 2003 13:22:07 +0000 Subject: Constraint stuff from tuhopuu including (but probably not limited too): Axis options for TrackTo LockTrack FollowPath Auto creation of TrackTo constraint from Ctrl-T (old track still an option) Auto creation of FollowPath when parenting to path (Normal parent still an option) Backward compatibility stuff to convert the per object axis settings to per constraint when a Track constraint is present. Function to convert old track to constraint (commented out) Revamped the constraints interface with Matt's work from tuhopuu and the stuff we were discussing earlier. -------------------- For coders: unique_constraint_name and *new_constraint_data moved to the kernel (constraint.c) new Projf function in arithb gives the projection of a vector on another vector add_new_constraint now takes a constraint type (int) parameter add_constraint_to_object(bConstraint *con, Object *ob) to link a constraint to an object add_constraint_to_client(bConstraint *con) to link constraint to current client (object or bone) add_influence_key_to_constraint (bConstraint *con) to (eventually) add a keyframe to the influence IPO of a constraint --- source/blender/blenlib/intern/arithb.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/blender/blenlib/intern/arithb.c') diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index fa13f8223a8..715917d047f 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -119,6 +119,17 @@ float Inpf( float *v1, float *v2) return v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2]; } +/* Project v1 on v2 */ +void Projf(float *c, const float *v1, const float *v2) +{ + float mul; + mul = Inpf(v1, v2) / Inpf(v2, v2); + + c[0] = mul * v2[0]; + c[1] = mul * v2[1]; + c[2] = mul * v2[2]; +} + void Mat3Transp(float mat[][3]) { float t; -- cgit v1.2.3