# Class: Circle

## Phaser. Circle

Phaser - Circle

#### new Circle(x, y, diameter) → {Phaser.Circle}

  Creates a new Circle object with the center coordinate specified by the x and y parameters and the diameter specified by the diameter parameter. If you call this function without parameters, a circle with x, y, diameter and radius properties set to 0 is created.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `x` | number | <optional> | 0 | The x coordinate of the center of the circle.
  `y` | number | <optional> | 0 | The y coordinate of the center of the circle.
  `diameter` | number | <optional> | 0 | The diameter of the circle.

  Source:
    - geom/Circle.js, line 17

  ##### Returns:

  This circle object

  Type
    Phaser.Circle

### Members

#### <readonly> area

  The area of this Circle.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `area` | number | The area of this circle.

  Source:
    - geom/Circle.js, line 375

#### bottom

  The sum of the y and radius properties. Changing the bottom property of a Circle object has no effect on the x and y properties, but does change the diameter.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `bottom` | number | Gets or sets the bottom of the circle.

  Source:
    - geom/Circle.js, line 348

#### diameter

  The largest distance between any two points on the circle. The same as the radius * 2.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `diameter` | number | Gets or sets the diameter of the circle.

  Source:
    - geom/Circle.js, line 222

#### empty

  Determines whether or not this Circle object is empty. Will return a value of true if the Circle objects diameter is less than or equal to 0; otherwise false. If set to true it will reset all of the Circle objects properties to 0. A Circle object is empty if its diameter is less than or equal to 0.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `empty` | boolean | Gets or sets the empty state of the circle.

  Source:
    - geom/Circle.js, line 398

#### left

  The x coordinate of the leftmost point of the circle. Changing the left property of a Circle object has no effect on the x and y properties. However it does affect the diameter, whereas changing the x value does not affect the diameter property.

  Source:
    - geom/Circle.js, line 267

#### radius

  The length of a line extending from the center of the circle to any point on the circle itself. The same as half the diameter.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `radius` | number | Gets or sets the radius of the circle.

  Source:
    - geom/Circle.js, line 244

#### right

  The x coordinate of the rightmost point of the circle. Changing the right property of a Circle object has no effect on the x and y properties. However it does affect the diameter, whereas changing the x value does not affect the diameter property.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `right` | number | Gets or sets the value of the rightmost point of the circle.

  Source:
    - geom/Circle.js, line 294

#### <readonly> right

  Returns the area of the polygon.

  Source:
    - geom/Polygon.js, line 148

#### top

  The sum of the y minus the radius property. Changing the top property of a Circle object has no effect on the x and y properties, but does change the diameter.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `top` | number | Gets or sets the top of the circle.

  Source:
    - geom/Circle.js, line 321

#### x

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `x` | number | The x coordinate of the center of the circle.

  Source:
    - geom/Circle.js, line 26

#### y

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `y` | number | The y coordinate of the center of the circle.

  Source:
    - geom/Circle.js, line 31

### Methods

#### <static> circumferencePoint(a, angle, asDegrees, out) → {Phaser.Point}

  Returns a Point object containing the coordinates of a point on the circumference of the Circle based on the given angle.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `a` | Phaser.Circle |  |  | The first Circle object.
  `angle` | number |  |  | The angle in radians (unless asDegrees is true) to return the point from.
  `asDegrees` | boolean | <optional> | false | Is the given angle in radians (false) or degrees (true)?
  `out` | Phaser.Point | <optional> |  | An optional Point object to put the result in to. If none specified a new Point object will be created.

  Source:
    - geom/Circle.js, line 469

  ##### Returns:

  The Point object holding the result.

  Type
    Phaser.Point

#### <static> contains(a, x, y) → {boolean}

  Return true if the given x/y coordinates are within the Circle object.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `a` | Phaser.Circle | The Circle to be checked.
  `x` | number | The X value of the coordinate to test.
  `y` | number | The Y value of the coordinate to test.

  Source:
    - geom/Circle.js, line 421

  ##### Returns:

  True if the coordinates are within this circle, otherwise false.

  Type
    boolean

#### <static> equals(a, b) → {boolean}

  Determines whether the two Circle objects match. This method compares the x, y and diameter properties.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `a` | Phaser.Circle | The first Circle object.
  `b` | Phaser.Circle | The second Circle object.

  Source:
    - geom/Circle.js, line 446

  ##### Returns:

  A value of true if the object has exactly the same values for the x, y and diameter properties as this Circle object; otherwise false.

  Type
    boolean

