Class: CircleShape
Defined in: physics/shapes/circle-shape.ts:6
A circular collision shape, defined by a radius around its local origin.
Implements
Constructors
Constructor
new CircleShape(
radius):CircleShape
Defined in: physics/shapes/circle-shape.ts:16
Creates a new CircleShape instance.
Parameters
radius
number
The radius of the circle.
Returns
CircleShape
Throws
An error if the radius is not positive.
Properties
radius
readonlyradius:number
Defined in: physics/shapes/circle-shape.ts:9
type
readonlytype:"circle"='circle'
Defined in: physics/shapes/circle-shape.ts:7
The kind of shape this is, used to dispatch collision detection.
Implementation of
Methods
getArea()
getArea():
number
Defined in: physics/shapes/circle-shape.ts:30
Calculates the area of the circle.
Returns
number
The area of the circle.
Implementation of
getBoundingRadius()
getBoundingRadius():
number
Defined in: physics/shapes/circle-shape.ts:47
Returns the radius of the circle.
Returns
number
The bounding radius of the circle.
Implementation of
getMomentOfInertia()
getMomentOfInertia(
mass):number
Defined in: physics/shapes/circle-shape.ts:39
Calculates the moment of inertia of a solid disc for a given mass.
Parameters
mass
number
The mass of the body the shape belongs to.
Returns
number
The moment of inertia of the circle.