[Bf-python] AngleBetweenVecs found solution
Martin DeMello
martindemello at gmail.com
Mon Oct 10 06:11:45 CEST 2005
On 10/10/05, Campbell Barton <cbarton at metavr.com> wrote:
> //normalize vectors
> norm_a = (double)sqrt(test_v1);
> norm_b = (double)sqrt(test_v2);
> for(x = 0; x < size; x++) {
> vec_a[x] /= norm_a;
> vec_b[x] /= norm_b;
> }
> //dot product
> for(x = 0; x < size; x++) {
> dot += vec_a[x] * vec_b[x];
> }
I think it would be slightly more accurate to take the dot product of
the unnormalised vectors, then divide by (norm_a * norm_b)
martin
More information about the Bf-python
mailing list