forked from MoonsideGames/MoonTools.Bonk
				
			Compare commits
	
		
			13 Commits 
		
	
	
		
			multishape
			...
			master
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								
								 | 
						c7fa0932d6 | |
| 
							
							
								
								 | 
						e57bae4c44 | |
| 
							
							
								
								 | 
						094cf4b3d2 | |
| 
							
							
								
								 | 
						e6bab0de5e | |
| 
							
							
								
								 | 
						b152755481 | |
| 
							
							
								
								 | 
						401f827b69 | |
| 
							
							
								
								 | 
						bcc0d0abc2 | |
| 
							
							
								
								 | 
						137f0a90b5 | |
| 
							
							
								
								 | 
						29ce203452 | |
| 
							
							
								
								 | 
						fa42ae77be | |
| 
							
							
								
								 | 
						a46dd831d3 | |
| 
							
							
								
								 | 
						777af13171 | |
| 
							
							
								
								 | 
						d0b72d1749 | 
| 
						 | 
					@ -1,46 +0,0 @@
 | 
				
			||||||
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*)?$/
 | 
					 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,24 @@
 | 
				
			||||||
 | 
					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.Core.Structs;
 | 
					using MoonTools.Structs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace MoonTools.Core.Bonk
 | 
					namespace MoonTools.Bonk
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /// <summary>
 | 
					    /// <summary>
 | 
				
			||||||
    /// Axis-aligned bounding box.
 | 
					    /// Axis-aligned bounding box.
 | 
				
			||||||
| 
						 | 
					@ -26,11 +26,13 @@ namespace MoonTools.Core.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,28 +1,29 @@
 | 
				
			||||||
<Project Sdk="Microsoft.NET.Sdk">
 | 
					<Project Sdk="Microsoft.NET.Sdk">
 | 
				
			||||||
  <PropertyGroup>
 | 
					  <PropertyGroup>
 | 
				
			||||||
    <Version>6.0.0</Version>
 | 
					    <Version>8.0.1</Version>
 | 
				
			||||||
    <TargetFramework>netstandard2.0</TargetFramework>
 | 
					    <TargetFramework>netstandard2.0</TargetFramework>
 | 
				
			||||||
    <Description>.NET Core High Performance Collision Detection</Description>
 | 
					    <Description>.NET Standard 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>
 | 
				
			||||||
 | 
					    <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="MoonTools.Core.Structs" Version="3.0.0" />
 | 
					    <PackageReference Include="System.Collections.Immutable" Version="1.7.1" />
 | 
				
			||||||
    <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,7 +1,6 @@
 | 
				
			||||||
using System;
 | 
					using MoonTools.Structs;
 | 
				
			||||||
using MoonTools.Core.Structs;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace MoonTools.Core.Bonk
 | 
					namespace MoonTools.Bonk
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public interface IHasAABB2D
 | 
					    public interface IHasAABB2D
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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 : 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.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,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.Core.Structs;
 | 
					using MoonTools.Structs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace MoonTools.Core.Bonk
 | 
					namespace MoonTools.Bonk
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public struct MultiShape : IHasAABB2D
 | 
					    public struct MultiShape : IHasAABB2D
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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,9 +1,12 @@
 | 
				
			||||||
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>
 | 
				
			||||||
 | 
					    /// 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.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.
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,7 @@ namespace MoonTools.Core.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.Core.Structs;
 | 
					using MoonTools.Structs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace MoonTools.Core.Bonk
 | 
					namespace MoonTools.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.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,11 +1,11 @@
 | 
				
			||||||
using System;
 | 
					using System;
 | 
				
			||||||
using System.Numerics;
 | 
					using System.Numerics;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace MoonTools.Core.Bonk
 | 
					namespace MoonTools.Bonk
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public struct SweepResult<T> where T : IEquatable<T>
 | 
					    public struct SweepResult<T> where T : IEquatable<T>
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public static SweepResult<T> False = new SweepResult<T>();
 | 
					        public readonly 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.Core.Structs;
 | 
					using MoonTools.Structs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace MoonTools.Core.Bonk
 | 
					namespace MoonTools.Bonk
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public static class SweepTest
 | 
					    public static class SweepTest
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[](https://www.nuget.org/packages/MoonTools.Core.Bonk/)
 | 
					[](https://www.nuget.org/packages/MoonTools.Bonk/)
 | 
				
			||||||
[](https://circleci.com/gh/MoonsideGames/MoonTools.Core.Bonk)
 | 
					[](https://gitea.drone.moonside.games/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
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -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();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -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;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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;
 | 
				
			||||||
using System.Collections.Immutable;
 | 
					using System.Collections.Immutable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
using System.Numerics;
 | 
					using System.Numerics;
 | 
				
			||||||
using FluentAssertions;
 | 
					using FluentAssertions;
 | 
				
			||||||
using MoonTools.Core.Bonk;
 | 
					using MoonTools.Bonk;
 | 
				
			||||||
using MoonTools.Core.Structs;
 | 
					using MoonTools.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.0</TargetFramework>
 | 
					    <TargetFramework>netcoreapp3.1</TargetFramework>
 | 
				
			||||||
    <IsPackable>false</IsPackable>
 | 
					    <IsPackable>false</IsPackable>
 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue