/// Encapsulates a point of interest in an image containing a barcode. Typically, this
/// would be the location of a finder pattern or the corner of the barcode, for example.
///
/// @author Sean Owen
///
public class ResultPoint
{
private readonly float x;
private readonly float y;
public ResultPoint(float x, float y)
{
this.x = x;
this.y = y;
}
public float X
{
get
{
return x;
}
}
public float Y
{
get
{
return y;
}
}
public override bool Equals(object other)
{
if (other is ResultPoint)
{
ResultPoint otherPoint = (ResultPoint) other;
return x == otherPoint.x && y == otherPoint.y;
}
return false;
}
public override int GetHashCode()
{
//return 31 * float.floatToIntBits(x) + float.floatToIntBits(y);
int xbits = BitConverter.ToInt32(BitConverter.GetBytes(x), 0);
int ybits = BitConverter.ToInt32(BitConverter.GetBytes(y), 0);
return 31 * xbits + ybits;
}
public override string ToString()
{
StringBuilder result = new StringBuilder(25);
result.Append('(');
result.Append(x);
result.Append(',');
result.Append(y);
result.Append(')');
return result.ToString();
}
///