# Ellipse

## constructor

`g.Ellipse(c, rx, ry)`

Return a new ellipse object with center at point `c`

and parameters `rx`

and `ry`

.

## Methods

### bbox()

`ellipse.bbox()`

Return a rectangle that is the bounding box of the ellipse.

### center()

`ellipse.center()`

Return a point that is the center of the ellipse.

### clone()

`ellipse.clone()`

Return another ellipse which is a clone of the ellipse.

### containsPoint()

`ellipse.containsPoint(p)`

Return `true`

if the point `p`

is inside the ellipse (inclusive). Return `false`

otherwise.

### equals()

`ellipse.equals(otherEllipse)`

Return `true`

if the ellipse equals the other ellipse.

### inflate()

`ellipse.inflate(dx [, dy])`

Return an ellipse inflated in axis **x** by **2 * dx** and in axis **y** by **2 * dy**. When method is called with a single parameter, the resulting ellipse is inflated by **2 * dx** in both **x** and **y** axis.

### intersectionWithLine()

`ellipse.intersectionWithLine(line)`

Return an array of the intersection points of the ellipse and the line. Return `null`

if no intersection exists.

### intersectionWithLineFromCenterToPoint()

`ellipse.intersectionWithLineFromCenterToPoint(p, angle)`

Return the point on the boundary of the ellipse that is the intersection of the ellipse with a line starting in the center of the ellipse ending in the point `p`

. If `angle`

is specified, the intersection will take into account the rotation of the ellipse by `angle`

degrees around its center.

### normalizedDistance()

`ellipse.normalizedDistance(p)`

Return a normalized distance from the ellipse center to point `p`

.

Returns `n < 1`

for points inside the ellipse, `n = 1`

for points lying on the ellipse boundary and `n > 1`

for points outside the ellipse.

### round()

`ellipse.round([precision])`

Round all coordinates of the ellipse to the given precision.

Default precision is `0`

.

Modifies this ellipse in-place, and returns it.

### tangentTheta()

`ellipse.tangentTheta(point)`

Returns the angle between the x axis and the tangent from a `point`

. It is valid for points lying on the ellipse boundary only.

### toString()

`ellipse.toString()`

Returns the ellipse represented as a string.

`new g.Ellipse({ x: 10, y: 10}, 20, 30).toString() = "10@10 20 30"`

## Static methods

### fromRect()

`g.Ellipse.fromRect(rect)`

Return a new ellipse object from the given rect.