Skip to content

@simversus/yjvis


@simversus/yjvis / math / Box

Class: Box ​

Defined in: math/Box.ts:7

Constructors ​

Constructor ​

new Box(min?, max?): Box

Defined in: math/Box.ts:49

构造函数

Parameters ​

min? ​

Vec3

最小点

max? ​

Vec3

最大点

Returns ​

Box

Properties ​

isBox3 ​

isBox3: boolean = true

Defined in: math/Box.ts:8


max ​

max: Vec3

Defined in: math/Box.ts:12

包围盒最大点


min ​

min: Vec3

Defined in: math/Box.ts:10

包围盒最小点

Accessors ​

center ​

Get Signature ​

get center(): Vec3

Defined in: math/Box.ts:30

获取包围盒中心点

Returns ​

Vec3


depth ​

Get Signature ​

get depth(): number

Defined in: math/Box.ts:25

获取包围盒深度

Returns ​

number


height ​

Get Signature ​

get height(): number

Defined in: math/Box.ts:20

获取包围盒高度

Returns ​

number


maxSideLength ​

Get Signature ​

get maxSideLength(): number

Defined in: math/Box.ts:40

获取最大边长

Returns ​

number


radius ​

Get Signature ​

get radius(): number

Defined in: math/Box.ts:35

获取包围盒半径(对角线长度的一半)

Returns ​

number


width ​

Get Signature ​

get width(): number

Defined in: math/Box.ts:15

获取包围盒宽度

Returns ​

number

Methods ​

applyMatrix4() ​

applyMatrix4(matrix): Box

Defined in: math/Box.ts:169

返回应用矩阵变换后的新包围盒

Parameters ​

matrix ​

Mat4

变换矩阵

Returns ​

Box

新的 Box 实例


clone() ​

clone(): Box

Defined in: math/Box.ts:105

克隆当前包围盒

Returns ​

Box

新的 Box 实例


copy() ​

copy(v): Box

Defined in: math/Box.ts:95

复制另一个包围盒的数据

Parameters ​

v ​

Box

源包围盒

Returns ​

Box

this


expandByPoint() ​

expandByPoint(point): Box

Defined in: math/Box.ts:293

扩展包围盒以包含一个点

Parameters ​

point ​

Vec3

Returns ​

Box

this


expandByVector() ​

expandByVector(vector): Box

Defined in: math/Box.ts:305

按向量扩展包围盒(最小点减,最大点加)

Parameters ​

vector ​

Vec3

Returns ​

Box

this


fromArray() ​

fromArray(arr): Box

Defined in: math/Box.ts:80

从数组设置包围盒

Parameters ​

arr ​

number[]

[minX, maxX, minY, maxY, minZ, maxZ] 形式的数组

Returns ​

Box

this


getCenter() ​

getCenter(target): Vec3

Defined in: math/Box.ts:327

获取包围盒的中心点

Parameters ​

target ​

Vec3

目标向量,用于存储结果

Returns ​

Vec3

中心点向量


getEdges() ​

getEdges(): Vec3[][]

Defined in: math/Box.ts:134

获取包围盒的12条边

Returns ​

Vec3[][]

Vec3 数组的数组,每个子数组包含两个点(起点、终点)


getIntersectionWithPlane() ​

getIntersectionWithPlane(plane): Vec3[]

Defined in: math/Box.ts:186

获取平面通过包围盒切割形成的多边形顶点

Parameters ​

plane ​

Plane

切割平面

Returns ​

Vec3[]

多边形顶点的排序数组(Vec3[]),如果不相交或顶点数少于2则返回空数组


getVertices() ​

getVertices(): Vec3[]

Defined in: math/Box.ts:115

获取包围盒的8个顶点

Returns ​

Vec3[]

Vec3 数组


intersectsPlane() ​

intersectsPlane(plane): boolean

Defined in: math/Box.ts:259

检查包围盒是否与平面相交

Parameters ​

plane ​

Plane

待检测的平面

Returns ​

boolean

true 如果相交


intersectsPoint() ​

intersectsPoint(point): boolean

Defined in: math/Box.ts:240

检查点是否在包围盒内

Parameters ​

point ​

Vec3

待检测的点

Returns ​

boolean

true 如果点在包围盒内


isEmpty() ​

isEmpty(): boolean

Defined in: math/Box.ts:316

检查包围盒是否为空(即 max < min)

Returns ​

boolean

true 如果为空


makeEmpty() ​

makeEmpty(): Box

Defined in: math/Box.ts:352

将包围盒置为空(min = Infinity, max = -Infinity)

Returns ​

Box

this


set() ​

set(min, max): Box

Defined in: math/Box.ts:60

设置包围盒的最小点和最大点

Parameters ​

min ​

Vec3

最小点

max ​

Vec3

最大点

Returns ​

Box

this


setFromBufferAttribute() ​

setFromBufferAttribute(attribute): Box

Defined in: math/Box.ts:338

从 BufferAttribute 设置包围盒

Parameters ​

attribute ​

BufferAttribute

BufferAttribute 对象

Returns ​

Box

this


toArray() ​

toArray(): number[]

Defined in: math/Box.ts:71

转换为数组 [minX, maxX, minY, maxY, minZ, maxZ]

Returns ​

number[]

数字数组


union() ​

union(box): Box

Defined in: math/Box.ts:157

合并另一个包围盒(取并集)

Parameters ​

box ​

Box

另一个包围盒

Returns ​

Box

this