Class R.math.Circle2D
Extends
R.math.PooledMathObject.
A 2D circle class with helpful manipulation methods.
Defined in: circle2d.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.math.Circle2D(x, y, radius)
Create a circle object specifying the X and Y center position and
the radius.
|
Method Attributes | Method Name and Description |
---|---|
approximateFromRectangle(rect)
Approximate a circle from the given rectangle
|
|
containsCircle(circle)
Determine if this circle contains the specified circle.
|
|
containsPoint(point)
Returns true if this circle contains the specified point.
|
|
destroy()
Destroy the instance of the circle
|
|
equals(circle)
Returns true if this circle is equal to the specified circle.
|
|
get()
Get an object with the elements containing centerX, centerY, and radius
as the elements x, y, and r.
|
|
Get the center point of this circle.
|
|
Return the classname of the this object
|
|
Get the radius of this circle
|
|
isContained(circle)
Determine if this circle is contained within the specified circle.
|
|
isIntersecting(circle)
Determine if this circle intersects another circle.
|
|
offset(offsetPtOrX, offsetY)
Offset this circle by the given amount in the X and Y axis.
|
|
release()
Release the circle back into the pool for reuse.
|
|
set(x, y, radius)
Set the values of this circle.
|
|
toString()
Returns a printable version of this object.
|
- Methods borrowed from class R.engine.PooledObject:
- clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toXML
Class Detail
R.math.Circle2D(x, y, radius)
Create a circle object specifying the X and Y center position and
the radius.
- Parameters:
- x
- {Number} The center X coordinate
- y
- {Number} The center Y coordinate
- radius
- {Number} The radius of the circle
Method Detail
{R.math.Circle2D}
approximateFromRectangle(rect)
Approximate a circle from the given rectangle
- Parameters:
- rect
- {R.math.Rectangle2D} The rectangle to use
- Returns:
- {R.math.Circle2D}
{Boolean}
containsCircle(circle)
Determine if this circle contains the specified circle.
- Parameters:
- circle
- {R.math.Circle2D} A circle to compare against
- Returns:
- {Boolean} true if the rectangle is fully contained within this rectangle.
{Boolean}
containsPoint(point)
Returns true if this circle contains the specified point.
- Parameters:
- point
- {R.math.Point2D} The point to test
- Returns:
- {Boolean} true if the point is within the circle
destroy()
Destroy the instance of the circle
{Boolean}
equals(circle)
Returns true if this circle is equal to the specified circle.
- Parameters:
- circle
- {R.math.Circle2D} The circle to compare to
- Returns:
- {Boolean} true if the two circles are equal
{Object}
get()
Get an object with the elements containing centerX, centerY, and radius
as the elements x, y, and r.
- Returns:
- {Object} An object with the specified elements
{R.math.Point2D}
getCenter()
Get the center point of this circle.
- Returns:
- {R.math.Point2D} The center point
{String}
getClassName()
Return the classname of the this object
- Returns:
- {String} "R.math.Circle2D"
{Number}
getRadius()
Get the radius of this circle
- Returns:
- {Number} The radius
{Boolean}
isContained(circle)
Determine if this circle is contained within the specified circle.
- Parameters:
- circle
- {R.math.Circle2D} A circle to compare against
- Returns:
- {Boolean} true if the this circle is fully contained in the specified circle.
{Boolean}
isIntersecting(circle)
Determine if this circle intersects another circle.
- Parameters:
- circle
- A R.math.Circle2D to compare against
- Returns:
- {Boolean} true if the two circles intersect.
offset(offsetPtOrX, offsetY)
Offset this circle by the given amount in the X and Y axis. The first parameter
can be either a Point2D, or the value for the X axis. If the X axis is specified,
the second parameter should be the amount to offset in the Y axis.
- Parameters:
- offsetPtOrX
- {R.math.Point2D|int} Either a R.math.Point2D which contains the offset in X and Y, or an integer representing the offset in the X axis.
- offsetY
- {int} If
offsetPtOrX
is an integer value for the offset in the X axis, this should be the offset along the Y axis.
release()
Release the circle back into the pool for reuse.
set(x, y, radius)
Set the values of this circle.
- Parameters:
- x
- {Number|R.math.Point2D|R.math.Circle2D} An optional value to initialize the X coordinate of the circle
- y
- {Number} An optional value to initialize the Y coordinate of the circle
- radius
- {Number} An optional value to initialize the radius
{String}
toString()
Returns a printable version of this object.
- Returns:
- {String} Formatted like "cX,cY r#"