public static Rectangle Rectangle(this Stage.IPolygon v) { Vector2 minUV = v.MinUV(); var maxUV = v.MaxUV(); return(new Rectangle(minUV.ToPoint(), (maxUV - minUV).ToPoint())); }
public static Vector2 MinUV(this Stage.IPolygon v) { if (v.UVs == null || v.UVs.Length <= 2) { return(Vector2.Zero); } var vector2 = v.UVs[0]; for (var i = 1; i < v.UVs.Length; i++) { vector2 = Vector2.Min(vector2, v.UVs[i]); } return(vector2); }