arcade-physics
Version:
Use Arcade Physics without Phaser.
222 lines • 7.26 kB
TypeScript
/**
* @classdesc
* A Circle object.
*
* This is a geometry object, containing numerical values and related methods to inspect and modify them.
* It is not a Game Object, in that you cannot add it to the display list, and it has no texture.
* To render a Circle you should look at the capabilities of the Graphics class.
*
* @class Circle
* @memberof Phaser.Geom
* @constructor
* @since 3.0.0
*
* @param {number} [x=0] - The x position of the center of the circle.
* @param {number} [y=0] - The y position of the center of the circle.
* @param {number} [radius=0] - The radius of the circle.
*/
export class Circle {
constructor(x: any, y: any, radius: any);
/**
* The geometry constant type of this object: `GEOM_CONST.CIRCLE`.
* Used for fast type comparisons.
*
* @name Phaser.Geom.Circle#type
* @type {number}
* @readonly
* @since 3.19.0
*/
readonly type: number;
/**
* The x position of the center of the circle.
*
* @name Phaser.Geom.Circle#x
* @type {number}
* @default 0
* @since 3.0.0
*/
x: number;
/**
* The y position of the center of the circle.
*
* @name Phaser.Geom.Circle#y
* @type {number}
* @default 0
* @since 3.0.0
*/
y: number;
/**
* The internal radius of the circle.
*
* @name Phaser.Geom.Circle#_radius
* @type {number}
* @private
* @since 3.0.0
*/
private _radius;
/**
* The internal diameter of the circle.
*
* @name Phaser.Geom.Circle#_diameter
* @type {number}
* @private
* @since 3.0.0
*/
private _diameter;
/**
* Check to see if the Circle contains the given x / y coordinates.
*
* @method Phaser.Geom.Circle#contains
* @since 3.0.0
*
* @param {number} x - The x coordinate to check within the circle.
* @param {number} y - The y coordinate to check within the circle.
*
* @return {boolean} True if the coordinates are within the circle, otherwise false.
*/
contains(x: number, y: number): boolean;
/**
* Returns a Point object containing the coordinates of a point on the circumference of the Circle
* based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point
* at 180 degrees around the circle.
*
* @method Phaser.Geom.Circle#getPoint
* @since 3.0.0
*
* @generic {Phaser.Geom.Point} O - [out,$return]
*
* @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle.
* @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created.
*
* @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the circle.
*/
getPoint(position: number, point: any): (Phaser.Geom.Point | object);
/**
* Returns an array of Point objects containing the coordinates of the points around the circumference of the Circle,
* based on the given quantity or stepRate values.
*
* @method Phaser.Geom.Circle#getPoints
* @since 3.0.0
*
* @generic {Phaser.Geom.Point[]} O - [output,$return]
*
* @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead.
* @param {number} [stepRate] - Sets the quantity by getting the circumference of the circle and dividing it by the stepRate.
* @param {(array|Phaser.Geom.Point[])} [output] - An array to insert the points in to. If not provided a new array will be created.
*
* @return {(array|Phaser.Geom.Point[])} An array of Point objects pertaining to the points around the circumference of the circle.
*/
getPoints(quantity: number, stepRate?: number | undefined, output?: any[] | Phaser.Geom.Point[] | undefined): (any[] | Phaser.Geom.Point[]);
/**
* Returns a uniformly distributed random point from anywhere within the Circle.
*
* @method Phaser.Geom.Circle#getRandomPoint
* @since 3.0.0
*
* @generic {Phaser.Geom.Point} O - [point,$return]
*
* @param {(Phaser.Geom.Point|object)} [point] - A Point or point-like object to set the random `x` and `y` values in.
*
* @return {(Phaser.Geom.Point|object)} A Point object with the random values set in the `x` and `y` properties.
*/
getRandomPoint(point?: (Phaser.Geom.Point | object)): (Phaser.Geom.Point | object);
/**
* Sets the x, y and radius of this circle.
*
* @method Phaser.Geom.Circle#setTo
* @since 3.0.0
*
* @param {number} [x=0] - The x position of the center of the circle.
* @param {number} [y=0] - The y position of the center of the circle.
* @param {number} [radius=0] - The radius of the circle.
*
* @return {this} This Circle object.
*/
setTo(x?: number | undefined, y?: number | undefined, radius?: number | undefined): this;
/**
* Sets this Circle to be empty with a radius of zero.
* Does not change its position.
*
* @method Phaser.Geom.Circle#setEmpty
* @since 3.0.0
*
* @return {this} This Circle object.
*/
setEmpty(): this;
/**
* Sets the position of this Circle.
*
* @method Phaser.Geom.Circle#setPosition
* @since 3.0.0
*
* @param {number} [x=0] - The x position of the center of the circle.
* @param {number} [y=0] - The y position of the center of the circle.
*
* @return {this} This Circle object.
*/
setPosition(x?: number | undefined, y?: number | undefined): this;
/**
* Checks to see if the Circle is empty: has a radius of zero.
*
* @method Phaser.Geom.Circle#isEmpty
* @since 3.0.0
*
* @return {boolean} True if the Circle is empty, otherwise false.
*/
isEmpty(): boolean;
set radius(arg: number);
/**
* The radius of the Circle.
*
* @name Phaser.Geom.Circle#radius
* @type {number}
* @since 3.0.0
*/
get radius(): number;
set diameter(arg: number);
/**
* The diameter of the Circle.
*
* @name Phaser.Geom.Circle#diameter
* @type {number}
* @since 3.0.0
*/
get diameter(): number;
set left(arg: number);
/**
* The left position of the Circle.
*
* @name Phaser.Geom.Circle#left
* @type {number}
* @since 3.0.0
*/
get left(): number;
set right(arg: number);
/**
* The right position of the Circle.
*
* @name Phaser.Geom.Circle#right
* @type {number}
* @since 3.0.0
*/
get right(): number;
set top(arg: number);
/**
* The top position of the Circle.
*
* @name Phaser.Geom.Circle#top
* @type {number}
* @since 3.0.0
*/
get top(): number;
set bottom(arg: number);
/**
* The bottom position of the Circle.
*
* @name Phaser.Geom.Circle#bottom
* @type {number}
* @since 3.0.0
*/
get bottom(): number;
}
//# sourceMappingURL=Circle.d.ts.map