#### <static> intersects(a, b) → {boolean}

  Determines whether the two Circle objects intersect. This method checks the radius distances between the two Circle objects to see if they intersect.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `a` | Phaser.Circle | The first Circle object.
  `b` | Phaser.Circle | The second Circle object.

  Source:
    - geom/Circle.js, line 457

  ##### Returns:

  A value of true if the specified object intersects with this Circle object; otherwise false.

  Type
    boolean

#### <static> intersectsRectangle(c, r) → {boolean}

  Checks if the given Circle and Rectangle objects intersect.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `c` | Phaser.Circle | The Circle object to test.
  `r` | Phaser.Rectangle | The Rectangle object to test.

  Source:
    - geom/Circle.js, line 495

  ##### Returns:

  True if the two objects intersect, otherwise false.

  Type
    boolean

#### circumference() → {number}

  The circumference of the circle.

  Source:
    - geom/Circle.js, line 56

  ##### Returns:

  Type
    number

#### circumferencePoint(angle, asDegrees, out) → {Phaser.Point}

  Returns a Point object containing the coordinates of a point on the circumference of the Circle based on the given angle.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `angle` | number |  |  | The angle in radians (unless asDegrees is true) to return the point from.
  `asDegrees` | boolean | <optional> | false | Is the given angle in radians (false) or degrees (true)?
  `out` | Phaser.Point | <optional> |  | An optional Point object to put the result in to. If none specified a new Point object will be created.

  Source:
    - geom/Circle.js, line 169

  ##### Returns:

  The Point object holding the result.

  Type
    Phaser.Point

#### clone(out) → {Phaser.Circle}

  Returns a new Circle object with the same values for the x, y, width, and height properties as this Circle object.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `out` | Phaser.Circle | Optional Circle object. If given the values will be set into the object, otherwise a brand new Circle object will be created and returned.

  Source:
    - geom/Circle.js, line 135

  ##### Returns:

  The cloned Circle object.

  Type
    Phaser.Circle

#### contains(x, y) → {boolean}

  Return true if the given x/y coordinates are within this Circle object.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `x` | number | The X value of the coordinate to test.
  `y` | number | The Y value of the coordinate to test.

  Source:
    - geom/Circle.js, line 156

  ##### Returns:

  True if the coordinates are within this circle, otherwise false.

  Type
    boolean

#### copyFrom(source) → {Circle}

  Copies the x, y and diameter properties from any given object to this Circle.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `source` | any | The object to copy from.

  Source:
    - geom/Circle.js, line 84

  ##### Returns:

  This Circle object.

  Type
    Circle

#### copyTo(dest) → {Object}

  Copies the x, y and diameter properties from this Circle to any given object.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `dest` | any | The object to copy to.

  Source:
    - geom/Circle.js, line 96

  ##### Returns:

  This dest object.

  Type
    Object

#### distance(dest, round) → {number}

  Returns the distance from the center of the Circle object to the given object (can be Circle, Point or anything with x/y properties)

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `dest` | object |  | The target object. Must have visible x and y properties that represent the center of the object.
  `round` | boolean | <optional> | Round the distance to the nearest integer (default false).

  Source:
    - geom/Circle.js, line 112

  ##### Returns:

  The distance between this Point object and the destination Point object.

  Type
    number

#### offset(dx, dy) → {Circle}

  Adjusts the location of the Circle object, as determined by its center coordinate, by the specified amounts.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `dx` | number | Moves the x value of the Circle object by this amount.
  `dy` | number | Moves the y value of the Circle object by this amount.

  Source:
    - geom/Circle.js, line 183

  ##### Returns:

  This Circle object.

  Type
    Circle

#### offsetPoint(point) → {Circle}

  Adjusts the location of the Circle object using a Point object as a parameter. This method is similar to the Circle.offset() method, except that it takes a Point object as a parameter.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `point` | Point | A Point object to use to offset this Circle object (or any valid object with exposed x and y properties).

  Source:
    - geom/Circle.js, line 199

  ##### Returns:

  This Circle object.

  Type
    Circle

#### setTo(x, y, diameter) → {Circle}

  Sets the members of Circle to the specified values.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `x` | number | The x coordinate of the center of the circle.
  `y` | number | The y coordinate of the center of the circle.
  `diameter` | number | The diameter of the circle in pixels.

  Source:
    - geom/Circle.js, line 65

  ##### Returns:

  This circle object.

  Type
    Circle

#### toString() → {string}

  Returns a string representation of this object.

  Source:
    - geom/Circle.js, line 209

  ##### Returns:

  a string representation of the instance.

  Type
    string