## toxi.geom Class Circle

```java.lang.Object toxi.geom.Vec2D toxi.geom.Ellipse toxi.geom.Circle
```
All Implemented Interfaces:

`public class Circleextends Ellipse` This class overrides `Ellipse` to define a 2D circle and provides several utility methods for it, including factory methods to construct circles from points.

Nested Class Summary

Nested classes/interfaces inherited from class toxi.geom.Vec2D
`Vec2D.Axis`

Field Summary

Fields inherited from class toxi.geom.Vec2D
`MAX_VALUE, MIN_VALUE, x, X_AXIS, y, Y_AXIS, ZERO`

Constructor Summary
`Circle()`

`Circle(Circle c)`

`Circle(float radius)`

```Circle(float x, float y, float radius)```

```Circle(ReadonlyVec2D origin, float radius)```

Method Summary
` boolean` `containsPoint(ReadonlyVec2D p)`
Checks if the point is within the given shape.
`static Circle` ```from2Points(Vec2D p1, Vec2D p2)```
Factory method to construct a circle which has the two given points lying on its perimeter.
`static Circle` ```from3Points(Vec2D p1, Vec2D p2, Vec2D p3)```
Factory method to construct a circle which has the three given points lying on its perimeter.
` float` `getCircumference()`
Computes the approximate circumference of the ellipse, using this equation: `2 * PI * sqrt(1/2 * (rx*rx+ry*ry))`.
` float` `getRadius()`

` Vec2D[]` `getTangentPoints(ReadonlyVec2D p)`

` Vec2D[]` `intersectsCircle(Circle c)`

` Circle` `setRadius(float r)`

Methods inherited from class toxi.geom.Ellipse
`getArea, getFoci, getRadii, setRadii, setRadii, toPolygon2D`

Methods inherited from class toxi.geom.Vec2D
`abs, add, add, add, addSelf, addSelf, angleBetween, angleBetween, bisect, clear, compareTo, constrain, constrain, copy, cross, distanceTo, distanceToSquared, dot, equals, equalsWithTolerance, floor, frac, fromTheta, getAbs, getComponent, getComponent, getConstrained, getFloored, getFrac, getInverted, getLimited, getNormalized, getNormalizedTo, getPerpendicular, getReciprocal, getReflected, getRotated, getSignum, hashCode, heading, interpolateTo, interpolateTo, interpolateTo, interpolateTo, interpolateToSelf, interpolateToSelf, invert, isInCircle, isInRectangle, isInTriangle, isMajorAxis, isZeroVector, jitter, jitter, jitter, jitter, jitter, jitter, limit, magnitude, magSquared, max, max, maxSelf, min, min, minSelf, normalize, normalizeTo, perpendicular, randomVector, randomVector, reciprocal, reflect, rotate, roundToAxis, scale, scale, scale, scale, scaleSelf, scaleSelf, scaleSelf, set, set, set, setComponent, setComponent, signum, sub, sub, sub, subSelf, subSelf, tangentNormalOfEllipse, to3DXY, to3DXZ, to3DYZ, toArray, toCartesian, toPolar, toString, x, y`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Circle

`public Circle()`

### Circle

`public Circle(Circle c)`

### Circle

`public Circle(float radius)`

### Circle

```public Circle(float x,
float y,

### Circle

```public Circle(ReadonlyVec2D origin,
Method Detail

### from2Points

```public static Circle from2Points(Vec2D p1,
Vec2D p2)```
Factory method to construct a circle which has the two given points lying on its perimeter. If the points are coincident, the circle will have a radius of zero.

Parameters:
`p1` -
`p2` -
Returns:
new circle instance

### from3Points

```public static Circle from3Points(Vec2D p1,
Vec2D p2,
Vec2D p3)```
Factory method to construct a circle which has the three given points lying on its perimeter. The function returns null, if the 3 points are co-linear (in which case it's impossible to find a circle). Based on CPP code by Paul Bourke: http://local.wasp.uwa.edu.au/~pbourke/geometry/circlefrom3/

Parameters:
`p1` -
`p2` -
`p3` -
Returns:
new circle instance or null

### containsPoint

`public boolean containsPoint(ReadonlyVec2D p)`
Description copied from interface: `Shape2D`
Checks if the point is within the given shape.

Specified by:
`containsPoint` in interface `Shape2D`
Overrides:
`containsPoint` in class `Ellipse`
Returns:
true, if inside

### getCircumference

`public float getCircumference()`
Description copied from class: `Ellipse`
Computes the approximate circumference of the ellipse, using this equation: `2 * PI * sqrt(1/2 * (rx*rx+ry*ry))`. The precise value is an infinite series elliptical integral, but the approximation comes sufficiently close. See Wikipedia for more details: http://en.wikipedia.org/wiki/Ellipse

Specified by:
`getCircumference` in interface `Shape2D`
Overrides:
`getCircumference` in class `Ellipse`
Returns:
circumference

`public float getRadius()`

### getTangentPoints

`public Vec2D[] getTangentPoints(ReadonlyVec2D p)`

### intersectsCircle

`public Vec2D[] intersectsCircle(Circle c)`

`public Circle setRadius(float r)`