mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-14 22:35:34 -05:00
Private copies of tolerant box containment, box union, vector rotation and the cutout proposals' coordinate-range check now use one helper each: BoundingBox.IsWithin and BoundingBox.Union, Vector.Rotate, and CutoutCoordinates.WithinRange. Tests pin the helpers bit-for-bit against frozen copies of the removed bodies. No behavior change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
810 B
C#
20 lines
810 B
C#
using OpenNest.Geometry;
|
|
|
|
namespace OpenNest.Engine.Jobs.Cutouts;
|
|
|
|
/// <summary>The coordinate range the cutout proposals accept.</summary>
|
|
internal static class CutoutCoordinates
|
|
{
|
|
/// <summary>Largest coordinate magnitude the proposals process.</summary>
|
|
internal const double MaxCoordinate = 1e8;
|
|
|
|
/// <summary>Whether every side of <paramref name="box"/> is finite and within range.</summary>
|
|
internal static bool WithinRange(Box box) =>
|
|
double.IsFinite(box.Left) && double.IsFinite(box.Right)
|
|
&& double.IsFinite(box.Bottom) && double.IsFinite(box.Top)
|
|
&& System.Math.Abs(box.Left) <= MaxCoordinate
|
|
&& System.Math.Abs(box.Right) <= MaxCoordinate
|
|
&& System.Math.Abs(box.Bottom) <= MaxCoordinate
|
|
&& System.Math.Abs(box.Top) <= MaxCoordinate;
|
|
}
|