Improving PdfPoint

This commit is contained in:
BobLd
2019-08-09 19:58:48 +01:00
parent 5399456919
commit 474ce9a442

View File

@@ -82,6 +82,39 @@
return new PdfVector(X, Y);
}
/// <summary>
/// Converts this <see cref="PdfPoint"/> into an array.
/// </summary>
/// <returns></returns>
public double[] ToDouble()
{
return new double[] { (double)this.X, (double)this.Y };
}
/// <summary>
/// Returns a value indicating whether this <see cref="PdfPoint"/> is equal to a specified <see cref="PdfPoint"/> .
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public override bool Equals(object obj)
{
if (obj is PdfPoint)
{
PdfPoint point = (PdfPoint)obj;
return point.X == this.X && point.Y == this.Y;
}
return false;
}
/// <summary>
/// Returns the hash code for this <see cref="PdfPoint"/>.
/// </summary>
/// <returns></returns>
public override int GetHashCode()
{
return (int)(this.X * 10_000 + 31 * this.Y * 10_000);
}
/// <summary>
/// Get a string representation of this point.
/// </summary>