Garry's Mod Wiki

Vector:Distance2DSqr

  number Vector:Distance2DSqr( Vector otherVec )

Description

Returns the squared distance between 2 vectors in 2D space, ignoring the Z axis. This is faster than Vector:Distance2D as calculating the square root is an expensive process.

Squared distances should not be summed. If you need to sum distances, use Vector:Distance2D.

When performing a distance check, ensure the distance being checked against is squared.

Arguments

1 Vector otherVec
The vector to calculate the distance to.

Returns

1 number
Squared distance to the vector in 2D space.