mirror of
https://github.com/wassname/phaser.git
synced 2026-06-27 16:10:15 +08:00
32 lines
628 B
JavaScript
32 lines
628 B
JavaScript
var Shape = require('./Shape');
|
|
|
|
module.exports = Circle;
|
|
|
|
/**
|
|
* Circle shape class.
|
|
* @class Circle
|
|
* @extends {Shape}
|
|
* @constructor
|
|
* @param {number} radius The radius of this circle
|
|
*/
|
|
function Circle(radius){
|
|
|
|
/**
|
|
* The radius of the circle.
|
|
* @property radius
|
|
* @type {number}
|
|
*/
|
|
this.radius = radius || 1;
|
|
|
|
Shape.call(this,Shape.CIRCLE);
|
|
};
|
|
Circle.prototype = new Shape();
|
|
Circle.prototype.computeMomentOfInertia = function(mass){
|
|
var r = this.radius;
|
|
return mass * r * r / 2;
|
|
};
|
|
|
|
Circle.prototype.updateBoundingRadius = function(){
|
|
this.boundingRadius = this.radius;
|
|
};
|