[Bf-committers] Re: Re: [Bf-blender-cvs] CVS
commit:blender/source/blender/python/api2_2x Mathutils.c
Gilbert, Joseph
jgilbert at tigr.ORG
Mon Oct 10 21:43:03 CEST 2005
Things are mostly ok. but when comparing 2 self vectors (which should
produce a theta of 0) the dot product is a hair over 1.0 (1 + 1e-20)
because of rounding issues (vectors store data as a float). The result
is that some self comparisons throw NAN when passed to acos() (which was
the bug being fixed).
The epsilon test is nice. I haven't had any problems testing zero
vectors so far though. Also test_v1 is so small you'd need a really,
really small number for epsilon.
-----Original Message-----
From: bf-committers-bounces at projects.blender.org
[mailto:bf-committers-bounces at projects.blender.org] On Behalf Of GSR
Sent: Monday, October 10, 2005 3:14 PM
To: bf-committers at projects.blender.org
Subject: [Bf-committers] Re: Re: [Bf-blender-cvs] CVS
commit:blender/source/blender/python/api2_2x Mathutils.c
Hi,
jgilbert at tigr.ORG (2005-10-10 at 1429.07 -0400):
> Good catch. Bug squashed.
>
> -----Original Message-----
> From: bf-committers-bounces at projects.blender.org
> [mailto:bf-committers-bounces at projects.blender.org] On Behalf Of Ken
> Hughes
> Sent: Monday, October 10, 2005 12:08 PM
> To: bf-committers at blender.org
> Subject: Re: [Bf-blender-cvs] CVS commit:
> blender/source/blender/python/api2_2x Mathutils.c
>
> Joseph Gilbert wrote:
> > ascotan (Joseph Gilbert) 2005/10/10 17:29:00 CEST
> >
> > Modified files:
> > blender/source/blender/python/api2_2x Mathutils.c
>
> Shouldn't the dot product be clamped (-1.0,1.0)?
Should not the result already be between that, and if not, then
something is really wrong? In other words, not clamp but return error.
Given A and B vectors of N components:
A1*B1 + ... + An*Bn
angle = acos -----------------------------------------------------
sqrt(A1*A1 + ... + An*An) * sqrt(B1*B1 + ... + Bn*Bn)
And if it is due rounding problems in computers, then that fuction
does if(!test_v1 || !test_v2) and I always see such kind of testing
being done with an epsilon.
GSR
_______________________________________________
Bf-committers mailing list
Bf-committers at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-committers
More information about the Bf-committers
mailing list