/// <summary> /// Create a new <see cref="Polygon"/> with the properties of its template, vertices coordinates scaled to fit a container of specified dimensions /// </summary> /// <param name="p"><see cref="Polygon"/> to normalize</param> /// <param name="width">Width of the container</param> /// <param name="height">Height of the container</param> /// <returns></returns> public static Polygon PolygonNormalizedToBox(this Polygon p, int width, int height) => new Polygon(p, p.GetScalingFactor(width, height));
/// <summary> /// Create a new polygon with the properties of its template, vertices coordinates scaled to fit a PictureBox /// </summary> /// <param name="p"><see cref="Polygon"/> to normalize</param> /// <param name="normalizeTo"><see cref="PictureBox"/> whose bounds should be used for normalization calculations</param> /// <returns></returns> public static Polygon PolygonNormalizedToBox(this Polygon p, PictureBox normalizeTo) => new Polygon(p, p.GetScalingFactor(normalizeTo.Width, normalizeTo.Height));