updates documentation for 4.0.0

main
Evan Hemsley 2019-12-01 22:43:33 -08:00
parent 2891709536
commit f8354b9970
4 changed files with 35 additions and 11 deletions

View File

@ -10,8 +10,8 @@ Bonk **is** designed to help you figure out if two shapes are overlapping and by
Bonk **is not** a physics simulator and it will not help you execute collision responses.
Bonk is designed for performance and memory efficiency. Defining most shapes and performing collision tests require no heap allocations and thus put no pressure on the garbage collector. If you reuse spatial hashes and avoid using arbitrary polygons, Bonk will never cause garbage collection.
Bonk is designed for performance and memory efficiency. Defining shapes and performing collision tests require no heap allocations and thus put no pressure on the garbage collector. If you reuse spatial hashes, Bonk will never cause garbage collection.
Bonk is available as a [NuGet package](https://www.nuget.org/packages/MoonTools.Core.Bonk/).
Bonk is licensed under the [LGPL-3](https://www.gnu.org/licenses/lgpl-3.0.en.html) license. In summary: feel free to include it in your closed-source game and modify it internally at will, but if you make changes that you intend to redistribute, you **must** freely publish your changes.
Bonk is licensed under the [LGPL-3](https://www.gnu.org/licenses/lgpl-3.0.en.html) license. In summary: feel free to include it in your closed-source game and modify it internally at will, but if you make changes that you intend to redistribute, you **must** freely publish your changes.

View File

@ -6,7 +6,7 @@ weight: 5
An *IShape2D* is an interface that, when implemented, allows for spatial hashing and the computation of Minkowski Differences.
Your *IShape2D* types should be structs for memory efficiency purposes.
Your *IShape2D* implementations should be structs for memory efficiency purposes.
## Methods
@ -43,4 +43,4 @@ public AABB AABB(Transform2D Transform2D)
Transform2D.Position.Y + Radius
);
}
```
```

11
content/shapes/point.md Normal file
View File

@ -0,0 +1,11 @@
---
title: "Point"
date: 2019-12-01T22:41:00-08:00
weight: 6
---
To define a Point, pass either a **Position2D** struct or two integers.
```cs
var point = new Point(1, 2);
```

View File

@ -7,15 +7,28 @@ weight: 40
To define a polygon, pass a variable number of **Position2D** structs representing the points of the polygon.
```cs
var polygon = new Polygon(
new Position2D(-2, 0),
new Position2D(0, 2),
new Position2D(2, 0),
);
var polygon = new Polygon(
new Position2D(-2, 0),
new Position2D(0, 2),
new Position2D(2, 0),
);
```
This polygon, for example, is a triangle.
Be careful not to define a concave Polygon, as this will cause the results of collision detection to be incorrect.
Be careful not to define a concave Polygon, as this will cause the results of collision detection to be incorrect. Support for concave polygons is planned for a future release.
Also note that because Polygon stores its vertices in an array, instantiating Polygons will cause GC pressure. It is best to use another kind of `IShape2D` if possible.
Polygons are considered equal if they define the same vertices, regardless of order. They can even be equivalent to Rectangles:
```cs
var a = new Polygon(
new Position2D(1, 1),
new Position2D(1, -1),
new Position2D(-1, -1),
new Position2D(-1, 1)
);
var b = new Rectangle(-1, -1, 1, 1);
a == b; // true!
```