VJMAP logoVJMAP
CAD · WebGIS
中

Class: Box

Updated 2026-09-14~ 4 min read
.md

Math2D.Box

Alternative 2D box object with less memory impact (four numbers instead of two min/max objects with two numbers each). Should be faster.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

+ new Box(x?: number, y?: number, w?: number, h?: number): Box

Alternative 2D box object with less memory impact (four numbers instead of two min/max objects with two numbers each). Should be faster.

Parameters
Name Type Default value Description
x number 0 New X value.
y number 0 New y value.
w number 0 New w value.
h number 0 New h value.

Returns: Box

Properties

h

• h: number= 0


w

• w: number= 0


x

• x: number= 0


y

• y: number= 0

Methods

contains

▸ contains(x: number, y: number): boolean

Test box for inclusion of point.

Parameters
Name Type Description
x number X coordinate of point.
y number Y coordinate of point.

Returns: boolean


containsBox

▸ containsBox(other: Box): boolean

Test box for inclusion of another box.

Parameters
Name Type Description
other Box Box 2 to test for inclusion.

Returns: boolean


intersects

▸ intersects(other: Box): boolean

Test two boxes for intersection.

Parameters
Name Type Description
other Box Box 2 to test for intersection.

Returns: boolean


set

▸ set(x: number, y: number, w: number, h: number): void

Set new values to all properties of the box.

Parameters
Name Type Description
x number New X value.
y number New y value.
w number New w value.
h number New h value.

Returns: void

vjmap / Exports / MiniMapControl

Was this page helpful?