Options
All
• Public
• Public/Protected
• All

# Class NormalizedRectangle

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

## Properties

center: { x: any; y: any }

#### Type declaration

• ##### y: any
leftEdge: { A: { x: any; y: any }; B: { x: any; y: any } }

#### Type declaration

• ##### y: any
rightEdge: { A: { x: any; y: any }; B: { x: any; y: any } }

#### Type declaration

• ##### y: any
topEdge: { A: { x: any; y: any }; B: { x: any; y: any } }

#### Type declaration

• ##### y: any
bottomEdge: { A: { x: any; y: any }; B: { x: any; y: any } }

center
leftEdge
rightEdge
topEdge
bottomEdge

## Methods

• Return the bounding box for a PIXI.Rectangle. The bounding rectangle is normalized such that the width and height are non-negative.

#### Returns Rectangle

• pointIsOn(p: Point): boolean
• Determine if a point is on or nearly on this rectangle.

#### Parameters

• ##### p: Point

Point to test

#### Returns boolean

Is the point on the rectangle boundary?

• _getEdgeZone(point: Point): number
• Calculate the rectangle Zone for a given point located around, on, or in the rectangle. See https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm This differs from _getZone in how points on the edge are treated: they are not considered inside.

#### Parameters

• ##### point: Point

A point to test for location relative to the rectangle

#### Returns number

Which edge zone does the point belong to?

• pointsBetween(a: Point, b: Point): Point[]
• Get all the points (corners) for a polygon approximation of a rectangle between two points on the rectangle. The two points can be anywhere in 2d space on or outside the rectangle. The starting and ending side are based on the zone of the corresponding a and b points. (See PIXI.Rectangle.CS_ZONES.) This is the rectangular version of PIXI.Circle.prototype.pointsBetween, and is similarly used to draw the portion of the shape between two intersection points on that shape.

#### Parameters

• ##### a: Point

A point on or outside the rectangle, representing the starting position.

• ##### b: Point

A point on or outside the rectangle, representing the starting position.

#### Returns Point[]

Points returned are clockwise from start to end.

• segmentIntersections(a: Point, b: Point): Point[]
• Get all intersection points for a segment A|B Intersections are sorted from A to B.

#### Parameters

• ##### a: Point

Endpoint A of the segment

• ##### b: Point

Endpoint B of the segment

#### Returns Point[]

Array of intersections or empty if no intersection. If A|B is parallel to an edge of this rectangle, returns the two furthest points on the segment A|B that are on the edge.

• Compute the intersection of this Rectangle with some other Rectangle.

#### Parameters

• ##### other: Rectangle

Some other rectangle which intersects this one

#### Returns Rectangle

The intersected rectangle

• Convert this PIXI.Rectangle into a PIXI.Polygon

#### Returns Polygon

The Rectangle expressed as a PIXI.Polygon

• _getZone(p: Point): number
• 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.

#### Returns boolean

True if intersects.

• intersectPolygon(polygon: Polygon, [options]?: { clipType: number; scalingFactor: number; weilerAtherton: string }): 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; weilerAtherton: string } = {}

Options which configure how the intersection is computed

#### Returns Polygon

The intersected polygon or null if no solution was present

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

#### Parameters

• ##### clipperPoints: ClipperPoint[]

An array of ClipperPoints generated by PIXI.Polygon.toClipperPoints()

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

Options which configure how the intersection is computed

#### 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

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