Normal Vectors in Box2D

BlitzMax Forums/Brucey's Modules/Normal Vectors in Box2D

Rico(Posted 2008) [#1]
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


Brucey(Posted 2008) [#2]
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)


SebHoll(Posted 2008) [#3]
If there is a plus (+) after the "e",

...or no explicit sign written at all...

you move the decimal place to the right...

;-)


Brucey(Posted 2008) [#4]
that too :-)


Rico(Posted 2008) [#5]
OK Thanks - I can deal with that. It is *very* close to zero - you are right :)