Normal Vectors in Box2D
BlitzMax Forums/Brucey's Modules/Normal Vectors in Box2D
| ||
If I have a character standing on a level platform, and I am reading the normal vector from the contact points. The y component vector is always correct. The x component should be zero but sometimes it comes up as -5.72204613e-007. Is this right? It should always be zero. I'm not sure what this number means. I can never remember what 'e' means. I want to use the surface normals to work out the gradient of the surface my man/character is standing on, and this gives an odd result. Can anyone help? Thank you - Rico |
| ||
Well, it's pretty much almost zero. When you see "e" (the exponent) and a minus after it, you need to move the decimal place the indicated number of places to the left... so, -5.72204613e-007 = -0.000000572204613 remember, Floats are not exact numbers, hence the rounding errors you see. If there is a plus (+) after the "e", you move the decimal place to the right... :o) |
| ||
If there is a plus (+) after the "e", ...or no explicit sign written at all... you move the decimal place to the right... ;-) |
| ||
that too :-) |
| ||
OK Thanks - I can deal with that. It is *very* close to zero - you are right :) |