API Docs for: 1.0.1
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
  • [y
  • [diameter
)
Kiwi.Geom.Circle

Parameters:

  • [x Number

    = 0] The x coordinate of the center of the circle.

  • [y Number

    = 0] The y coordinate of the center of the circle.

  • [diameter Number

    = 0] The diameter of the circle.

Returns:

Kiwi.Geom.Circle:

This circle object

Methods

circumferencePoint

(
  • angle
  • [asDegress=false]
  • [output=Point]
)
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=Point] Kiwi.Geom.Point optional

    An optional 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
)
Kiwi.Geom.Circle public

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

Parameters:

  • [output Kiwi.Geom.Circle

    = Circle] 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 the source Circle object into the calling Circle object.

Parameters:

Returns:

Kiwi.Geom.Circle:

This circle object

copyTo

(
  • circle
)
Circle public

Copies all of circle data from this Circle object into the destination Circle object.

Parameters:

  • circle Circle

    The destination circle object to copy in to

Returns:

Circle:

The destination circle object

distanceTo

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

Returns the distance from the center of this Circle object to the given object (can be 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 the object specified in the toCompare parameter is equal to this Circle object. This method compares the x, y and diameter properties of an object against the same properties of this Circle object.

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 the Circle object specified in the toIntersect parameter intersects with this Circle object. This method checks the radius distances between the two Circle objects to see if they 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. This is READ ONLY.

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:

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