The accuracy of decimals in scripts.
Здравствуйте форумчане!
The accuracy of decimals in scripts.
Dear forum users!
I write a simple script to reset the position of several selected vertices along one axis in the Editable Poly. I met with a strange problem. In the "Move Tranform Type-In" on one axis just as well stay the value -0.0. As much as I tried not to reset the position is -0.0
When the request script (using the "format") issued Y: -9.15527e-005.
In the setting of increasing the accuracy of the decimals to ten. In the "Move Tranform Type-In" is displayed the real value of Y: -0.0000915527. But in the script still appears Y: -9.15527e-005.
So how can that be? How easily script a full position?
Sorry for my English, I use a translator.
Attachment | Size |
---|---|
image.png | 11.26 KB |
Comments
If you want that kind of precision, you'd have to switch to a different software, I'm afraid. Max uses single-precision floats, all the vertex positions are multiplied by the node transform and its parents transform and so on, and as such, the error accumulates. And the bigger the numbers, the bigger the imprecision as well which is why it's a good idea to keep the objects close to the origin. Don't worry about that, most of the time when rendering, the precision of five decimal places is alright.
Some of my scripts and MCGs :: 3ds Max SDK Intro for Scripters