Class Ellipse

an ellipse Object

Constructors

  • Parameters

    • x: number

      the center x coordinate of the ellipse

    • y: number

      the center y coordinate of the ellipse

    • w: number

      width (diameter) of the ellipse

    • h: number

      height (diameter) of the ellipse

    Returns Ellipse

Properties

the center coordinates of the ellipse

radius: number

Maximum radius of the ellipse

radiusSq: Vector2d

Radius squared, for pythagorean theorom

radiusV: Vector2d

Pre-scaled radius vector for ellipse

ratio: Vector2d

x/y scaling ratio for ellipse

type: string

the shape type (used internally)

"Ellipse"

Methods

  • check if this circle/ellipse contains the specified point

    Parameters

    • Rest...args: any[]

    Returns boolean

    true if contains

    if (circle.contains(10, 10)) {
    // do something
    }
    // or
    if (circle.contains(myVector2d)) {
    // do something
    }
  • returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.

    Returns Bounds

    this shape bounding box Rectangle object

  • Scale this Ellipse by the specified scalar.

    Parameters

    • x: number

      the scale factor along the x-axis

    • Optionaly: number = x

      the scale factor along the y-axis

    Returns Ellipse

    Reference to this object for method chaining

  • set new value to the Ellipse shape

    Parameters

    • x: number

      the center x coordinate of the ellipse

    • y: number

      the center y coordinate of the ellipse

    • w: number

      width (diameter) of the ellipse

    • h: number

      height (diameter) of the ellipse

    Returns Ellipse

    this instance for objecf chaining

  • translate the circle/ellipse by the specified offset

    Parameters

    • Rest...args: any

    Returns Ellipse

    this ellipse

    ellipse.translate(10, 10);
    // or
    ellipse.translate(myVector2d);