Save Closest is ready again with

all Deterministic Hash Code Key
This commit is contained in:
2022-08-20 00:57:48 -07:00
parent be7a6abbf4
commit f72fcee1db
16 changed files with 235 additions and 136 deletions

View File

@ -23,6 +23,8 @@ public class Location : Properties.ILocation, ILocation, IEquatable<Location>
[JsonConstructor]
public Location(int bottom, double confidence, int left, int? normalizedPixelPercentage, int right, int top)
{
if (normalizedPixelPercentage < 0)
normalizedPixelPercentage = 3;
_Confidence = confidence;
_Bottom = bottom;
_Left = left;
@ -63,11 +65,15 @@ public class Location : Properties.ILocation, ILocation, IEquatable<Location>
public static int GetNormalizedPixelPercentage(int bottom, int height, int left, int right, int top, int width)
{
double result;
int result;
double value;
double xCenter = left + ((right - left) / 2);
double yCenter = top + ((bottom - top) / 2);
result = ((yCenter * width) + xCenter) / (width * height);
return (int)(Math.Round((decimal)result, 4) * Stateless.Methods.ILocation.Factor);
value = ((yCenter * width) + xCenter) / (width * height);
if (value < 0)
value = 3;
result = (int)(Math.Round((decimal)value, 4) * Stateless.Methods.ILocation.Factor);
return result;
}
public bool Equals(Location? location)