melonjs
    Preparing search index...

    Class Ellipse

    an ellipse Object

    Index

    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

    _bounds: Bounds

    The bounding rectangle for this shape

    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 = "Ellipse"

    the shape type (used internally)

    Methods

    • check if this circle/ellipse contains the specified point

      Parameters

      • x: number

        x coordinate or a vector point to check

      • Optionaly: number

        y coordinate

      Returns boolean

      true if contains

      if (circle.contains(10, 10)) {
      // do something
      }
      // or
      if (circle.contains(myVector2d)) {
      // do something
      }
    • check if this circle/ellipse contains the specified point

      Parameters

      Returns boolean

      true if contains

      if (circle.contains(10, 10)) {
      // do something
      }
      // or
      if (circle.contains(myVector2d)) {
      // do something
      }
    • 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