bonk-docs/content/api/IShape2D.md

27 lines
825 B
Markdown
Raw Normal View History

2019-09-15 18:42:12 +00:00
---
title: "IShape2D"
date: 2019-09-15T11:06:50-07:00
weight: 5
---
2020-07-18 20:13:59 +00:00
An *IShape2D* is an interface that, when implemented, allows for computation of Minkowski Differences.
2019-09-15 18:42:12 +00:00
2019-12-02 06:43:33 +00:00
Your *IShape2D* implementations should be structs for memory efficiency purposes.
2019-09-15 18:42:12 +00:00
## Methods
##### **Vector2 Support(Vector2 direction, Transform2D transform)**
A method which implements a support function for use with a Minkowski Difference.
The support function must, given a directional vector and a Transform2D, return the farthest possible vertex of the transformed shape in the given direction.
For example, the support function for Bonk's *Circle* implementation:
```cs
public Vector2 Support(Vector2 direction, Transform2D transform)
{
return Vector2.Transform(Vector2.Normalize(direction) * Radius, transform.TransformMatrix);
}
```