Jump to content
  • Advertisement
Sign in to follow this  
radiationz

Vector3.TransformCoordinate accuracy

This topic is 4468 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am using c# with direct3d, u transform some vectors using Vector3.TransformCoordinate(...), i notice that it does not give accurate results, for example if i have: Vector3 v=new Vector3(0,-6,0); v = Vector3.TransformCoordinate(v, Matrix.RotationZ(-90f * Convert.ToSingle(Math.PI) / 180f))); the result is: v.X = -5.99999952 and it should be -6 v.Y = 0.0000002622683 and it should be 0 what should i do to increase accuracy? any help will be appreciated, thnx.

Share this post


Link to post
Share on other sites
Advertisement
if your not happy with the results, and can do the math yourself why not just apply that math to your own function to take care of what it is u want it to do, i recently wrote all my own matrice functions in order to help me learn the underlying math etc

Share this post


Link to post
Share on other sites
Quote:
Original post by radiationz
so what is the reason that made microsoft developers make this function not accurate ?!?!?!?


1) IEE754 floating point numbers can't represent every number exactly within 32-bits of precision. The CPU/FPU in your computer uses IEEE floating point numbers.

2) For the details of why floating point numbers aren't always 'accurate', read "What every computer scientist should know about floating point": http://cch.loria.fr/documentation/IEEE754/ACM/goldberg.pdf

3) And as DanyATK, sometimes precision/accuracy is traded for speed. Direct3D uses single precision floating point values rather than double precision for example.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!