cocos2d-x  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PUSphere Class Reference

A sphere primitive, mostly used for bounds checking. More...

#include <CCPUSphere.h>

Public Member Functions

 PUSphere ()
 Standard constructor - creates a unit sphere around the origin. More...
 
 PUSphere (const Vec3 &center, float radius)
 Constructor allowing arbitrary spheres. More...
 
 PUSphere ( local center, local radius)
 Constructor allowing arbitrary spheres. More...
 
float getRadius (void) const
 Returns the radius of the sphere. More...
 
void setRadius (float radius)
 Sets the radius of the sphere. More...
 
const Vec3getCenter (void) const
 Returns the center point of the sphere. More...
 
void setCenter (const Vec3 &center)
 Sets the center point of the sphere. More...
 
bool intersects (const PUSphere &s) const
 Returns whether or not this sphere intersects another sphere. More...
 
bool intersects (const Vec3 &v) const
 Returns whether or not this sphere intersects a box. More...
 
void merge (const PUSphere &oth)
 Merges another Sphere into the current sphere. More...
 

Protected Attributes

float _radius
Vec3 _center

Detailed Description

A sphere primitive, mostly used for bounds checking.

Remarks
A sphere in math texts is normally represented by the function x^2 + y^2 + z^2 = r^2 (for sphere's centered on the origin). Ogre stores spheres simply as a center point and a radius.

Constructor & Destructor Documentation

PUSphere ( )

Standard constructor - creates a unit sphere around the origin.

var PUSphere ( )

Standard constructor - creates a unit sphere around the origin.

local PUSphere ( )

Standard constructor - creates a unit sphere around the origin.

PUSphere ( const Vec3 center,
float  radius 
)

Constructor allowing arbitrary spheres.

Parameters
centerThe center point of the sphere.
radiusThe radius of the sphere.
var PUSphere ( var  center,
var  radius 
)

Constructor allowing arbitrary spheres.

Parameters
centerThe center point of the sphere.
radiusThe radius of the sphere.
local PUSphere ( local  center,
local  radius 
)

Constructor allowing arbitrary spheres.

Parameters
centerThe center point of the sphere.
radiusThe radius of the sphere.

Member Function Documentation

const Vec3& getCenter ( void  ) const
inline

Returns the center point of the sphere.

var getCenter (   )
inline

Returns the center point of the sphere.

local getCenter (   )
inline

Returns the center point of the sphere.

float getRadius ( void  ) const
inline

Returns the radius of the sphere.

var getRadius (   )
inline

Returns the radius of the sphere.

local getRadius (   )
inline

Returns the radius of the sphere.

bool intersects ( const PUSphere s) const
inline

Returns whether or not this sphere intersects another sphere.

var intersects ( var  s)
inline

Returns whether or not this sphere intersects another sphere.

local intersects ( local  s)
inline

Returns whether or not this sphere intersects another sphere.

bool intersects ( const Vec3 v) const
inline

Returns whether or not this sphere intersects a box.

Returns whether or not this sphere intersects a plane. Returns whether or not this sphere intersects a point.

var intersects ( var  v)
inline

Returns whether or not this sphere intersects a box.

Returns whether or not this sphere intersects a plane. Returns whether or not this sphere intersects a point.

local intersects ( local  v)
inline

Returns whether or not this sphere intersects a box.

Returns whether or not this sphere intersects a plane. Returns whether or not this sphere intersects a point.

void merge ( const PUSphere oth)

Merges another Sphere into the current sphere.

var merge ( var  oth)

Merges another Sphere into the current sphere.

local merge ( local  oth)

Merges another Sphere into the current sphere.

void setCenter ( const Vec3 center)
inline

Sets the center point of the sphere.

var setCenter ( var  center)
inline

Sets the center point of the sphere.

local setCenter ( local  center)
inline

Sets the center point of the sphere.

void setRadius ( float  radius)
inline

Sets the radius of the sphere.

var setRadius ( var  radius)
inline

Sets the radius of the sphere.

local setRadius ( local  radius)
inline

Sets the radius of the sphere.

Member Data Documentation

Vec3 _center
protected
var _center
protected
local _center
protected
float _radius
protected
var _radius
protected
local _radius
protected

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