Skip to main content

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

readonly radius: number

Defined in: physics/shapes/circle-shape.ts:9


type

readonly type: "circle" = 'circle'

Defined in: physics/shapes/circle-shape.ts:7

The kind of shape this is, used to dispatch collision detection.

Implementation of

ShapeBase.type

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

ShapeBase.getArea


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

ShapeBase.getBoundingRadius


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.

Implementation of

ShapeBase.getMomentOfInertia