Class Bounds

a bound object contains methods for creating and manipulating axis-aligned bounding boxes (AABB).

Hierarchy (view full)

Constructors

constructor

Properties

_center

_center: Vector2d

max

max: XYPoint

min

min: XYPoint

type

type: "Bounds"

Accessors

bottom

center

centerX

centerY

height

left

right

top

width

x

y

Methods

add

  • add(vertices, clear?): void
  • Adds the given vertices to the bounds definition.

    Parameters

    • vertices: Vector2d [] | Point [] | XYPoint []

      An array of Vector2d or Point to add to the bounds.

    • Optionalclear: boolean = false

      Whether to reset the bounds before adding the new vertices. Defaults to false.

    Returns void

addBounds

  • addBounds(bounds, clear?): void
  • Adds the given bounds to the bounds definition.

    Parameters

    • bounds: Bounds

      The bounds to add.

    • Optionalclear: boolean = false

      Whether to reset the bounds before adding the new bounds.

    Returns void

addFrame

  • addFrame(x0, y0, x1, y1, m?): void
  • Adds the given quad coordinates to this bounds definition, multiplied by the given matrix.

    Parameters

    • x0: number

      The left x coordinate of the quad.

    • y0: number

      The top y coordinate of the quad.

    • x1: number

      The right x coordinate of the quad.

    • y1: number

      The bottom y coordinate of the quad.

    • Optionalm: Matrix2d

      An optional transform to apply to the given coordinates.

    Returns void

addPoint

centerOn

  • centerOn(x, y): Bounds
  • Centers the bounds position around the given coordinates.

    Parameters

    • x: number

      The x coordinate to center around.

    • y: number

      The y coordinate to center around.

    Returns Bounds

    The current Bounds instance for method chaining.

clear

clone

contains

isFinite

  • isFinite(): boolean
  • Determines whether all coordinates of this bounds are finite numbers.

    Returns boolean

    False if any coordinates are positive or negative Infinity or NaN; otherwise, true.

overlaps

  • overlaps(bounds): boolean
  • Returns true if the two bounds intersect.

    Parameters

    • bounds: Bounds

      The bounds to check for intersection.

    Returns boolean

    True if the bounds overlap, otherwise false.

setMinMax

  • setMinMax(minX, minY, maxX, maxY): void
  • Sets the bounds to the given minimum and maximum values.

    Parameters

    • minX: number

      The minimum x value.

    • minY: number

      The minimum y value.

    • maxX: number

      The maximum x value.

    • maxY: number

      The maximum y value.

    Returns void

shift

toPolygon

translate

update

Settings

Member Visibility

On This Page

AltStyle によって変換されたページ (->オリジナル) /