Forcing almost zero values to be zero

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  02 February 2013
Forcing almost zero values to be zero

I have an object whose local position is shown to be [0,0,0]
but when accessed by script I get [9.05991e-006,2.86102e-006,1.3262e-005]

superflous for my purposes, why not just give me zero?
does max have a method for this
or must I iterate through the X,Y,Z values testing for "almost zero"?

or better yet is there a way to get max to limit the precision somehow, so I don't get results beyond, say 4 decimal points ?

Last edited by Mambo4 : 02 February 2013 at 11:22 PM.
 
  02 February 2013
Short answer: distance [0,0,0] obj.pos < eps
Long answer: Comparing float values (shameful selfpromo)
__________________
Scripts :: linkedin
 
  02 February 2013
Hey SwordSlayer,

That's a great article! Thanks for sharing.
__________________
Juan Martinez | Blog | Animator
 
  02 February 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:55 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.