Options
All
  • Public
  • Public/Protected
  • All
Menu
classdesc

A bounds class with min and max values. Implementing IBounds.

requires

XYCoords

requires

Vertex

requires

IBounds

Hierarchy

  • Bounds

Implements

Index

Constructors

constructor

Properties

Readonly height

height: number
member

{number}

memberof

Bounds

instance

Readonly max

member

{XYCoords}

memberof

Bounds

instance

Readonly min

member

{XYCoords}

memberof

Bounds

instance

Readonly width

width: number
member

{number}

memberof

Bounds

instance

Methods

clone

  • Clone this bounds object (create a deep clone).

    method

    clone

    instance
    memberof

    Bounds

    Returns Bounds

    Creates a deep clone of this bounds object.

getCenter

randomPoint

  • randomPoint(horizontalSafeArea?: number, verticalSafeArea?: number): Vertex
  • Generate a random point inside this bounds object. Safe areas at the border to avoid included.

    method

    randomPoint

    instance
    memberof

    Bounds

    Parameters

    • Default value horizontalSafeArea: number = 0
    • Default value verticalSafeArea: number = 0

    Returns Vertex

    A pseudo random point inside these bounds.

toPolygon

  • Convert this rectangular bounding box to a polygon with four vertices.

    method

    toPolygon

    instance
    memberof

    Bounds

    Returns Polygon

    This bound rectangle as a polygon.

toString

  • toString(): string
  • Convert these bounds to a human readable form.

    Note: the returned format might change in the future, so please do not rely on the returned string format.

    method

    toString

    instance
    memberof

    Bounds

    Returns string

    Get these bounds in a human readable form.

Static computeFromVertices

  • Compute the minimal bounding box for a given set of vertices.

    An empty vertex array will return an empty bounding box located at (0,0).

    static
    method

    computeFromVertices

    memberof

    Bounds

    Parameters

    • vertices: Array<Vertex>

      The set of vertices you want to get the bounding box for.

    Returns Bounds

    The minimal Bounds for the given vertices.

Static fromDimension

  • fromDimension(width: number, height: number, origin?: XYCoords): Bounds
  • Create a new Bounds instance just from width and height, located at (0,0) or the optionally given origin.

    Parameters

    • width: number

      The width of the bounds

    • height: number

      The height of the bounds

    • Optional origin: XYCoords

      [optional] A origin to locate the new Bounds object at.

    Returns Bounds

    A new Bounds instance width given width and height, located at (0,0) or the given origin..

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Private property
  • Private method
  • Static property
  • Static method

Generated using TypeDoc