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

A circle shape. More...

#include <CCPhysicsShape.h>

Inheritance diagram for PhysicsShapeCircle:
PhysicsShape Ref

Public Member Functions

virtual float calculateDefaultMoment () override
 Calculate the moment for a circle. More...
 
float getRadius () const
 Get the circle's radius. More...
 
virtual Vec2 getOffset () override
 Get this circle's position offset. More...
 
- Public Member Functions inherited from PhysicsShape
PhysicsBodygetBody () const
 Get the body that this shape attaches. More...
 
Type getType () const
 Return this shape's type. More...
 
float getArea () const
 Return this shape's area. More...
 
float getMoment () const
 Get this shape's moment. More...
 
void setMoment (float moment)
 Set this shape's moment. More...
 
void setTag (int tag)
 Set this shape's tag. More...
 
int getTag () const
 Get this shape's tag. More...
 
float getMass () const
 Get the mass of this shape. More...
 
void setMass (float mass)
 Set this shape's mass. More...
 
float getDensity () const
 Get this shape's density. More...
 
void setDensity (float density)
 Set this shape's density. More...
 
float getRestitution () const
 Get this shape's restitution. More...
 
void setRestitution (float restitution)
 Set this shape's restitution. More...
 
float getFriction () const
 Get this shape's friction. More...
 
void setFriction (float friction)
 Set this shape's friction. More...
 
const PhysicsMaterialgetMaterial () const
 Get this shape's PhysicsMaterial object. More...
 
local getMaterial ()
 Get this shape's PhysicsMaterial object. More...
 
void setMaterial (const PhysicsMaterial &material)
 Set this shape's material. More...
 
local setMaterial ( local material)
 Set this shape's material. More...
 
virtual Vec2 getCenter ()
 Get this shape's center position. More...
 
local getCenter ()
 Get this shape's center position. More...
 
bool containsPoint (const Vec2 &point) const
 Test point is inside this shape or not. More...
 
void setCategoryBitmask (int bitmask)
 Set a mask that defines which categories this physics body belongs to. More...
 
var setCategoryBitmask ( var bitmask)
 Set a mask that defines which categories this physics body belongs to. More...
 
local setCategoryBitmask ( local bitmask)
 Set a mask that defines which categories this physics body belongs to. More...
 
int getCategoryBitmask () const
 Get a mask that defines which categories this physics body belongs to. More...
 
var getCategoryBitmask ()
 Get a mask that defines which categories this physics body belongs to. More...
 
local getCategoryBitmask ()
 Get a mask that defines which categories this physics body belongs to. More...
 
void setContactTestBitmask (int bitmask)
 A mask that defines which categories of bodies cause intersection notifications with this physics body. More...
 
int getContactTestBitmask () const
 Get a mask that defines which categories of bodies cause intersection notifications with this physics body. More...
 
void setCollisionBitmask (int bitmask)
 A mask that defines which categories of physics bodies can collide with this physics body. More...
 
int getCollisionBitmask () const
 Get a mask that defines which categories of physics bodies can collide with this physics body. More...
 
void setGroup (int group)
 Set the group of body. More...
 
int getGroup ()
 Get the group of body. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor. More...
 

Static Public Member Functions

static PhysicsShapeCirclecreate (float radius, const PhysicsMaterial &material=PHYSICSSHAPE_MATERIAL_DEFAULT, const Vec2 &offset=Vec2(0, 0))
 Creates a PhysicsShapeCircle with specified value. More...
 
local create ( local radius, local PHYSICSSHAPE_MATERIAL_DEFAULT, local 0)
 Creates a PhysicsShapeCircle with specified value. More...
 
static float calculateArea (float radius)
 Calculate the area of a circle with specified radius. More...
 
static float calculateMoment (float mass, float radius, const Vec2 &offset=Vec2::ZERO)
 Calculate the moment of a circle with specified value. More...
 
local calculateMoment ( local mass, local radius, local ZERO)
 Calculate the moment of a circle with specified value. More...
 
- Static Public Member Functions inherited from PhysicsShape
static void recenterPoints (Vec2 *points, int count, const Vec2 &center=Vec2::ZERO)
 Move the points to the center. More...
 
local recenterPoints ( local points, local count, local ZERO)
 Move the points to the center. More...
 
static Vec2 getPolyonCenter (const Vec2 *points, int count)
 Get center of the polyon points. More...
 

Protected Member Functions

bool init (float radius, const PhysicsMaterial &material=PHYSICSSHAPE_MATERIAL_DEFAULT, const Vec2 &offset=Vec2::ZERO)
virtual float calculateArea () override
 calculate the area of this shape More...
 
virtual void updateScale () override
 PhysicsShapeCircle ()
 PhysicsShapeCircle ()
virtual ~PhysicsShapeCircle ()
- Protected Member Functions inherited from PhysicsShape
void setBody (PhysicsBody *body)
virtual void setScale (float scaleX, float scaleY)
local setScale ( local scaleX, local scaleY)
void addShape (cpShape *shape)
 PhysicsShape ()
virtual ~PhysicsShape ()=0
local ~PhysicsShape ()
- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 
 Ref ()
 Constructor. More...
 

Additional Inherited Members

- Public Types inherited from PhysicsShape
enum  Type {
  UNKNOWN, CIRCLE, BOX, POLYGEN,
  EDGESEGMENT, EDGEBOX, EDGEPOLYGEN, EDGECHAIN
}
 
- Protected Attributes inherited from PhysicsShape
PhysicsBody_body
std::vector< cpShape * > _cpShapes
Type _type
float _area
float _mass
float _moment
float _scaleX
float _scaleY
float _newScaleX
float _newScaleY
PhysicsMaterial _material
int _tag
int _categoryBitmask
int _collisionBitmask
int _contactTestBitmask
int _group
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 
local _referenceCount
 count of references More...
 

