UtilDrawingGetSquareSimilarityPercentage(Size) Method
Determine the similarity percentage that the specified
Size has with a square shape,
by dividing its shortest side between the longest one.
For example, having a
Size of 4x4 (Width x Height),
this function will return a value of 1, meaning that all the
sides ( {Top=4, Bottom=4, Left=4, Right=4} ) are of equal length,
or in other words, it is a perfect square shape.
For example too, having a
Size of 640x480 (Width x Height),
this function will return a value of 0.75, meaning that the length of the
sides ( {Top=640, Bottom=640, Left=480, Right=480} ) are 75% near to be a perfect square shape.
Namespace: DevCase.Core.Media.GraphicsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static double GetSquareSimilarityPercentage(
Size size
)
Public Shared Function GetSquareSimilarityPercentage (
size As Size
) As Double
Dim size As Size
Dim returnValue As Double
returnValue = UtilDrawing.GetSquareSimilarityPercentage(size)
public:
static double GetSquareSimilarityPercentage(
Size size
)
static member GetSquareSimilarityPercentage :
size : Size -> float
No code example is currently available or this language may not be supported.
- size Size
-
The source Size.
Double
The resulting similarity, expressed as a percentage value between 0 (as minimum) to 1.0 (as maximum).
This is a code example.
No code example is currently available or this language may not be supported.
Dim sz As New Size(width:=640, height:=480)
Dim prc As Double = GetSquareSimilarityPercentage(sz)
Dim str As String = String.Format("Square similarity of {0}: {1:P2}", sz.ToString(), prc, CultureInfo.InvariantCulture)
Console.WriteLine(str)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.