API Docs for: 1.4.0
Show:

Kiwi.Geom.Circle Class

Defined in: src\geom\Circle.ts:9
Module: Geom
Parent Module: Kiwi

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

Constructor

Kiwi.Geom.Circle

(
  • [x=0]
  • [y=0]
  • [diameter=0]
)
Kiwi.Geom.Circle

Parameters:

  • [x=0] Number optional

    The x coordinate of the center of the circle.

  • [y=0] Number optional

    The y coordinate of the center of the circle.

  • [diameter=0] Number optional

    The diameter of the circle.

Returns:

Kiwi.Geom.Circle:

This circle object

Methods

circumferencePoint

(
  • angle
  • [asDegress=false]
  • [output]
)
Kiwi.Geom.Point public

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

Parameters:

  • angle Number

    The angle in radians (unless asDegrees is true) to return the point from.

  • [asDegress=false] Boolean optional

    Is the given angle in radians (false) or degrees (true)?

  • [output] Kiwi.Geom.Point optional

    A Point object to put the result in to. If none specified a new Point object will be created.

Returns:

Kiwi.Geom.Point:

The Point object holding the result.

clone

(
  • [output=Circle]
)
Kiwi.Geom.Circle public

Returns a new Circle object with the same values for the x, y, diameter, and radius properties as the original Circle object.

Parameters:

  • [output=Circle] Kiwi.Geom.Circle optional

    If given the values will be set into the object, otherwise a brand new Circle object will be created and returned.

Returns:

copyFrom

(
  • source
)
Kiwi.Geom.Circle public

Copies all of circle data from a Circle object passed (the source) into this Circle object.

Parameters:

Returns:

Kiwi.Geom.Circle:

This circle object

copyTo

(
  • circle
)
Kiwi.Geom.Circle public

Copies all of circle data from this Circle object into a passed Circle object (destination).

Parameters:

Returns:

Kiwi.Geom.Circle:

The destination circle object

distanceTo

(
  • target
  • [round=false]
)
Number public

Returns the distance from the center of this Circle object to the passed object. The passed object can be a Circle, Point, or anything with x/y values.

Parameters:

  • target Any

    The destination Point object.

  • [round=false] Boolean optional

    Round the distance to the nearest integer (default false)

Returns:

Number:

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

equals

(
  • toCompare
)
Boolean public

Determines whether a Circle passed is equal to this Circle. They are considered 'equal' if both circles have the same values for x, y, and diameter properties.

Parameters:

Returns:

Boolean:

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.

intersects

(
  • toIntersect
)
Boolean public

Determines whether a Circle passed intersects with this Circle. Returns a boolean indicating if the two circles intersect.

Parameters:

  • toIntersect Kiwi.Geom.Circle

    The Circle object to compare against to see if it intersects with this Circle object.

Returns:

Boolean:

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

isEmpty

() Boolean public

Determines whether or not this Circle object is empty.

Returns:

Boolean:

A value of true if the Circle objects diameter is less than or equal to 0; otherwise false.

objType

() String public

The type of this object.

Returns:

String:

"Circle"

offset

(
  • dx
  • dy
)
Kiwi.Geom.Circle public

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

Parameters:

  • 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.

Returns:

Kiwi.Geom.Circle:

This Circle object.

offsetPoint

(
  • point
)
Kiwi.Geom.Circle public

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

Parameters:

  • point Kiwi.Geom.Point

    A Point object to use to offset this Circle object.

Returns:

Kiwi.Geom.Circle:

This Circle object.

setTo

(
  • x
  • y
  • diameter
)
Kiwi.Geom.Circle public

Sets the members of Circle to the specified values.

Parameters:

  • 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.

Returns:

Kiwi.Geom.Circle:

This circle object

toString

() String public

Returns a string representation of this object.

Returns:

String:

a string representation of the instance.

Properties

_diameter

Number private

The diameter of the circle

Default: 0

_radius

Number private

The radius of the circle

Default: 0

area

Number public

Gets the area of this Circle. Note this is READ ONLY.

bottom

Number public

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.

circumference

Number public

The circumference of the circle. This is READ ONLY.

diameter

Number public

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

left

Number public

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.

radius

Number public

The radius of the circle. 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.

right

Number public

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.

top

Number public

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.

x

Number public

The x coordinate of the center of the circle

Default: 0

y

Number public

The y coordinate of the center of the circle

Default: 0