September 4, 2018, 8:20am
I just noticed that when you feed a plane/ vector into a
panel the values are rounded to the 2nd decimal. (up until now it was my main way of making sure for a plane’s parallelity to a specific axis and now, a lot of errors I’ve gotten can be explained)
In the example bellow, according to the panel,the plane is parallel to the z axis but in reality it’s slightly tilted.
Is there a way for panels to display values unrounded?
What the panel says and what the plane in component has to say are not the same sort of animals. Anyway since using the panel for feeding data is a no-no … what’s the issue?
Planes_OrigZAxis_V1.gh (9.1 KB)
September 4, 2018, 11:07am
Are you suggesting that it’s not just a matter of number display?
in your script you input two digit decimals and the output is different.
September 4, 2018, 11:27am
yeaah, yeaah. The magic of working with floats and doubles inclusive rounding and formating…
Is just a matter or rounding values.
Planes_OrigZAxis_V1B.gh (9.3 KB)
September 4, 2018, 11:59am
I don’t get it:
if the input is .46 shouldn’t the output be the same (even with more zeros)?
September 4, 2018, 12:09pm
First off the panel doesn’t round, it converts everything into text. The data type being converted may choose to round itself, and all floating point numbers are to some degree rounded.
The value 0.46 will be displayed as “0.46”. The value 0.45999999999999996 will also be displayed as “0.46”.
I’m not sure what
@PeterFotiadis’s file is showing, he’s using random values in the script and also plane axis vectors get normalised.
September 4, 2018, 12:14pm
@PeterFotiadis is in the habbit of branching out discussions! (which is very good!)
But to return to the initial question:
The take away is that one cannot control the way the data is displayed in panels (?).
September 4, 2018, 12:15pm
floating point comparisons.gh (34.8 KB)
The panel contains the value
0.46 and the two adjacent values on either side. It is not possible to specify a number in between these given ones, that’s all the accuracy there is.
All of them are shown as ‘0.46’, but when you perform a strict comparison only identical ones are considered equal:
September 4, 2018, 12:20pm
To a degree only. You can set decimals and e-notation threshold in the Grasshopper preferences, but data types are not required to adhere to those rules. Numbers will, coordinates probably won’t.
If you want to
really see the exact data you have, you must create your own formatting rule: formatting.gh (9.1 KB)
R in the format spec stands for
Roundtrip meaning that no information is lost when converting the number to text. There are loads of formatting codes, see
here for a list of common ones.
September 4, 2018, 12:23pm
As usual: one thing asked, ten things learned! thanks everyone!