Conversion error from vector to point

Hi there. Does anyone know, why the “Point.X”-node gives x-values other than 0, when both the “FamilyInstance.FacingOrientation” and “Vector.AsPoint” shows x=0? In the uploaded image you can see how it works perfectly fine for the y-coordinates.

This is a rounding error - one set of data is showing as having been rounded to 0 and the other is not.

Notice how the E-15 indicates this value has had the decimal place shifted 15 times, so you’re looking at something which is effectively zero at any comprehensible number. To understand it better, try writing it out in decimal fashion in your phone’s calculator, taking the tangent of that, and multiplying by 92,960,000 which is the distance from the earth to the sun in miles. Now multiply it again by a 63,360 to convert to inches. My calculation was around 1/512 of an inch, but even by counting decimal places you can see we’re a few spots to the right of the decimal still.

Use a Math.Round to solve this before doing any math - 6 decimal places is usually a good degree of precision.

Also, you might want to try just getting the values from the vector directly, using Vector.X and Vector.Y nodes - reducing memory hits is a good thing.

2 Likes

Thanks a lot for the help, it worked out just the way you described it

1 Like