Skip to main content
3 of 3
images fixed (inlining HTTP images doesn't work anymore); for more info, see https://gist.github.com/Glorfindel83/9d954d34385d2ac2597bbe864466259f
Glorfindel
  • 992
  • 1
  • 9
  • 16

A very basic one is the Pythagorean theorem. Also known as the distance formula.

a^2+b^2=c^2 where a and b are the edges of a right triangle and c is the hypotenuse. This means that in order to find the length of a vector, you do this:

distance = sqrt( a^2 + b^2 )

Another note of interest is that if you're just comparing distances, you don't have to take the square root (which can be relatively costly). That's why most frameworks have a "distance squared" or "length squared" function for their vectors.

Tetrad
  • 30.1k
  • 12
  • 96
  • 143