Jump to content
  • Advertisement
Sign in to follow this  
beginnerfurqan

simple geometry

This topic is 4586 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

hi, im feeling embarassed asking such a simple question but it has been a long time since I did maths in college. I'm developing a program, for which I have to calculate the length between 2 objects. I have tried: x1 - x2; y1 - y2; but this results in another set of co-ordinates and I need a single value that gives the distance between these 2 objects. If anybody understands what I'm saying and has the solution it would be a great help. thanx

Share this post


Link to post
Share on other sites
Advertisement
The distance will be

sqrt((x1 - x2)^2 + (y1 - y2)^2)

And in 3D it is just

sqrt((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2)

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!