public static Vector2 NormalizedToPoint(RectInt rectangle, Vector2 normalizedRectCoordinates) { return(new Vector2(Mathf.Lerp(rectangle.x, rectangle.xMax, normalizedRectCoordinates.x), Mathf.Lerp(rectangle.y, rectangle.yMax, normalizedRectCoordinates.y))); }
public static Vector2 PointToNormalized(RectInt rectangle, Vector2 point) { return(new Vector2(Mathf.InverseLerp(rectangle.x, rectangle.xMax, point.x), Mathf.InverseLerp(rectangle.y, rectangle.yMax, point.y))); }
public bool Overlaps(RectInt other) { return(other.xMax > xMin && other.xMin < xMax && other.yMax > yMin && other.yMin < yMax); }