test(geometry): cover Collision with ClipperBridge inputs; document GPU contract
Collision stays hand-rolled because it is the reference for a future GPU kernel, but its inputs now come from Clipper region offsets. Pin down that lines-only, round-join, 1e-4-precision polygons keep the contact and part-in-part semantics: a neighbor inside a collapsed slot, a part inside a hole that shrank by the spacing, and zero-spacing edge contact. Document which steps are per-polygon preparation to cache and upload once, and which are per-pair kernel-shaped work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,22 @@ using OpenNest.Math;
|
||||
|
||||
namespace OpenNest.Geometry
|
||||
{
|
||||
/// <summary>
|
||||
/// Polygon overlap test with hole subtraction. This is the reference implementation
|
||||
/// for a future GPU kernel, so it deliberately stays hand-rolled instead of using
|
||||
/// Clipper (which is CPU-only and allocation-heavy; see <see cref="ClipperBridge"/>
|
||||
/// for the CPU preparation that feeds it).
|
||||
/// <para>
|
||||
/// GPU-port contract. Per-polygon preparation, done once per drawing and rotation,
|
||||
/// then cached and uploaded: the spacing offset (<see cref="ClipperBridge"/>),
|
||||
/// triangulation (<see cref="ConvexDecomposition.Triangulate"/>) of the outline and
|
||||
/// each hole, and the bounding box of every polygon and triangle. Per-pair work,
|
||||
/// kernel-shaped (fixed-size, loop-only, no recursion): the bounding-box rejects,
|
||||
/// Sutherland-Hodgman clipping of convex triangle pairs (<c>ClipConvex</c>), and
|
||||
/// subtraction of hole triangles from the clipped regions (<c>SubtractTriangles</c>).
|
||||
/// Inputs are closed, lines-only polygons; winding is normalized by triangulation.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public static class Collision
|
||||
{
|
||||
public static CollisionResult Check(
|
||||
|
||||
Reference in New Issue
Block a user