forked from MoonsideGames/MoonTools.Bonk
change namespace
parent
9cbb1fdf31
commit
d0b72d1749
|
@ -26,7 +26,7 @@ jobs:
|
||||||
- checkout
|
- checkout
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: .
|
at: .
|
||||||
- run: dotnet nuget push ./Bonk/bin/Release/MoonTools.Core.Bonk.*.nupkg -k $API_KEY -s https://api.nuget.org/v3/index.json
|
- run: dotnet nuget push ./Bonk/bin/Release/MoonTools.Bonk.*.nupkg -k $API_KEY -s https://api.nuget.org/v3/index.json
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Axis-aligned bounding box.
|
/// Axis-aligned bounding box.
|
||||||
|
|
|
@ -3,16 +3,16 @@
|
||||||
<Version>6.0.0</Version>
|
<Version>6.0.0</Version>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<Description>.NET Core High Performance Collision Detection</Description>
|
<Description>.NET Core High Performance Collision Detection</Description>
|
||||||
<PackageId>MoonTools.Core.Bonk</PackageId>
|
<PackageId>MoonTools.Bonk</PackageId>
|
||||||
<RootNamespace>MoonTools.Core.Bonk</RootNamespace>
|
<RootNamespace>MoonTools.Bonk</RootNamespace>
|
||||||
<Company>Moonside Games</Company>
|
<Company>Moonside Games</Company>
|
||||||
<Authors>Evan Hemsley</Authors>
|
<Authors>Evan Hemsley</Authors>
|
||||||
<Copyright>Evan Hemsley 2019</Copyright>
|
<Copyright>Evan Hemsley 2019</Copyright>
|
||||||
<Product>MoonTools.Core.Bonk</Product>
|
<Product>MoonTools.Bonk</Product>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<AssemblyName>MoonTools.Core.Bonk</AssemblyName>
|
<AssemblyName>MoonTools.Bonk</AssemblyName>
|
||||||
<PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression>
|
||||||
<PackageProjectUrl>https://github.com/MoonsideGames/MoonTools.Core.Bonk</PackageProjectUrl>
|
<PackageProjectUrl>https://gitea.moonside.games/MoonsideGames/MoonTools.Bonk</PackageProjectUrl>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -20,9 +20,9 @@
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MoonTools.Core.Structs" Version="3.0.0" />
|
|
||||||
<PackageReference Include="System.Collections.Immutable" Version="1.7.0"/>
|
<PackageReference Include="System.Collections.Immutable" Version="1.7.0"/>
|
||||||
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0"/>
|
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0"/>
|
||||||
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.0"/>
|
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.0"/>
|
||||||
|
<PackageReference Include="MoonTools.Structs" Version="3.0.1"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to quickly check if two shapes are potentially overlapping.
|
/// Used to quickly check if two shapes are potentially overlapping.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
public interface IShape2D : IEquatable<IShape2D>
|
public interface IShape2D : IEquatable<IShape2D>
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A Minkowski difference between two shapes.
|
/// A Minkowski difference between two shapes.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
internal struct Edge
|
internal struct Edge
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
public static class NarrowPhase
|
public static class NarrowPhase
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
internal unsafe struct SimplexVertexBuffer
|
internal unsafe struct SimplexVertexBuffer
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A Circle is a shape defined by a radius.
|
/// A Circle is a shape defined by a radius.
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A line is a shape defined by exactly two points in space.
|
/// A line is a shape defined by exactly two points in space.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
public struct Point : IShape2D, IEquatable<Point>
|
public struct Point : IShape2D, IEquatable<Point>
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A Shape defined by an arbitrary collection of vertices.
|
/// A Shape defined by an arbitrary collection of vertices.
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A rectangle is a shape defined by a minimum and maximum X value and a minimum and maximum Y value.
|
/// A rectangle is a shape defined by a minimum and maximum X value and a minimum and maximum Y value.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
internal static class RectanglePolygonComparison
|
internal static class RectanglePolygonComparison
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk
|
namespace MoonTools.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A simplex is a shape with up to n - 2 vertices in the nth dimension.
|
/// A simplex is a shape with up to n - 2 vertices in the nth dimension.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace MoonTools.Core.Bonk.Extensions
|
namespace MoonTools.Bonk.Extensions
|
||||||
{
|
{
|
||||||
internal static class Vector2Extensions
|
internal static class Vector2Extensions
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# MoonTools.Core.Bonk
|
# MoonTools.Bonk
|
||||||
|
|
||||||
[![NuGet Badge](https://buildstats.info/nuget/MoonTools.Core.Bonk)](https://www.nuget.org/packages/MoonTools.Core.Bonk/)
|
[![NuGet Badge](https://buildstats.info/nuget/MoonTools.Bonk)](https://www.nuget.org/packages/MoonTools.Bonk/)
|
||||||
[![CircleCI](https://circleci.com/gh/MoonsideGames/MoonTools.Core.Bonk.svg?style=svg)](https://circleci.com/gh/MoonsideGames/MoonTools.Core.Bonk)
|
[![CircleCI](https://circleci.com/gh/MoonsideGames/MoonTools.Bonk.svg?style=svg)](https://circleci.com/gh/MoonsideGames/MoonTools.Bonk)
|
||||||
|
|
||||||
Bonk is a fast and modular collision detection system for .NET that is part of the MoonTools suite. It can be used with any .NET-based game engine.
|
Bonk is a fast and modular collision detection system for .NET that is part of the MoonTools suite. It can be used with any .NET-based game engine.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using MoonTools.Core.Bonk;
|
using MoonTools.Bonk;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
|
|
|
@ -3,8 +3,8 @@ using FluentAssertions;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
using MoonTools.Core.Bonk;
|
using MoonTools.Bonk;
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
{
|
{
|
||||||
|
@ -13,9 +13,9 @@ namespace Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void RectangleOverlap()
|
public void RectangleOverlap()
|
||||||
{
|
{
|
||||||
var squareA = new MoonTools.Core.Bonk.Rectangle(-1, -1, 1, 1);
|
var squareA = new MoonTools.Bonk.Rectangle(-1, -1, 1, 1);
|
||||||
var transformA = Transform2D.DefaultTransform;
|
var transformA = Transform2D.DefaultTransform;
|
||||||
var squareB = new MoonTools.Core.Bonk.Rectangle(-1, -1, 1, 1);
|
var squareB = new MoonTools.Bonk.Rectangle(-1, -1, 1, 1);
|
||||||
var transformB = new Transform2D(new Vector2(1.5f, 0));
|
var transformB = new Transform2D(new Vector2(1.5f, 0));
|
||||||
|
|
||||||
var (result, simplex) = NarrowPhase.FindCollisionSimplex(squareA, transformA, squareB, transformB);
|
var (result, simplex) = NarrowPhase.FindCollisionSimplex(squareA, transformA, squareB, transformB);
|
||||||
|
@ -27,7 +27,7 @@ namespace Tests
|
||||||
intersection.X.Should().Be(1f);
|
intersection.X.Should().Be(1f);
|
||||||
intersection.Y.Should().Be(0);
|
intersection.Y.Should().Be(0);
|
||||||
|
|
||||||
var movedTransform = new Transform2D(transformA.Position - (intersection * 1.01f)); // move a tiny bit past
|
var movedTransform = new Transform2D(transformA.Position - (intersection * 2)); // move past
|
||||||
|
|
||||||
NarrowPhase.TestCollision(squareA, movedTransform, squareB, transformB).Should().BeFalse();
|
NarrowPhase.TestCollision(squareA, movedTransform, squareB, transformB).Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ namespace Tests
|
||||||
intersection.X.Should().BeApproximately(ix, 0.01f);
|
intersection.X.Should().BeApproximately(ix, 0.01f);
|
||||||
intersection.Y.Should().BeApproximately(iy, 0.01f);
|
intersection.Y.Should().BeApproximately(iy, 0.01f);
|
||||||
|
|
||||||
var movedTransform = new Transform2D(transformA.Position - (intersection * 1.01f)); // move a tiny bit past
|
var movedTransform = new Transform2D(transformA.Position - (intersection * 2)); // move past
|
||||||
|
|
||||||
NarrowPhase.TestCollision(circleA, movedTransform, circleB, transformB).Should().BeFalse();
|
NarrowPhase.TestCollision(circleA, movedTransform, circleB, transformB).Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ namespace Tests
|
||||||
{
|
{
|
||||||
var line = new Line(new Position2D(-4, -4), new Position2D(4, 4));
|
var line = new Line(new Position2D(-4, -4), new Position2D(4, 4));
|
||||||
var transformA = Transform2D.DefaultTransform;
|
var transformA = Transform2D.DefaultTransform;
|
||||||
var square = new MoonTools.Core.Bonk.Rectangle(-1, -1, 1, 1);
|
var square = new MoonTools.Bonk.Rectangle(-1, -1, 1, 1);
|
||||||
var transformB = Transform2D.DefaultTransform;
|
var transformB = Transform2D.DefaultTransform;
|
||||||
|
|
||||||
var (result, simplex) = NarrowPhase.FindCollisionSimplex(line, transformA, square, transformB);
|
var (result, simplex) = NarrowPhase.FindCollisionSimplex(line, transformA, square, transformB);
|
||||||
|
@ -71,7 +71,10 @@ namespace Tests
|
||||||
|
|
||||||
var intersection = NarrowPhase.Intersect(line, transformA, square, transformB, simplex);
|
var intersection = NarrowPhase.Intersect(line, transformA, square, transformB, simplex);
|
||||||
|
|
||||||
var movedTransform = new Transform2D(transformA.Position - (intersection * 1.01f)); // move a tiny bit past
|
intersection.X.Should().Be(1);
|
||||||
|
intersection.Y.Should().Be(-1);
|
||||||
|
|
||||||
|
var movedTransform = new Transform2D(transformA.Position - (intersection * 2)); // move past
|
||||||
|
|
||||||
NarrowPhase.TestCollision(line, movedTransform, square, transformB).Should().BeFalse();
|
NarrowPhase.TestCollision(line, movedTransform, square, transformB).Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
|
|
||||||
using MoonTools.Core.Bonk;
|
using MoonTools.Bonk;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using MoonTools.Core.Bonk;
|
using MoonTools.Bonk;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
|
@ -354,10 +354,10 @@ namespace Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void RectanglesNotOverlapping()
|
public void RectanglesNotOverlapping()
|
||||||
{
|
{
|
||||||
var rectangleA = new MoonTools.Core.Bonk.Rectangle(-6, -6, 6, 6);
|
var rectangleA = new MoonTools.Bonk.Rectangle(-6, -6, 6, 6);
|
||||||
var transformA = new Transform2D(new Position2D(39, 249));
|
var transformA = new Transform2D(new Position2D(39, 249));
|
||||||
|
|
||||||
var rectangleB = new MoonTools.Core.Bonk.Rectangle(0, 0, 16, 16);
|
var rectangleB = new MoonTools.Bonk.Rectangle(0, 0, 16, 16);
|
||||||
var transformB = new Transform2D(new Position2D(16, 240));
|
var transformB = new Transform2D(new Position2D(16, 240));
|
||||||
|
|
||||||
NarrowPhase.TestCollision(rectangleA, transformA, rectangleB, transformB).Should().BeFalse();
|
NarrowPhase.TestCollision(rectangleA, transformA, rectangleB, transformB).Should().BeFalse();
|
||||||
|
@ -366,10 +366,10 @@ namespace Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void RotatedRectanglesOverlapping()
|
public void RotatedRectanglesOverlapping()
|
||||||
{
|
{
|
||||||
var rectangleA = new MoonTools.Core.Bonk.Rectangle(-1, -1, 2, 2);
|
var rectangleA = new MoonTools.Bonk.Rectangle(-1, -1, 2, 2);
|
||||||
var transformA = new Transform2D(new Vector2(-1, 0), -90f);
|
var transformA = new Transform2D(new Vector2(-1, 0), -90f);
|
||||||
|
|
||||||
var rectangleB = new MoonTools.Core.Bonk.Rectangle(-1, -1, 1, 1);
|
var rectangleB = new MoonTools.Bonk.Rectangle(-1, -1, 1, 1);
|
||||||
var transformB = new Transform2D(new Vector2(1, 0));
|
var transformB = new Transform2D(new Vector2(1, 0));
|
||||||
|
|
||||||
NarrowPhase.TestCollision(rectangleA, transformA, rectangleB, transformB).Should().BeTrue();
|
NarrowPhase.TestCollision(rectangleA, transformA, rectangleB, transformB).Should().BeTrue();
|
||||||
|
@ -378,10 +378,10 @@ namespace Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void RectanglesTouchingGJK2D()
|
public void RectanglesTouchingGJK2D()
|
||||||
{
|
{
|
||||||
var rectangleA = new MoonTools.Core.Bonk.Rectangle(-1, -1, 1, 1);
|
var rectangleA = new MoonTools.Bonk.Rectangle(-1, -1, 1, 1);
|
||||||
var transformA = new Transform2D(new Position2D(-1, 0));
|
var transformA = new Transform2D(new Position2D(-1, 0));
|
||||||
|
|
||||||
var rectangleB = new MoonTools.Core.Bonk.Rectangle(-1, -1, 1, 1);
|
var rectangleB = new MoonTools.Bonk.Rectangle(-1, -1, 1, 1);
|
||||||
var transformB = new Transform2D(new Vector2(1, 0));
|
var transformB = new Transform2D(new Vector2(1, 0));
|
||||||
|
|
||||||
NarrowPhase.TestCollision(rectangleA, transformA, rectangleB, transformB).Should().BeTrue();
|
NarrowPhase.TestCollision(rectangleA, transformA, rectangleB, transformB).Should().BeTrue();
|
||||||
|
@ -390,10 +390,10 @@ namespace Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void RectanglesOverlappingGJK2D()
|
public void RectanglesOverlappingGJK2D()
|
||||||
{
|
{
|
||||||
var rectangleA = new MoonTools.Core.Bonk.Rectangle(-1, -1, 1, 1);
|
var rectangleA = new MoonTools.Bonk.Rectangle(-1, -1, 1, 1);
|
||||||
var transformA = new Transform2D(new Position2D(0, 0));
|
var transformA = new Transform2D(new Position2D(0, 0));
|
||||||
|
|
||||||
var rectangleB = new MoonTools.Core.Bonk.Rectangle(-1, -1, 1, 1);
|
var rectangleB = new MoonTools.Bonk.Rectangle(-1, -1, 1, 1);
|
||||||
var transformB = new Transform2D(new Vector2(1, 0));
|
var transformB = new Transform2D(new Vector2(1, 0));
|
||||||
|
|
||||||
NarrowPhase.TestCollision(rectangleA, transformA, rectangleB, transformB).Should().BeTrue();
|
NarrowPhase.TestCollision(rectangleA, transformA, rectangleB, transformB).Should().BeTrue();
|
||||||
|
@ -402,10 +402,10 @@ namespace Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void RectanglesTouchingOverlap()
|
public void RectanglesTouchingOverlap()
|
||||||
{
|
{
|
||||||
var rectangleA = new MoonTools.Core.Bonk.Rectangle(-1, -1, 1, 1);
|
var rectangleA = new MoonTools.Bonk.Rectangle(-1, -1, 1, 1);
|
||||||
var transformA = new Transform2D(new Position2D(-1, 0));
|
var transformA = new Transform2D(new Position2D(-1, 0));
|
||||||
|
|
||||||
var rectangleB = new MoonTools.Core.Bonk.Rectangle(-1, -1, 1, 1);
|
var rectangleB = new MoonTools.Bonk.Rectangle(-1, -1, 1, 1);
|
||||||
var transformB = new Transform2D(new Vector2(1, 0));
|
var transformB = new Transform2D(new Vector2(1, 0));
|
||||||
|
|
||||||
NarrowPhase.TestRectangleOverlap(rectangleA, transformA, rectangleB, transformB).Should().BeTrue();
|
NarrowPhase.TestRectangleOverlap(rectangleA, transformA, rectangleB, transformB).Should().BeTrue();
|
||||||
|
@ -414,10 +414,10 @@ namespace Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void RectanglesOverlappingOverlap()
|
public void RectanglesOverlappingOverlap()
|
||||||
{
|
{
|
||||||
var rectangleA = new MoonTools.Core.Bonk.Rectangle(-1, -1, 1, 1);
|
var rectangleA = new MoonTools.Bonk.Rectangle(-1, -1, 1, 1);
|
||||||
var transformA = new Transform2D(new Position2D(0, 0));
|
var transformA = new Transform2D(new Position2D(0, 0));
|
||||||
|
|
||||||
var rectangleB = new MoonTools.Core.Bonk.Rectangle(-1, -1, 1, 1);
|
var rectangleB = new MoonTools.Bonk.Rectangle(-1, -1, 1, 1);
|
||||||
var transformB = new Transform2D(new Vector2(1, 0));
|
var transformB = new Transform2D(new Vector2(1, 0));
|
||||||
|
|
||||||
NarrowPhase.TestRectangleOverlap(rectangleA, transformA, rectangleB, transformB).Should().BeTrue();
|
NarrowPhase.TestRectangleOverlap(rectangleA, transformA, rectangleB, transformB).Should().BeTrue();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using MoonTools.Core.Structs;
|
using MoonTools.Structs;
|
||||||
using MoonTools.Core.Bonk;
|
using MoonTools.Bonk;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
|
|
Loading…
Reference in New Issue