Improving Geometry classes with Tests

This commit is contained in:
BobLd
2019-12-14 11:41:11 +00:00
parent 4042649b46
commit 1656411fcb
9 changed files with 937 additions and 37 deletions

View File

@@ -1,4 +1,6 @@
namespace UglyToad.PdfPig.Geometry
using System;
namespace UglyToad.PdfPig.Geometry
{
/// <summary>
/// A line in a PDF file.
@@ -53,6 +55,18 @@
Point2 = point2;
}
/// <summary>
/// The rectangle completely containing the <see cref="PdfLine"/>.
/// </summary>
public PdfRectangle GetBoundingRectangle()
{
return new PdfRectangle(
Math.Min(this.Point1.X, this.Point2.X),
Math.Min(this.Point1.Y, this.Point2.Y),
Math.Max(this.Point1.X, this.Point2.X),
Math.Max(this.Point1.Y, this.Point2.Y));
}
/// <summary>
/// Returns a value indicating whether this <see cref="PdfLine"/> is equal to a specified <see cref="PdfLine"/> .
/// </summary>