OrientedBounds
class OrientedBounds
An oriented bounding box is a rotated rectangle.
An oriented bounding box is modelled by rotating its (axis-aligned) OrientedBounds#innerBounds by an angle OrientedBounds#angle around its center. The center of an oriented bounding box and its axis-aligned inner-bounds coincide.
Constructor
new OrientedBounds(innerBounds: number | AxisAlignedBounds, angle: number) → {}
Name | Type | Default | Description |
---|---|---|---|
innerBounds | number | AxisAlignedBounds | 0 | |
angle | number | 0 |
new OrientedBounds(x: number, y: number, width: number, height: number, angle: number) → {}
Name | Type | Attributes | Description |
---|---|---|---|
x | number |
<optional> |
|
y | number |
<optional> |
|
width | number |
<optional> |
|
height | number |
<optional> |
|
angle | number |
<optional> |
Summary
Properties from OrientedBounds
PIXI.Point |
The bottom-left corner of this bounding box. The returned instance should not be modified directly. |
PIXI.Point |
The bottom-right corner of this bounding box. The returned instance should not be modified directly. |
PIXI.Point |
The center of this bounding box. |
[PIXI.Point, PIXI.Point, PIXI.Point, PIXI.Point] |
The four-corners of this bounding, in clockwise order starting from the top-left. |
The unrotated version of this bounding box. |
|
number |
The angle, in radians, by which this bounding box is tilted. |
PIXI.Point |
The top-left corner of this bounding box. The returned instance should not be modified directly. |
PIXI.Point |
The top-right corner of this bounding box. The returned instance should not be modified directly. |
Methods from OrientedBounds
boolean |
Whether this bounding box contains the given point |
this |
Copies |
boolean |
Checks whether the given |
boolean |
Whether any internal state needs to be recalculated. |
void |
|
Public Properties
bottomLeft: PIXI.Point
The bottom-left corner of this bounding box. The returned instance should not be modified directly.
bottomRight: PIXI.Point
The bottom-right corner of this bounding box. The returned instance should not be modified directly.
center: PIXI.Point
The center of this bounding box.
The center of this and this.innerBounds
will always coincide.
hull: [PIXI.Point, PIXI.Point, PIXI.Point, PIXI.Point]
The four-corners of this bounding, in clockwise order starting from the top-left.
rotation: number
The angle, in radians, by which this bounding box is tilted.
topLeft: PIXI.Point
The top-left corner of this bounding box. The returned instance should not be modified directly.
topRight: PIXI.Point
The top-right corner of this bounding box. The returned instance should not be modified directly.
Public Methods
contains(point: PIXI.Point | number) → {boolean}
Whether this bounding box contains the given point
Name | Type | Description |
---|---|---|
point | PIXI.Point | number |
Type | Description |
---|---|
boolean |
copyFrom(bounds: OrientedBounds) → {this}
Copies bounds
into this instance.
Name | Type | Description |
---|---|---|
bounds | OrientedBounds |
Type | Description |
---|---|
this |
equals(bounds: OrientedBounds) → {boolean}
Checks whether the given bounds
are equal to this.
Name | Type | Description |
---|---|---|
bounds | OrientedBounds |
Type | Description |
---|---|
boolean |
Protected Methods
protected isDirty() → {boolean}
Whether any internal state needs to be recalculated.
Type | Description |
---|---|
boolean |
protected update() → {void}
This will recalculate the center, orientation matrix, and the hull vertices. It should be called only if
this.isDirty
returns true.
Type | Description |
---|---|
void |