Kiwi.Geom.Circle Class
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]
Parameters:
-
[x=0]
Number optionalThe x coordinate of the center of the circle.
-
[y=0]
Number optionalThe y coordinate of the center of the circle.
-
[diameter=0]
Number optionalThe diameter of the circle.
Returns:
This circle object
Item Index
Methods
Methods
circumferencePoint
-
angle
-
[asDegress=false]
-
[output]
Returns a Point object containing the coordinates of a point on the circumference of this Circle based on the given angle.
Parameters:
-
angle
NumberThe angle in radians (unless asDegrees is true) to return the point from.
-
[asDegress=false]
Boolean optionalIs the given angle in radians (false) or degrees (true)?
-
[output]
Kiwi.Geom.Point optionalA Point object to put the result in to. If none specified a new Point object will be created.
Returns:
The Point object holding the result.
clone
-
[output=Circle]
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 optionalIf given the values will be set into the object, otherwise a brand new Circle object will be created and returned.
Returns:
copyFrom
-
source
Copies all of circle data from a Circle object passed (the source) into this Circle object.
Parameters:
-
source
Kiwi.Geom.CircleThe source circle object to copy from
Returns:
This circle object
copyTo
-
circle
Copies all of circle data from this Circle object into a passed Circle object (destination).
Parameters:
-
circle
Kiwi.Geom.CircleThe destination circle object to copy in to
Returns:
The destination circle object
distanceTo
-
target
-
[round=false]
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
AnyThe destination Point object.
-
[round=false]
Boolean optionalRound the distance to the nearest integer (default false)
Returns:
The distance between this Point object and the destination Point object.
equals
-
toCompare
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:
-
toCompare
Kiwi.Geom.CircleThe circle to compare to this Circle object.
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.
intersects
-
toIntersect
Determines whether a Circle passed intersects with this Circle. Returns a boolean indicating if the two circles intersect.
Parameters:
-
toIntersect
Kiwi.Geom.CircleThe Circle object to compare against to see if it intersects with this Circle object.
Returns:
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:
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:
"Circle"
offset
-
dx
-
dy
Adjusts the location of the Circle object, as determined by its center coordinate, by the specified amounts.
Parameters:
-
dx
NumberMoves the x value of the Circle object by this amount.
-
dy
NumberMoves the y value of the Circle object by this amount.
Returns:
This Circle object.
offsetPoint
-
point
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.PointA Point object to use to offset this Circle object.
Returns:
This Circle object.
setTo
-
x
-
y
-
diameter
Sets the members of Circle to the specified values.
Parameters:
-
x
NumberThe x coordinate of the center of the circle.
-
y
NumberThe y coordinate of the center of the circle.
-
diameter
NumberThe diameter of the circle in pixels.
Returns:
This circle object
toString
()
String
public
Returns a string representation of this object.
Returns:
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