mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-19 02:37:56 +08:00
add angle bounding functions
This commit is contained in:
@@ -78,6 +78,28 @@
|
|||||||
return Math.Abs(point2.X - point1.X);
|
return Math.Abs(point2.X - point1.X);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Bound angle so that -180 ≤ θ ≤ 180.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The angle to bound.</param>
|
||||||
|
public static double BoundAngle180(double angle)
|
||||||
|
{
|
||||||
|
angle = (angle + 180) % 360;
|
||||||
|
if (angle < 0) angle += 360;
|
||||||
|
return angle - 180;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Bound angle so that 0 ≤ θ ≤ 360.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The angle to bound.</param>
|
||||||
|
public static double BoundAngle0to360(double angle)
|
||||||
|
{
|
||||||
|
angle %= 360;
|
||||||
|
if (angle < 0) angle += 360;
|
||||||
|
return angle;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the minimum edit distance between two strings.
|
/// Get the minimum edit distance between two strings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Reference in New Issue
Block a user