Options
All
  • Public
  • Public/Protected
  • All
Menu

A PIXI.Rectangle where the width and height are always positive and the x and y are always the top-left

Hierarchy

Index

Constructors

Methods

  • _getZone(p: Point): integer
  • lineSegmentIntersects(a: Point, b: Point, [options]?: { inside: boolean }): boolean
  • Test whether a line segment AB intersects this rectangle.

    Parameters

    • a: Point

      The first endpoint of segment AB

    • b: Point

      The second endpoint of segment AB

    • [options]: { inside: boolean } = {}

      Options affecting the intersect test.

      • inside: boolean

    Returns boolean

    True if intersects.

  • intersectPolygon(polygon: Polygon, [options]?: { clipType: number; scalingFactor: number }): Polygon
  • Intersect this PIXI.Rectangle with a PIXI.Polygon. Currently uses the clipper library. In the future we may replace this with more specialized logic which uses the line-line intersection formula.

    Parameters

    • polygon: Polygon

      A PIXI.Polygon

    • [options]: { clipType: number; scalingFactor: number } = {}

      Options which configure how the intersection is computed

      • clipType: number
      • scalingFactor: number

    Returns Polygon

    The intersected polygon or null if no solution was present

  • Determine whether some other Rectangle overlaps with this one. This check differs from the parent class Rectangle#intersects test because it is true for adjacency (zero area).

    Parameters

    • other: Rectangle

      Some other rectangle against which to compare

    Returns boolean

    Do the rectangles overlap?

  • Normalize the width and height of the rectangle in-place, enforcing that those dimensions be positive.

    Returns Rectangle

  • Generate a new rectangle by rotating this one clockwise about its center by a certain number of radians

    Parameters

    • radians: number

      The angle of rotation

    Returns Rectangle

    A new rotated rectangle

  • fromRotation(x: number, y: number, width: number, height: number, radians: number): Rectangle
  • Create normalized rectangular bounds given a rectangle shape and an angle of central rotation.

    Parameters

    • x: number

      The top-left x-coordinate of the un-rotated rectangle

    • y: number

      The top-left y-coordinate of the un-rotated rectangle

    • width: number

      The width of the un-rotated rectangle

    • height: number

      The height of the un-rotated rectangle

    • radians: number

      The angle of rotation about the center

    Returns Rectangle

    The constructed rotated rectangle bounds