Ellipse

An ellipse is a specific instance of a conic section.

class conics.Ellipse(center, major_minor, alpha)[source]

Initializes the ellipse using its geometric representation.

Parameters:
  • center (array_like, (2, )) – The center of the ellipse.

  • major_minor (array_like, (2, )) – The size of the semi-major and semi-minor axes.

  • alpha (float) – The orientation angle in radians.

property area

Compute the area of this ellipse.

contact(pts)[source]

Computes the orthogonal points on the ellipse given some 2-D points.

Orthogonal (contact) points are points on the ellipse closest to those passed.

Parameters:

pts (array_like) – The 2-D points whose closest (orthogonal) points on the ellipse should be determined.

Returns:

contact_pts – The orthogonal points on the ellipse.

Return type:

numpy.ndarray

static from_conic(C)[source]

Constructs an ellipse from the specified conic.

refine(pts)[source]

Refine the ellipse non-linearly by minimizing the orthogonal distances.

The method uses the approach introduced by Ahn et al. [ARW01].

Parameters:

pts (array_like) – The 2-D points whose closest (orthogonal) points on the ellipse should be determined.

Returns:

The refine ellipse.

Return type:

Ellipse

segment_area(line)[source]

Computes the area of the region obtained as a result of intersecting the ellipse with a line.

If the ellipse is defined by a normalized homogeneous conic \(C\), such that the center \(\vec c\) is negative, (i.e. \(\vec c^\top C \vec c < 0\)), then this function computes the area of the spaced defined by \({ \vec p : \vec p^\top l < 0 \land \vec p^\top C \vec p < 0 }\).

If the line does not intersect or tangents the ellipse, then either zero or the full ellipse area will be returned.

Parameters:

line (array_like (3,)) – An array of representing a homogeneous line to define the conic section area.

Returns:

area – The area of the intersection of the interior of this eclipse and the negative half plane of line. This value is nonnegative and bounded by the total ellipse area.

Return type:

float

to_conic()[source]

Constructs a Conic from the current Ellipse instance.