I have collision plane and ray (camera), when I print the surface point of the collision with the plane the z coordinate is sometimes a strange number. Why is that?:

When you say “a strange number”, do you mean “3.8147e-06”?

If so, then I believe that it’s simply using a scientific notation, in this case to express a very small number.

(The minus-sign after the “e” indicates that the number expressed is a small number; the lack of that sign would indicate that the number expressed was a larger number.)

To be specific, this is the same as “3.8147x10^-6” (3.1847 times 10 to the power of -6), which is the same as “0.0000038147”, I think. (Although I may have one too few or too many zeroes there; I’m not sure.)

Yes. Also I noticed that if Im (camera) close to the plane then it doesnt happen. I guess it is similar to z-fighting? Good to know that I should always account for small deviation.

Eehhhh, I suppose that there’s a certain similarity, in that you’re dealing with small deviations in numbers, yes.

Indeed: outside of certain values, it’s generally not wise to expect floating-point numbers to be absolutely exact, as I recall. Indeed, I believe that it’s generally unwise to test for exact equality of floating-point numbers.

I believe that Python 3.5 introduces an “isclose” method to the “math” module that allows for comparisons between floating-point numbers. See here for more. (There’s a similar function in “cmath” too, I believe.)