Box2d

Public Class

Table of Contents
Signature
class Box2d {}

Constructor

Public Constructor

Constructs a new instance of the Box2d class

Parameters
NameDescription

x

(optional)

number

y

(optional)

number

w

(optional)

number

h

(optional)

number

Properties

aspectRatio

Public Readonly Property

Signature
get aspectRatio(): number

center

Public Property

Signature
get center(): Vec2d

set center(v: Vec2d)
References

Vec2d


Collides

Public Static Property

Signature
static Collides: (A: Box2d, B: Box2d) => boolean
References

Box2d


Common

Public Static Property

Signature
static Common: (boxes: Box2d[]) => Box2d
References

Box2d


Contains

Public Static Property

Signature
static Contains: (A: Box2d, B: Box2d) => boolean
References

Box2d


ContainsPoint

Public Static Property

Signature
static ContainsPoint: (A: Box2d, B: number | VecLike, y?: number) => boolean
References

Box2d, VecLike


corners

Public Readonly Property

Signature
get corners(): Vec2d[]
References

Vec2d


h

Public Property

Signature
h: number

height

Public Property

Signature
get height(): number

set height(n: number)

Includes

Public Static Property

Signature
static Includes: (A: Box2d, B: Box2d) => boolean
References

Box2d


maxX

Public Readonly Property

Signature
get maxX(): number

maxY

Public Readonly Property

Signature
get maxY(): number

midX

Public Readonly Property

Signature
get midX(): number

midY

Public Readonly Property

Signature
get midY(): number

minX

Public Property

Signature
get minX(): number

set minX(n: number)

minY

Public Property

Signature
get minY(): number

set minY(n: number)

point

Public Property

Signature
get point(): Vec2d

set point(val: Vec2d)
References

Vec2d


sides

Public Readonly Property

Signature
get sides(): Array<[Vec2d, Vec2d]>
References

Array, Vec2d


Sides

Public Static Property

Signature
static Sides: (A: Box2d, inset?: number) => Vec2d[][]
References

Box2d, Vec2d


size

Public Readonly Property

Signature
get size(): Vec2d
References

Vec2d


snapPoints

Public Readonly Property

Signature
get snapPoints(): Vec2d[]
References

Vec2d


w

Public Property

Signature
w: number

width

Public Property

Signature
get width(): number

set width(n: number)

x

Public Property

Signature
x: number

y

Public Property

Signature
y: number

Methods

clone()

Public Method

Parameters

None

Returns
Box2d
References

Box2d


collides()

Public Method

Parameters
NameDescription

B

Box2d
Returns
boolean
References

Box2d


contains()

Public Method

Parameters
NameDescription

B

Box2d
Returns
boolean
References

Box2d


containsPoint()

Public Method

Parameters
NameDescription

V

number | VecLike

y

(optional)

number
Returns
boolean
References

VecLike


equals()

Public Method

Parameters
NameDescription

other

Box2d | Box2dModel
Returns
boolean
References

Box2d, Box2dModel


Equals()

Public Static Method

Parameters
NameDescription

a

Box2d | Box2dModel

b

Box2d | Box2dModel
Returns
boolean
References

Box2d, Box2dModel


expand()

Public Method

Parameters
NameDescription

A

Box2d
Returns
this
References

Box2d


Expand()

Public Static Method

Parameters
NameDescription

A

Box2d

B

Box2d
Returns
Box2d
References

Box2d


expandBy()

Public Method

Parameters
NameDescription

n

number
Returns
this

ExpandBy()

Public Static Method

Parameters
NameDescription

A

Box2d

n

number
Returns
Box2d
References

Box2d


From()

Public Static Method

Parameters
NameDescription

box

Box2dModel
Returns
Box2d
References

Box2dModel, Box2d


FromPoints()

Public Static Method

Parameters
NameDescription

points

VecLike[]
Returns
Box2d
References

VecLike, Box2d


getHandlePoint()

Public Method

Parameters
NameDescription

handle

SelectionCorner | SelectionEdge
Returns
Vec2d
References

SelectionCorner, SelectionEdge, Vec2d


includes()

Public Method

Parameters
NameDescription

B

Box2d
Returns
boolean
References

Box2d


resize()

Public Method

Parameters
NameDescription

handle

SelectionCorner | SelectionEdge | string

dx

number

dy

number
Returns
void
References

SelectionCorner, SelectionEdge


Resize()

Public Static Method

Parameters
NameDescription

box

Box2d

handle

SelectionCorner | SelectionEdge | string

dx

number

dy

number

isAspectRatioLocked

(optional)

boolean
Returns
{
  box: Box2d
  scaleX: number
  scaleY: number
}
References

Box2d, SelectionCorner, SelectionEdge


scale()

Public Method

Parameters
NameDescription

n

number
Returns
this

set()

Public Method

Parameters
NameDescription

x

(optional)

number

y

(optional)

number

w

(optional)

number

h

(optional)

number
Returns
this

setTo()

Public Method

Parameters
NameDescription

B

Box2d
Returns
this
References

Box2d


snapToGrid()

Public Method

Parameters
NameDescription

size

number
Returns
void

toFixed()

Public Method

Parameters

None

Returns
this

toJson()

Public Method

Parameters

None

Returns
Box2dModel
References

Box2dModel


translate()

Public Method

Parameters
NameDescription

delta

VecLike
Returns
this
References

VecLike


union()

Public Method

Parameters
NameDescription

box

Box2dModel
Returns
this
References

Box2dModel


Edit this page
Last edited on 15 June 2023
areAnglesCompatiblecanolicalizeRotation