DWVv0.37.0

Ellipse

Source: ellipse.js:31

Ellipse shape.


Constructor

new Ellipse(centre: Point2D, a: number, b: number): Ellipse

Parameters

  • centre (Point2D) — A Point2D representing the centre of the ellipse.
  • a (number) — The radius of the ellipse on the horizontal axe.
  • b (number) — The radius of the ellipse on the vertical axe.

Instance Methods

getCenter(): Point2D

Get the centre (point) of the ellipse.

Returns

  • Point2D — The center (point) of the ellipse.

getCentroid(): Point2D

Get the centroid of the ellipse.

Returns

getA(): number

Get the radius of the ellipse on the horizontal axe.

Returns

  • number — The radius of the ellipse on the horizontal axe.

getB(): number

Get the radius of the ellipse on the vertical axe.

Returns

  • number — The radius of the ellipse on the vertical axe.

contains(point: Point2D, tolerance?: number): boolean

Check if a point is inside the ellipse, the ellipse radii being extended by a tolerance.

Parameters

  • point (Point2D) — The point to check.
  • tolerance (number, optional, default: 0) — Optional radius extension, defaults to 0.

Returns

  • boolean — True if the point is in the ellipse.

equals(rhs: Ellipse): boolean

Check for equality.

Parameters

  • rhs (Ellipse) — The object to compare to.

Returns

  • boolean — True if both objects are equal.

getSurface(): number

Get the surface of the ellipse.

Returns

  • number — The surface of the ellipse.

getWorldSurface(spacing2D: Scalar2D): number

Get the surface of the ellipse according to a spacing.

Parameters

  • spacing2D (Scalar2D) — The 2D spacing.

Returns

  • number — The surface of the ellipse multiplied by the given spacing or null for null spacings.

getRound(): Array.<Array.<Array.<number>>>

Get the rounded limits of the ellipse.

See: https://en.wikipedia.org/wiki/Ellipse#Standard_equation.

Ellipse formula: x*x / a*a + y*y / b*b = 1.

Implies: y = (+-)(b/a) * sqrt(a*a - x*x).

Returns

  • Array.<Array.<Array.<number>>> — The rounded limits: list of [x, y] pairs (min, max).

quantify( viewController: ViewController, index: Index, flags: Array.<string>, ): Record.<string, NumberValue>

Quantify an ellipse according to view information.

Parameters

  • viewController (ViewController) — The associated view controller.
  • index (Index) — The index at which to get the image values.
  • flags (Array.<string>) — A list of stat values to calculate.

Returns

  • Record.<string, NumberValue> — A quantification object.