DWVv0.37.0

Circle

Source: circle.js:31

Circle shape.


Constructor

new Circle(centre: Point2D, radius: number): Circle

Parameters

  • centre (Point2D) — A Point2D representing the centre of the circle.
  • radius (number) — The radius of the circle.

Instance Methods

getCenter(): Point2D

Get the centre (point) of the circle.

Returns

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

getCentroid(): Point2D

Get the centroid of the circle.

Returns

getRadius(): number

Get the radius of the circle.

Returns

  • number — The radius of the circle.

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

Check if a point is inside the circle, or within a tolerance of its outline.

Parameters

  • point (Point2D) — The point to check.
  • tolerance (number, optional, default: 0) — Optional maximum distance to the outline for an outside point, defaults to 0.

Returns

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

equals(rhs: Circle): boolean

Check for equality.

Parameters

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

Returns

  • boolean — True if both objects are equal.

getSurface(): number

Get the surface of the circle.

Returns

  • number — The surface of the circle.

getWorldSurface(spacing2D: Scalar2D): number

Get the surface of the circle according to a spacing.

Parameters

  • spacing2D (Scalar2D) — The 2D spacing.

Returns

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

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

Get the rounded limits of the circle.

See: https://en.wikipedia.org/wiki/Circle#Equations.

Circle formula: x*x + y*y = r*r.

Implies: y = (+-) sqrt(r*r - 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 circle 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.