// Get the distance from this Vector2D to the other one squared. public float DistToSqr(SourceVector2 vOther) { return(new SourceVector2( ix: x - vOther.x, iy: y - vOther.y ).LengthSqr()); }
public SourceVector2 Max(SourceVector2 vOther) { return(new SourceVector2(x > vOther.x ? x : vOther.x, y > vOther.y ? y : vOther.y)); }
// Dot product. public float Dot(SourceVector2 vOther) => (x * vOther.x + y * vOther.y);
// Returns a SourceVector2 with the min or max in X, Y, and Z. public SourceVector2 Min(SourceVector2 vOther) { return(new SourceVector2(x < vOther.x ? x : vOther.x, y < vOther.y ? y : vOther.y)); }
// Multiply, add, and assign to this (ie: *this = a + b * scalar). This // is about 12% faster than the actual Vector2D equation (because it's done per-component // rather than per-Vector2D). public void MulAdd(SourceVector2 a, SourceVector2 b, float scalar) { x = a.x + b.x * scalar; y = a.y + b.y * scalar; }