[Bf-committers] Re: Re: [Bf-blender-cvs] CVS commit:blender/source/blender/python/api2_2x Mathutils.c

Ken Hughes khughes at pacific.edu
Mon Oct 10 23:11:41 CEST 2005


Gilbert, Joseph wrote:
> Yep. I remember we went with saacos before and it gave bad precision
> (which was a previous bug fix) because of what theeth is saying - python
> floats are really doubles. I'm just going to add a test so values are
> not always clamped. :)

But even if you don't clamp them, you still have to do the comparison to 
know NOT to clamp them!

Most recent CVS code:

   if (dot < -1.0f || dot > 1.0f)
     CLAMP(dot,-1.0f,1.0f);

expands to this:

   if (dot < -1.0f || dot > 1.0f)
     if((dot)<(-1.0f)) (dot)=(-1.0f); else if((dot)>(1.0f)) (dot)=(1.0f);

(BTW, there are two CLAMP macros: one in BKE_utildefines.h and one in 
utils.h.  They are totally different; seems dangerous).

> 
> -----Original Message-----
> From: bf-committers-bounces at projects.blender.org
> [mailto:bf-committers-bounces at projects.blender.org] On Behalf Of Martin
> Poirier
> Sent: Monday, October 10, 2005 3:51 PM
> To: bf-blender developers
> Subject: Re: [Bf-committers] Re: Re: [Bf-blender-cvs] CVS
> commit:blender/source/blender/python/api2_2x Mathutils.c
> 
> 
> --- Brecht Van Lommel <brechtvanlommel at pandora.be>
> wrote:
> 
> 
>>Exactly. There is a saacos ('safe acos') function in
>>BLI_arithb.h just for this,
>>and it's used all over the sources. acos should
>>never be called directly.
>>
>>Brecht.
> 
> 
> The "problem" is that saacos returns a single
> precision float whereass python uses double precision
> floats, so using acos directly has added precision
> (even though the vector's data is in single
> precision).
> 
> Martin
> 
> 
> 		
> __________________________________ 
> Start your day with Yahoo! - Make it your home page! 
> http://www.yahoo.com/r/hs
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
> _______________________________________________
> 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