public Vector2F(Location2F coords) { X = coords.X; Y = coords.Y; lengthFound = false; radiansFound = false; }
/// <summary> /// Creates a new Vector from locA to locB /// </summary> /// <param name="locA">Start location</param> /// <param name="locB">End location</param> public Vector2F(Location2F locA, Location2F locB) { X = locB.X - locA.X; Y = locB.Y - locA.Y; lengthFound = false; radiansFound = false; }
public Location2F Midpoint(Location2F loc) { return(new Location2F((loc.X + X) / 2, (loc.Y + Y) / 2)); }
public float DistanceTo(Location2F loc) { return((float)Math.Sqrt(DistanceToSquared(loc))); }
public float DistanceToSquared(Location2F loc) { return((float)Math.Pow(loc.X - X, 2) + (float)Math.Pow(loc.Y - Y, 2)); }
public Location2F(Location2F loc) { X = loc.X; Y = loc.Y; }