Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ClosestPointOnLine()

static Vector2 Terraria.Utils.ClosestPointOnLine ( this Vector2 P,
Vector2 A,
Vector2 B )
inlinestatic

Definition at line 1287 of file Utils.cs.

1288 {
1289 Vector2 value = P - A;
1290 Vector2 vector = B - A;
1291 float num = vector.LengthSquared();
1292 float num2 = Vector2.Dot(value, vector) / num;
1293 if (num2 < 0f)
1294 {
1295 return A;
1296 }
1297 if (num2 > 1f)
1298 {
1299 return B;
1300 }
1301 return A + vector * num2;
1302 }
static float Dot(Vector2 value1, Vector2 value2)
Definition Vector2.cs:121

References System.A, System.B, Microsoft.Xna.Framework.Vector2.Dot(), System.P, and System.value.