bonk-docs/content/api/AABB.md

56 lines
1.4 KiB
Markdown
Raw Normal View History

---
title: "AABB"
date: 2019-12-31T14:36:00-07:00
weight: 6
---
*AABB*, or axis-aligned bounding box, is defined by a minimum point and a maximum point. It is used for broad-phase collision detection. It represents a rectangular outline of the shape so we can quickly insert shapes into a *SpatialHash*.
## Properties
2020-07-18 20:13:59 +00:00
##### **public Vector2 Min**
The minimum point of the AABB.
2020-07-18 20:13:59 +00:00
##### **public Vector2 Max**
The maximum point of the AABB.
2020-07-18 20:13:59 +00:00
##### **public float Width**
2019-12-31 22:41:05 +00:00
The width of the AABB.
2020-07-18 20:13:59 +00:00
##### **public float Height**
2019-12-31 22:41:05 +00:00
The height of the AABB.
2020-07-18 20:13:59 +00:00
##### **public float Right**
The right point of the AABB.
##### **public float Left**
The left point of the AABB.
##### **public float Top**
The top point of the AABB.
##### **public float Bottom**
The bottom point of the AABB.
## Methods
##### **public static AABB FromVertices(IEnumerable<Position2D> vertices)**
Can be used to generate an AABB from an arbitrary collection of vertices. It is generally better to define a more efficient AABB generation method based on the properties of a particular shape, but this can be used for an arbitrary collection of vertices, like a polygon.
##### **public static AABB Transformed(AABB aabb, Transform2D transform)**
Efficiently transforms an AABB. Used internally by SpatialHash to quickly transform a shape's AABB.
2020-07-18 20:13:59 +00:00
##### **public static bool TestOverlap(AABB a, AABB b)**
Efficiently checks if two AABBs overlap.