# Distance between 2 points

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

## Recommended Posts

Let's say I have a point1: x =10, y = 50

and point2: x = 30, y = 75

And I would like to draw a line between those two points. How to calculate the distance between those two points so I know what that line's length should be?

Thanks.

##### Share on other sites

With all due respect, I googled your thread title verbatim and was suggested a 25-second video clip with a thumbnail of the literal equation required to do what you're asking.  Didn't even have to change it at all.  That points to a serious lack of effort.

We're all willing to help people and answer questions, but that effort needs to be reciprocated at least somewhat by the people asking.  Please at least use a few minutes to google for an answer before making a thread asking something.

Edited by SeraphLance

##### Share on other sites
2 hours ago, Abdou23 said:

Hopefully that gives you all the info you need.  If you're still having problems or dont understand the theory, let me know.

##### Share on other sites

To calculate the distance between 2 points (x,y) and (a,b). You use Pythagoras' theorem:

Distance = sqrt[ (b-y)^2 + (a-x)^2 ]

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 27
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634101
• Total Posts
3015528
×