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 Tools 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
Society of Digital Artists

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

All times are GMT. The time now is 07:52 AM.

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