A Monogame implementation of the Separating Axis Theorem (SAT) for convex polygon intersection
License
—
Deps
0
Install Size
—
Vulns
✓ 0
Published
Nov 12, 2023
$ dotnet add package Halfcut.SeparatingAxisTheorem.LibA Monogame implementation of the Separating Axis Theorem for convex polygon intersection.
using Halfcut.SeparatingAxisTheorem.Lib;
private Polygon _polygon1 = PolygonFactory.CreateRectangle(x1, y1, w1, h2);
private Polygon _polygon2 = PolygonFactory.CreateRectangle(x2, y2, w2, h2);
bool isIntersecting = _polygon1.IntersectsWith(_polygon2);
Run the demo code with:
git clone git@github.com:tedigc/SeparatingAxisTheorem.git
cd SeparatingAxisTheorem
dotnet build
dotnet run --project SeparatingAxisTheorem.Demo/SeparatingAxisTheorem.Demo.csproj
You can move the rotating square with WASD.
Created by Ted Cater (tedigc)