Sign in to follow this  
beginnerfurqan

simple geometry

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this