PDA

View Full Version : PickPoint() Help Please


nebille
10-11-2005, 05:42 PM
Hi all

I am using the pickpoint function and am getting strange results when using it in the front or left viewports.

[-164.272,-2.7043e-006,61.8673]

what is the e-006 number on the Y axis.

regards

Nebille

Bobo
10-11-2005, 05:52 PM
Hi all

I am using the pickpoint function and am getting strange results when using it in the front or left viewports.

[-164.272,-2.7043e-006,61.8673]

what is the e-006 number on the Y axis.

regards

Nebille

This is a number that is very very close to 0.0.
-2.7043 * 10^-006 = -0.0000027043

Usually caused by a round-off error.

nebille
10-11-2005, 05:58 PM
Thanks bobo that explains the problem , have you any suggestions how i can force the number to round up or down correctly without giving an error?

Bobo
10-11-2005, 06:10 PM
Thanks bobo that explains the problem , have you any suggestions how i can force the number to round up or down correctly without giving an error?

Max (MAXScript) can handle that number without problems.
You can type in the Listener of your script
-1011e-6
and the result will be
-0.001011

Of course, you could compare the components of the result to a threshold and make them 0.0 if the value is lower.

For example

fn roundOffPoint3 theValue theThresh =
(
if abs theValue.x < theThresh do theValue.x = 0
if abs theValue.y < theThresh do theValue.y = 0
if abs theValue.z < theThresh do theValue.z = 0
theValue
)

roundOffPoint3 [-164.272,-2.7043e-006,61.8673] 0.00001
--Result:
[-164.272,0,61.8673]


Also, Larry's Avguard DLX extension has a functionc alled CloseEnough that can be used to do such comparisons.

nebille
10-11-2005, 06:17 PM
You are sooooooooooooooooooooooooo the man. Thanks for all your help


regards

Nebille

CGTalk Moderation
10-11-2005, 06:17 PM
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.