Options
All
  • Public
  • Public/Protected
  • All
Menu

表示一个二维平面中的 AABB 盒子

+---------+ | | | | | | +---------+

Class representing a bounding box in Two-dimensional coordinate system

Hierarchy

  • Box2

Index

Constructors

constructor

  • Returns Box2

  • Parameters

    • min: Vector2

      Box2 的最小顶点(左下角)

    • max: Vector2

      Box2 的最大顶点(右上角)

    Returns Box2

Properties

max

max: Vector2 = ...

Box2 的最大顶点(右上角)

min

min: Vector2 = ...

Box2 的最小顶点(左下角)

Accessors

center

  • Box2 的中心点

    Returns Vector2

points

  • Box2 的 4 个顶点

    当前坐标系为,X向左为正,Y向上为正时,其4个顶点相对位置如下:

    3---------2 | | | | | | 0---------1

    Returns Vector2[]

size

  • Box2 的尺寸

    Returns Vector2

Methods

checkValid

  • checkValid(): boolean
  • 检查当前 Box2 是否合法

    Returns boolean

isPointInBox

  • isPointInBox(point: Vector2, tolerance?: number): boolean
  • 判断点是否在 Box2 内

    Parameters

    • point: Vector2
    • tolerance: number = ...

    Returns boolean

setMax

  • 设置 Box2 的最大顶点

    Parameters

    Returns void

setMin

  • 设置 Box2 的最小顶点

    Parameters

    Returns void

Static createByGeometry

  • 根据几何信息计算一个 Box2

    Calculate the Box2 base on geometric information

    Parameters

    Returns Box2

    A Box2

Static createByPoints

  • 计算包围所有点的最小 Box2

    Calculate the smallest Box2 surrounding all points

    Parameters

    Returns Box2

    A Box2

Legend

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

Generated using TypeDoc