Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
AABB Class Reference

Axis Aligned Bounding Box (AABB), usually used to detect the collision at early step. More...

Public Member Functions

 AABB ()
 Constructor.
 
 AABB ()
 Constructor.
 
 new ()
 Constructor.
 
 AABB (const Vec3 &min, const Vec3 &max)
 Constructor. More...
 
 AABB ( var min, var max)
 Constructor. More...
 
 new ( local min, local max)
 Constructor. More...
 
 AABB (const AABB &box)
 Constructor.
 
 AABB ( var box)
 Constructor.
 
 AABB ( local box)
 Constructor.
 
Vec3 getCenter ()
 Gets the center point of the bounding box. More...
 
var getCenter ()
 Gets the center point of the bounding box. More...
 
local getCenter ()
 Gets the center point of the bounding box. More...
 
void getCorners (Vec3 *dst) const
 Gets the corners of the bounding box. More...
 
var getCorners ( var dst)
 Gets the corners of the bounding box. More...
 
local getCorners ( local dst)
 Gets the corners of the bounding box. More...
 
bool intersects (const AABB &aabb) const
 Tests whether this bounding box intersects with the specified bounding object. More...
 
bool containPoint (const Vec3 &point) const
 Check if the point is contained in the bounding box. More...
 
void merge (const AABB &box)
 Sets this bounding box to the smallest bounding box that contains both this bounding object and the specified bounding box. More...
 
void set (const Vec3 &min, const Vec3 &max)
 Sets this bounding box to the specified values. More...
 
var set ( var min, var max)
 Sets this bounding box to the specified values. More...
 
local set ( local min, local max)
 Sets this bounding box to the specified values. More...
 
void reset ()
 Reset min and max value.If you invoke this method, isEmpty() shall return true.
 
var reset ()
 Reset min and max value.If you invoke this method, isEmpty() shall return true.
 
local reset ()
 Reset min and max value.If you invoke this method, isEmpty() shall return true.
 
bool isEmpty () const
 Check the AABB object is empty(reset). More...
 
void updateMinMax (const Vec3 *point, ssize_t num)
 Update the _min and _max from the given point. More...
 
local updateMinMax ( local point, local num)
 Update the _min and _max from the given point. More...
 
void transform (const Mat4 &mat)
 Transforms the bounding box by the given transformation matrix. More...
 

Detailed Description

Axis Aligned Bounding Box (AABB), usually used to detect the collision at early step.

Constructor & Destructor Documentation

AABB ( const Vec3 min,
const Vec3 max 
)

Constructor.

construct the AABB object from min & max vector.

@

var AABB ( var  min,
var  max 
)

Constructor.

construct the AABB object from min & max vector.

@

local new ( local  min,
local  max 
)

Constructor.

construct the AABB object from min & max vector.

@

Member Function Documentation

Vec3 getCenter ( )

Gets the center point of the bounding box.

the centre point of the bounding box.

var getCenter ( )

Gets the center point of the bounding box.

the centre point of the bounding box.

local getCenter ( )

Gets the center point of the bounding box.

the centre point of the bounding box.

void getCorners ( Vec3 dst) const

Gets the corners of the bounding box.

A pointer to corners array. Near face, specified counter-clockwise looking towards the origin from the positive z-axis. verts[0] : left top front verts[1] : left bottom front verts[2] : right bottom front verts[3] : right top front

Far face, specified counter-clockwise looking towards the origin from the negative z-axis. verts[4] : right top back verts[5] : right bottom back verts[6] : left bottom back verts[7] : left top back

var getCorners ( var  dst)

Gets the corners of the bounding box.

A pointer to corners array. Near face, specified counter-clockwise looking towards the origin from the positive z-axis. verts[0] : left top front verts[1] : left bottom front verts[2] : right bottom front verts[3] : right top front

Far face, specified counter-clockwise looking towards the origin from the negative z-axis. verts[4] : right top back verts[5] : right bottom back verts[6] : left bottom back verts[7] : left top back

local getCorners ( local  dst)

Gets the corners of the bounding box.

A pointer to corners array. Near face, specified counter-clockwise looking towards the origin from the positive z-axis. verts[0] : left top front verts[1] : left bottom front verts[2] : right bottom front verts[3] : right top front

Far face, specified counter-clockwise looking towards the origin from the negative z-axis. verts[4] : right top back verts[5] : right bottom back verts[6] : left bottom back verts[7] : left top back

bool intersects ( const AABB aabb) const

Tests whether this bounding box intersects with the specified bounding object.

The specified bounding box. Return true when two AABBs intersect, otherwise return false.

var intersects ( var  aabb)

Tests whether this bounding box intersects with the specified bounding object.

The specified bounding box. Return true when two AABBs intersect, otherwise return false.

local intersects ( local  aabb)

Tests whether this bounding box intersects with the specified bounding object.

The specified bounding box. Return true when two AABBs intersect, otherwise return false.

bool containPoint ( const Vec3 point) const

Check if the point is contained in the bounding box.

The specified point Return true when the point is contained in the bounding box, otherwise return false.

var containPoint ( var  point)

Check if the point is contained in the bounding box.

The specified point Return true when the point is contained in the bounding box, otherwise return false.

local containPoint ( local  point)

Check if the point is contained in the bounding box.

The specified point Return true when the point is contained in the bounding box, otherwise return false.

void merge ( const AABB box)

Sets this bounding box to the smallest bounding box that contains both this bounding object and the specified bounding box.

The specified box.

var merge ( var  box)

Sets this bounding box to the smallest bounding box that contains both this bounding object and the specified bounding box.

The specified box.

local merge ( local  box)

Sets this bounding box to the smallest bounding box that contains both this bounding object and the specified bounding box.

The specified box.

void set ( const Vec3 min,
const Vec3 max 
)

Sets this bounding box to the specified values.

the min vector the max vector

var set ( var  min,
var  max 
)

Sets this bounding box to the specified values.

the min vector the max vector

local set ( local  min,
local  max 
)

Sets this bounding box to the specified values.

the min vector the max vector

bool isEmpty ( ) const

Check the AABB object is empty(reset).

Return true when the AABB object is empty, otherwise return false.

var isEmpty ( )

Check the AABB object is empty(reset).

Return true when the AABB object is empty, otherwise return false.

local isEmpty ( )

Check the AABB object is empty(reset).

Return true when the AABB object is empty, otherwise return false.

void updateMinMax ( const Vec3 point,
ssize_t  num 
)

Update the _min and _max from the given point.

The points array. The pints array's size.

var updateMinMax ( var  point,
var  num 
)

Update the _min and _max from the given point.

The points array. The pints array's size.

local updateMinMax ( local  point,
local  num 
)

Update the _min and _max from the given point.

The points array. The pints array's size.

void transform ( const Mat4 mat)

Transforms the bounding box by the given transformation matrix.

the specified transform-matrix.

var transform ( var  mat)

Transforms the bounding box by the given transformation matrix.

the specified transform-matrix.

local transform ( local  mat)

Transforms the bounding box by the given transformation matrix.

the specified transform-matrix.


The documentation for this class was generated from the following file: