Compare commits
No commits in common. "master" and "multishape" have entirely different histories.
master
...
multishape
|
@ -0,0 +1,46 @@
|
||||||
|
version: 2.1
|
||||||
|
|
||||||
|
defaults: &defaults
|
||||||
|
working_directory: ~/repo
|
||||||
|
docker:
|
||||||
|
- image: mcr.microsoft.com/dotnet/core/sdk:3.0
|
||||||
|
environment:
|
||||||
|
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
|
||||||
|
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
<<: *defaults
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: dotnet restore
|
||||||
|
- run: dotnet build -c Release
|
||||||
|
- run: dotnet test -c Release
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: .
|
||||||
|
paths: ./Bonk/bin
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
<<: *defaults
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- attach_workspace:
|
||||||
|
at: .
|
||||||
|
- run: dotnet nuget push ./Bonk/bin/Release/MoonTools.Core.Bonk.*.nupkg -k $API_KEY -s https://api.nuget.org/v3/index.json
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
test_and_deploy:
|
||||||
|
jobs:
|
||||||
|
- test:
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
|
- deploy:
|
||||||
|
requires:
|
||||||
|
- test
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
ignore: /.*/
|
||||||
|
tags:
|
||||||
|
only: /^\d+\.\d+\.\d+(-preview\d*)?$/
|
24
.drone.yml
24
.drone.yml
|
@ -1,24 +0,0 @@
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: default
|
|
||||||
|
|
||||||
workspace:
|
|
||||||
path: /build
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: test
|
|
||||||
image: mcr.microsoft.com/dotnet/core/sdk:3.1
|
|
||||||
commands:
|
|
||||||
- dotnet build -c Release
|
|
||||||
- dotnet test -c Release
|
|
||||||
|
|
||||||
- name: deploy
|
|
||||||
image: mcr.microsoft.com/dotnet/core/sdk:3.1
|
|
||||||
environment:
|
|
||||||
API_KEY:
|
|
||||||
from_secret: API_KEY
|
|
||||||
commands:
|
|
||||||
- dotnet nuget push /build/Bonk/bin/Release/MoonTools.Bonk.*.nupkg -s https://api.nuget.org/v3/index.json -k $API_KEY
|
|
||||||
when:
|
|
||||||
ref:
|
|
||||||
- refs/tags/*.*.*
|
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Structs;
|
using MoonTools.Core.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Axis-aligned bounding box.
|
/// Axis-aligned bounding box.
|
||||||
|
@ -26,13 +26,11 @@ namespace MoonTools.Bonk
|
||||||
|
|
||||||
public float Right { get { return Max.X; } }
|
public float Right { get { return Max.X; } }
|
||||||
public float Left { get { return Min.X; } }
|
public float Left { get { return Min.X; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The top of the AABB. Assumes a downward-aligned Y axis, so this value will be smaller than Bottom.
|
/// The top of the AABB. Assumes a downward-aligned Y axis, so this value will be smaller than Bottom.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
public float Top { get { return Min.Y; } }
|
public float Top { get { return Min.Y; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The bottom of the AABB. Assumes a downward-aligned Y axis, so this value will be larger than Top.
|
/// The bottom of the AABB. Assumes a downward-aligned Y axis, so this value will be larger than Top.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,29 +1,28 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>8.0.1</Version>
|
<Version>6.0.0</Version>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<Description>.NET Standard High Performance Collision Detection</Description>
|
<Description>.NET Core High Performance Collision Detection</Description>
|
||||||
<PackageId>MoonTools.Bonk</PackageId>
|
<PackageId>MoonTools.Core.Bonk</PackageId>
|
||||||
<RootNamespace>MoonTools.Bonk</RootNamespace>
|
<RootNamespace>MoonTools.Core.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.Bonk</Product>
|
<Product>MoonTools.Core.Bonk</Product>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<AssemblyName>MoonTools.Bonk</AssemblyName>
|
<AssemblyName>MoonTools.Core.Bonk</AssemblyName>
|
||||||
<PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression>
|
||||||
<PackageProjectUrl>https://gitea.moonside.games/MoonsideGames/MoonTools.Bonk</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/MoonsideGames/MoonTools.Core.Bonk</PackageProjectUrl>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<Platforms>x64</Platforms>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
|
||||||
<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="System.Collections.Immutable" Version="1.7.1" />
|
<PackageReference Include="MoonTools.Core.Structs" Version="3.0.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.Structs;
|
using MoonTools.Core.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to quickly check if two shapes are potentially overlapping.
|
/// Used to quickly check if two shapes are potentially overlapping.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using MoonTools.Structs;
|
using System;
|
||||||
|
using MoonTools.Core.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.Bonk
|
||||||
{
|
{
|
||||||
public interface IHasAABB2D
|
public interface IHasAABB2D
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Structs;
|
using MoonTools.Core.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.Bonk
|
||||||
{
|
{
|
||||||
public interface IShape2D : IHasAABB2D, IEquatable<IShape2D>
|
public interface IShape2D : IHasAABB2D, IEquatable<IShape2D>
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Structs;
|
using MoonTools.Core.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A Minkowski difference between two shapes.
|
/// A Minkowski difference between two shapes.
|
||||||
|
|
|
@ -1,9 +1,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.Structs;
|
using MoonTools.Core.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.Bonk
|
||||||
{
|
{
|
||||||
public struct MultiShape : IHasAABB2D
|
public struct MultiShape : IHasAABB2D
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.Bonk
|
||||||
{
|
{
|
||||||
internal struct Edge
|
internal struct Edge
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using MoonTools.Structs;
|
using MoonTools.Core.Structs;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.Bonk
|
||||||
{
|
{
|
||||||
public static class NarrowPhase
|
public static class NarrowPhase
|
||||||
{
|
{
|
||||||
|
@ -60,7 +60,7 @@ namespace MoonTools.Bonk
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests if a multishape-transform and shape-transform pair are overlapping.
|
/// Tests if a multishape-transform and shape-transform pair are overlapping.
|
||||||
/// Note that this must perform pairwise comparison so the worst-case performance of this method will vary inversely with the amount of shapes in the multishape.
|
/// Note that this must perform pairwise comparison so the worst-case performance of this method will vary inversely with the amount of shapes in the multishape.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="multiShape"></param>
|
/// <param name="multiShape"></param>
|
||||||
|
@ -78,7 +78,7 @@ namespace MoonTools.Bonk
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests if a multishape-transform and shape-transform pair are overlapping.
|
/// Tests if a multishape-transform and shape-transform pair are overlapping.
|
||||||
/// Note that this must perform pairwise comparison so the worst-case performance of this method will vary inversely with the amount of shapes in the multishape.
|
/// Note that this must perform pairwise comparison so the worst-case performance of this method will vary inversely with the amount of shapes in the multishape.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="multiShape"></param>
|
/// <param name="multiShape"></param>
|
||||||
|
@ -96,7 +96,7 @@ namespace MoonTools.Bonk
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests if two multishape-transform pairs are overlapping.
|
/// Tests if two multishape-transform pairs are overlapping.
|
||||||
/// Note that this must perform pairwise comparison so the worst-case performance of this method will vary inversely with the amount of shapes in the multishapes.
|
/// Note that this must perform pairwise comparison so the worst-case performance of this method will vary inversely with the amount of shapes in the multishapes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="multiShapeA"></param>
|
/// <param name="multiShapeA"></param>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Structs;
|
using MoonTools.Core.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.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.Structs;
|
using MoonTools.Core.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.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.Structs;
|
using MoonTools.Core.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.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,12 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Structs;
|
using MoonTools.Core.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// A Point is "that which has not part". All points by themselves are identical.
|
|
||||||
/// </summary>
|
|
||||||
public struct Point : IShape2D, IEquatable<Point>
|
public struct Point : IShape2D, IEquatable<Point>
|
||||||
{
|
{
|
||||||
public AABB AABB { get; }
|
public AABB AABB { get; }
|
||||||
|
|
|
@ -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.Structs;
|
using MoonTools.Core.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A Shape defined by an arbitrary collection of vertices.
|
/// A Shape defined by an arbitrary collection of vertices.
|
||||||
|
@ -59,7 +59,7 @@ namespace MoonTools.Bonk
|
||||||
|
|
||||||
public bool Equals(IShape2D other)
|
public bool Equals(IShape2D other)
|
||||||
{
|
{
|
||||||
return other is Polygon otherPolygon && Equals(otherPolygon);
|
return (other is Polygon otherPolygon && Equals(otherPolygon));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(Polygon other)
|
public bool Equals(Polygon other)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Structs;
|
using MoonTools.Core.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.Bonk
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A rectangle is a shape defined by a width and height. The origin is the center of the rectangle.
|
/// A rectangle is a shape defined by a width and height. The origin is the center of the rectangle.
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Structs;
|
using MoonTools.Core.Structs;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.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,11 +1,11 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.Bonk
|
||||||
{
|
{
|
||||||
public struct SweepResult<T> where T : IEquatable<T>
|
public struct SweepResult<T> where T : IEquatable<T>
|
||||||
{
|
{
|
||||||
public readonly static SweepResult<T> False = new SweepResult<T>();
|
public static SweepResult<T> False = new SweepResult<T>();
|
||||||
|
|
||||||
public bool Hit { get; }
|
public bool Hit { get; }
|
||||||
public Vector2 Motion { get; }
|
public Vector2 Motion { get; }
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using MoonTools.Structs;
|
using MoonTools.Core.Structs;
|
||||||
|
|
||||||
namespace MoonTools.Bonk
|
namespace MoonTools.Core.Bonk
|
||||||
{
|
{
|
||||||
public static class SweepTest
|
public static class SweepTest
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ namespace MoonTools.Bonk
|
||||||
nearestTransform = shapeTransform;
|
nearestTransform = shapeTransform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nearestRectangle.HasValue)
|
if (nearestRectangle.HasValue)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace MoonTools.Bonk.Extensions
|
namespace MoonTools.Core.Bonk.Extensions
|
||||||
{
|
{
|
||||||
internal static class Vector2Extensions
|
internal static class Vector2Extensions
|
||||||
{
|
{
|
||||||
|
@ -15,4 +15,4 @@ namespace MoonTools.Bonk.Extensions
|
||||||
return a.Cross(b) > 0 ? Vector2.Normalize(new Vector2(ab.Y, ab.X)) : Vector2.Normalize(new Vector2(ab.Y, -ab.X));
|
return a.Cross(b) > 0 ? Vector2.Normalize(new Vector2(ab.Y, ab.X)) : Vector2.Normalize(new Vector2(ab.Y, -ab.X));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
# MoonTools.Bonk
|
# MoonTools.Core.Bonk
|
||||||
|
|
||||||
[![NuGet Badge](https://buildstats.info/nuget/MoonTools.Bonk)](https://www.nuget.org/packages/MoonTools.Bonk/)
|
[![NuGet Badge](https://buildstats.info/nuget/MoonTools.Core.Bonk)](https://www.nuget.org/packages/MoonTools.Core.Bonk/)
|
||||||
[![Build Status](https://gitea.drone.moonside.games/api/badges/MoonsideGames/MoonTools.Bonk/status.svg)](https://gitea.drone.moonside.games/MoonsideGames/MoonTools.Bonk)
|
[![CircleCI](https://circleci.com/gh/MoonsideGames/MoonTools.Core.Bonk.svg?style=svg)](https://circleci.com/gh/MoonsideGames/MoonTools.Core.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.Bonk;
|
using MoonTools.Core.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.Structs;
|
using MoonTools.Core.Structs;
|
||||||
using MoonTools.Bonk;
|
using MoonTools.Core.Bonk;
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
{
|
{
|
||||||
|
@ -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 * 2)); // move past
|
var movedTransform = new Transform2D(transformA.Position - (intersection * 1.01f)); // move a tiny bit 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 * 2)); // move past
|
var movedTransform = new Transform2D(transformA.Position - (intersection * 1.01f)); // move a tiny bit past
|
||||||
|
|
||||||
NarrowPhase.TestCollision(circleA, movedTransform, circleB, transformB).Should().BeFalse();
|
NarrowPhase.TestCollision(circleA, movedTransform, circleB, transformB).Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
@ -71,10 +71,7 @@ namespace Tests
|
||||||
|
|
||||||
var intersection = NarrowPhase.Intersect(line, transformA, square, transformB, simplex);
|
var intersection = NarrowPhase.Intersect(line, transformA, square, transformB, simplex);
|
||||||
|
|
||||||
intersection.X.Should().Be(1);
|
var movedTransform = new Transform2D(transformA.Position - (intersection * 1.01f)); // move a tiny bit past
|
||||||
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.Bonk;
|
using MoonTools.Core.Bonk;
|
||||||
using MoonTools.Structs;
|
using MoonTools.Core.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.Bonk;
|
using MoonTools.Core.Bonk;
|
||||||
using MoonTools.Structs;
|
using MoonTools.Core.Structs;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using MoonTools.Structs;
|
using MoonTools.Core.Structs;
|
||||||
using MoonTools.Bonk;
|
using MoonTools.Core.Bonk;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using MoonTools.Bonk;
|
using MoonTools.Core.Bonk;
|
||||||
using MoonTools.Structs;
|
using MoonTools.Core.Structs;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace Tests
|
namespace Tests
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -12,4 +12,4 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Bonk\Bonk.csproj" />
|
<ProjectReference Include="..\Bonk\Bonk.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue