Class: BlockBoundingBoxUtils experimental
blockBeta
边界框工具类,提供许多用于创建和使用 BlockBoundingBox 对象的有用函数。
Bounding Box Utils is a utility class that provides a number of useful functions for the creation and utility of BlockBoundingBox objects
Methods
createValid()
staticcreateValid(min,max):BlockBoundingBox
World Mutation Beta
Parameters
min
一个角点的世界坐标位置。
A corner world location
max
对角线相对的另一个角点的世界坐标位置。
A corner world location diametrically opposite
Returns
Remarks
创建一个经过验证的 BlockBoundingBox 实例,其中 min 和 max 分量保证满足 (min <= max)。
Create a validated instance of a BlockBoundingBox where the min and max components are guaranteed to be (min <= max)
dilate()
staticdilate(box,size):BlockBoundingBox
World Mutation Beta
Parameters
box
size
Returns
返回一个新的 BlockBoundingBox 对象,表示更改后的结果。
Return a new BlockBoundingBox object representing the changes
Remarks
沿各轴按给定大小扩展一个 BlockBoundingBox。 大小可以为负数以实现收缩。 注意:如果收缩大小大于跨度,角点可能被反转,但 min/max 关系将保持正确。
Expand a BlockBoundingBox by a given amount along each axis. Sizes can be negative to perform contraction. Note: corners can be inverted if the contraction size is greater than the span, but the min/max relationship will remain correct
equals()
staticequals(box,other):boolean
World Mutation Beta
Parameters
box
other
Returns
boolean
Remarks
检查两个 BlockBoundingBox 对象是否完全相同。
Check if two BlockBoundingBox objects are identical
expand()
staticexpand(box,other):BlockBoundingBox
World Mutation Beta
Parameters
box
other
Returns
一个新的 BlockBoundingBox 实例,表示能够同时包含两者的最小可能边界框。
A new BlockBoundingBox instance representing the smallest possible bounding box which can encompass both
Remarks
扩展初始 box 对象的边界以包含第二个 box 参数。 生成的 BlockBoundingBox 对象将是一个恰好包含这两个盒子的 BlockBoundingBox。
Expand the initial box object bounds to include the 2nd box argument. The resultant BlockBoundingBox object will be a BlockBoundingBox which exactly encompasses the two boxes.
getCenter()
staticgetCenter(box):Vector3
World Mutation Beta
Parameters
box
Returns
注意 BlockBoundingBox 对象表示完整的方块,因此具有奇数边界的盒子的中心在数学上并不居中。 例如,BlockBoundingBox(0,0,0 -> 3,3,3) 的中心为 (1,1,1)(而不是预期的 (1.5,1.5,1.5))。
Note that BlockBoundingBox objects represent whole blocks, so the center of boxes which have odd numbered bounds are not mathematically centered... i.e. a BlockBoundingBox( 0,0,0 -> 3,3,3 ) would have a center of (1,1,1) (not (1.5, 1.5, 1.5) as expected)
Remarks
计算给定 BlockBoundingBox 对象的中心方块。
Calculate the center block of a given BlockBoundingBox object.
getIntersection()
staticgetIntersection(box,other):BlockBoundingBox|undefined
World Mutation Beta
Parameters
box
other
Returns
BlockBoundingBox | undefined
Remarks
计算表示两个相交 BlockBoundingBox 的并集区域的 BlockBoundingBox。
Calculate the BlockBoundingBox which represents the union area of two intersecting BlockBoundingBoxes
getSpan()
staticgetSpan(box):Vector3
World Mutation Beta
Parameters
box
Returns
Remarks
获取 BlockBoundingBox 各轴分量的跨度。
Get the Span of each of the BlockBoundingBox Axis components
intersects()
staticintersects(box,other):boolean
World Mutation Beta
Parameters
box
other
Returns
boolean
Remarks
检查两个 BlockBoundingBox 对象是否相交。
Check to see if two BlockBoundingBox objects intersect
isInside()
staticisInside(box,pos):boolean
World Mutation Beta
Parameters
box
pos
Returns
boolean
Remarks
检查给定的坐标是否在 BlockBoundingBox 内部。
Check to see if a given coordinate is inside a BlockBoundingBox
isValid()
staticisValid(box):boolean
World Mutation Beta
Parameters
box
Returns
boolean
Remarks
检查 BlockBoundingBox 是否有效(即 min <= max)。
Check to see if a BlockBoundingBox is valid (i.e. (min <= max))
translate()
statictranslate(box,delta):BlockBoundingBox
World Mutation Beta
Parameters
box
delta
Returns
返回一个新的 BlockBoundingBox 对象,表示移动后的结果。
Return a new BlockBoundingBox object which represents the change
Remarks
按给定量移动 BlockBoundingBox。
Move a BlockBoundingBox by a given amount
