API Docs for: v0.1.0
Show:

Circle Class

Defined in: src\geom\Circle.js:5

The Circle object is an area defined by its position, as indicated by its center point (x, y) and by its radius.

Constructor

Circle

(
  • center
  • radius
)

Parameters:

  • center Vector

    The point of the center of the circle

  • radius Number

    The radius of the circle

Methods

clone

() Circle

Creates a clone of this Circle instance

Returns:

Circle:

a copy of the circle

contains

(
  • x
  • y
)
Boolean

Checks if the x, and y coords passed to this function are contained within this circle, or on the edge of the circle

Parameters:

  • x Number

    The X coord of the point to test

  • y Number

    The Y coord of the point to test

Returns:

Boolean:

if the x/y coords are within this polygon

copy

(
  • circle
)
Circle chainable

Copies the values from another circle to this one

Parameters:

  • circle Circle

    The circle to copy vlaues from

Returns:

Circle:

Returns itself.

equals

(
  • circle
)
Boolean

Checks if this circle's values are equal to anothers

Parameters:

  • circle Circle

    The circle to check against

Returns:

Boolean:

True if they are equal

overlaps

(
  • circle
)
Boolean

Checks if this circle overlaps another

Parameters:

  • circle Circle

    The circle to check if this overlaps

Returns:

Boolean:

if the circle overlaps

recalc

() Circle chainable

Recalculates the scaled radius

Returns:

Circle:

Returns itself.

Properties

_radius

Number private

The unscaled radius of the circle

Default: 0

area

Number

The area of the circle

circumference

Number

The circumference of the circle

position

Vector

The center of the circle

radius

Number

The radius of the circle

Default: 0

radius

Number

The radius circle

Default: 0

scale

Vector

The scale of the circle

Default: new Vector(1, 1)

x

Number

The center X coord of the circle

Default: 0

y

Number

The center Y coord of the circle

Default: 0