mirror of
https://github.com/wassname/phaser.git
synced 2026-07-10 00:30:50 +08:00
31 lines
634 B
JavaScript
31 lines
634 B
JavaScript
var Shape = require('./Shape');
|
|
|
|
module.exports = Line;
|
|
|
|
/**
|
|
* Line shape class. The line shape is along the x direction, and stretches from [-length/2, 0] to [length/2,0].
|
|
* @class Line
|
|
* @extends {Shape}
|
|
* @constructor
|
|
*/
|
|
function Line(length){
|
|
|
|
/**
|
|
* Length of this line
|
|
* @property length
|
|
* @type {Number}
|
|
*/
|
|
this.length = length;
|
|
|
|
Shape.call(this,Shape.LINE);
|
|
};
|
|
Line.prototype = new Shape();
|
|
Line.prototype.computeMomentOfInertia = function(mass){
|
|
return mass * Math.pow(this.length,2) / 12;
|
|
};
|
|
|
|
Line.prototype.updateBoundingRadius = function(){
|
|
this.boundingRadius = this.length/2;
|
|
};
|
|
|