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
Old 02 February 2013   #1
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.
 
Old 02 February 2013   #2
Short answer: distance [0,0,0] obj.pos < eps
Long answer: Comparing float values (shameful selfpromo)
__________________
Scripts :: linkedin
 
Old 02 February 2013   #3
Hey SwordSlayer,

That's a great article! Thanks for sharing.
__________________
Juan Martinez | Blog | Animator
 
Old 02 February 2013   #4
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.
 
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 03:16 AM.


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