TrinityCore
|
#include <Box2D.h>
Public Member Functions | |
Box2D (const Vector2 ¢er=Vector2(0, 0), float w=0, float h=0, float angle=0) | |
Box2D (const AABox2D &b) | |
Box2D (const Vector2 &min, const Vector2 &max) | |
Box2D (const CFrame &frame, Box2D &b) | |
bool | contains (const Vector2 &v) const |
const Vector2 & | extent () const |
Distance from corner(0) to the next corner along the box's local axis a. More... | |
const Vector2 & | axis (int a) const |
Unit length vector along axis a. More... | |
float | area () const |
Surface area. More... | |
const Vector2 & | corner (int i) const |
const Vector2 & | center () const |
bool | overlaps (const Box2D &other) const |
Private Member Functions | |
bool | overlaps1Way (const Box2D &other) const |
void | computeAxes () |
Private Attributes | |
Vector2 | m_corner [4] |
Vector2 | m_axisin [2] |
Vector2 | m_axis [2] |
Vector2 | m_center |
float | origin [2] |
float | m_area |
Vector2 | m_extent |
2D oriented box [http://www.flipcode.com/archives/2D_OBB_Intersection.shtml]
G3D::Box2D::Box2D | ( | const Vector2 & | center = Vector2(0, 0) , |
float | w = 0 , |
||
float | h = 0 , |
||
float | angle = 0 |
||
) |
center | World-space center |
w | Width along object-space x-axis |
h | Height along object-space y-axis |
angle | Counter-clockwise angle from object-space x-axis in radians |
Transform b by frame, discarding the Z components, and compute the new box.
|
inline |
Surface area.
Unit length vector along axis a.
|
private |
Updates the axes after the m_corners move. Assumes the m_corners actually form a rectangle.
Distance from corner(0) to the next corner along the box's local axis a.
Returns true if the intersection of the boxes is non-empty.
Returns true if other overlaps one dimension of this.
|
private |
Surface area
|
private |
Two edges of the box extended away from corner[0], with unit length
|
private |
Two edges of the box extended away from corner[0], with length = 1 / extentSquared
|
private |
Centroid of the box
|
private |
Corners of the box, where 0 is the lower left.
|
private |
|
private |
origin[a] = m_corner[0].dot(m_axisin[a]);