Files
OpenNest/OpenNest.Engine/Jobs/Cutouts/CutoutCoordinates.cs
T
ajandClaude Opus 5.5 e231e44f72 refactor(geometry): share box containment, union, rotation and cutout range checks
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>
2026-11-01 09:25:27 -05:00

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;
}