Detailed Description

A circle shape.

Constructor & Destructor Documentation

PhysicsShapeCircle ( )
protected
var PhysicsShapeCircle ( )
protected
local PhysicsShapeCircle ( )
protected
virtual ~PhysicsShapeCircle ( )
protectedvirtual
var ~PhysicsShapeCircle ( )
protectedvirtual
local ~PhysicsShapeCircle ( )
protectedvirtual

Member Function Documentation

static float calculateArea ( float  radius)
static

Calculate the area of a circle with specified radius.

Parameters
radiusA float number
Returns
A float number
var calculateArea ( var  radius)
static

Calculate the area of a circle with specified radius.

Parameters
radiusA float number
Returns
A float number
local calculateArea ( local  radius)
static

Calculate the area of a circle with specified radius.

Parameters
radiusA float number
Returns
A float number
virtual float calculateArea ( )
overrideprotectedvirtual

calculate the area of this shape

Reimplemented from PhysicsShape.

var calculateArea ( )
overrideprotectedvirtual

calculate the area of this shape

Reimplemented from PhysicsShape.

local calculateArea ( )
overrideprotectedvirtual

calculate the area of this shape

Reimplemented from PhysicsShape.

virtual float
calculateDefaultMoment
( )
overridevirtual

Calculate the moment for a circle.

Returns
A float number.

Reimplemented from PhysicsShape.

var calculateDefaultMoment ( )
overridevirtual

Calculate the moment for a circle.

Returns
A float number.

Reimplemented from PhysicsShape.

local calculateDefaultMoment ( )
overridevirtual

Calculate the moment for a circle.

Returns
A float number.

Reimplemented from PhysicsShape.

static float calculateMoment ( float  mass,
float  radius,
const Vec2 offset = Vec2::ZERO 
)
static

Calculate the moment of a circle with specified value.

Parameters
massA float number
radiusA float number
offsetA Vec2 object, it is the offset from the body’s center of gravity in body local coordinates.
Returns
A float number
var calculateMoment ( var  mass,
var  radius,
var  offset = Vec2::ZERO 
)
static

Calculate the moment of a circle with specified value.

Parameters
massA float number
radiusA float number
offsetA Vec2 object, it is the offset from the body’s center of gravity in body local coordinates.
Returns
A float number
local calculateMoment ( local  mass,
local  radius,
local  offset = Vec2::ZERO 
)
static

Calculate the moment of a circle with specified value.

Parameters
massA float number
radiusA float number
offsetA Vec2 object, it is the offset from the body’s center of gravity in body local coordinates.
Returns
A float number
static PhysicsShapeCircle* create ( float  radius,
const PhysicsMaterial material = PHYSICSSHAPE_MATERIAL_DEFAULT,
const Vec2 offset = Vec2(0, 0) 
)
static

Creates a PhysicsShapeCircle with specified value.

Parameters
radiusA float number, it is the circle's radius.
materialA PhysicsMaterial object, the default value is PHYSICSSHAPE_MATERIAL_DEFAULT.
offsetA Vec2 object, it is the offset from the body’s center of gravity in body local coordinates.
Returns
An autoreleased PhysicsShapeCircle object pointer.
var create ( var  radius,
var  material = PHYSICSSHAPE_MATERIAL_DEFAULT,
var  offset = Vec2(0, 0) 
)
static

Creates a PhysicsShapeCircle with specified value.

Parameters
radiusA float number, it is the circle's radius.
materialA PhysicsMaterial object, the default value is PHYSICSSHAPE_MATERIAL_DEFAULT.
offsetA Vec2 object, it is the offset from the body’s center of gravity in body local coordinates.
Returns
An autoreleased PhysicsShapeCircle object pointer.
local create ( local  radius,
local  material = PHYSICSSHAPE_MATERIAL_DEFAULT,
local  offset = Vec2(0, 0) 
)
static

Creates a PhysicsShapeCircle with specified value.

Parameters
radiusA float number, it is the circle's radius.
materialA PhysicsMaterial object, the default value is PHYSICSSHAPE_MATERIAL_DEFAULT.
offsetA Vec2 object, it is the offset from the body’s center of gravity in body local coordinates.
Returns
An autoreleased PhysicsShapeCircle object pointer.
virtual Vec2 getOffset ( )
overridevirtual

Get this circle's position offset.

Returns
A Vec2 object.

Reimplemented from PhysicsShape.

var getOffset ( )
overridevirtual

Get this circle's position offset.

Returns
A Vec2 object.

Reimplemented from PhysicsShape.

local getOffset ( )
overridevirtual

Get this circle's position offset.

Returns
A Vec2 object.

Reimplemented from PhysicsShape.

float getRadius ( ) const

Get the circle's radius.

Returns
A float number.
var getRadius ( )

Get the circle's radius.

Returns
A float number.
local getRadius ( )

Get the circle's radius.

Returns
A float number.
bool init ( float  radius,
const PhysicsMaterial material = PHYSICSSHAPE_MATERIAL_DEFAULT,
const Vec2 offset = Vec2::ZERO 
)
protected
var init ( var  radius,
var  material = PHYSICSSHAPE_MATERIAL_DEFAULT,
var  offset = Vec2::ZERO 
)
protected
local init ( local  radius,
local  material = PHYSICSSHAPE_MATERIAL_DEFAULT,
local  offset = Vec2::ZERO 
)
protected
virtual void updateScale ( )
overrideprotectedvirtual

Reimplemented from PhysicsShape.

var updateScale ( )
overrideprotectedvirtual

Reimplemented from PhysicsShape.

local updateScale ( )
overrideprotectedvirtual

Reimplemented from PhysicsShape.


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