跳转至

AABB

简要描述

轴对齐包围盒。

描述

AABB包含了位置,大小和几个实用方法。它主要用来快速检测重叠。

成员

类型 属性名 默认值
Vector3 end Vector3( 0, 0, 0 )
Vector3 position Vector3( 0, 0, 0 )
Vector3 size Vector3( 0, 0, 0 )

方法

返回值类型 方法名称
AABB AABB(#method-AABB)(position: Vector3, size: Vector3)
bool encloses(with: AABB)
AABB expand(to_point: Vector3)
float get_area()
Vector3 get_endpoint(idx: int)
Vector3 get_longest_axis()
int get_longest_axis_index()
float get_longest_axis_size()
Vector3 get_shortest_axis()
int get_shortest_axis_index()
float get_shortest_axis_size()
Vector3 get_support(dir: Vector3)
AABB grow(by: float)
bool has_no_area()
bool has_no_surface()
bool has_point(point: Vector3)
AABB intersection(with: AABB)
bool intersects(with: AABB)
bool intersects_plane(plane: Plane)
bool intersects_segment(from: Vector3, to: Vector3)
bool is_equal_approx(aabb: AABB)
AABB merge(with: AABB)

常量

成员说明

  • Vector3 end
Default Vector3( 0, 0, 0 )
getter ****
  • Vector3 position
Default Vector3( 0, 0, 0 )
getter ****
  • Vector3 size
Default Vector3( 0, 0, 0 )
getter ****

方法说明

  • AABB AABB(position: Vector3, size: Vector3)

可选构造函数,接受位置和大小。


  • encloses encloses(with: AABB)

如果此AABB完全包含了另一个,则返回true


  • expand expand(to_point: Vector3)

返回为了包含给定点的当前AABB的扩大化实例。


  • get_area get_area()

返回该AABB实例的体积。


  • get_endpoint get_endpoint(idx: int)

获取空间中AABB的8个端点的位置。


  • get_longest_axis get_longest_axis()

返回AABB的标准化最长轴。


  • get_longest_axis_index get_longest_axis_index()

返回AABB最长轴的索引(根据Vector3AXIS_*常量)。


  • get_longest_axis_size get_longest_axis_size()

返回AABB最长轴的标量长度。


  • get_shortest_axis get_shortest_axis()

返回AABB的归一化最短轴。


  • get_shortest_axis_index get_shortest_axis_index()

返回AABB的最短轴的索引(根据Vector3::AXIS*枚举)。


  • get_shortest_axis_size get_shortest_axis_size()

返回AABB的最短轴的标量长度。


  • get_support get_support(dir: Vector3)

返回给定方向的支撑点。该方法对于碰撞检测算法很有用。


  • grow grow(by: float)

返回向所有方向增长一定数量单位的AABB的副本。


  • has_no_area has_no_area()

如果AABB是平面的或为空,则返回true


  • has_no_surface has_no_surface()

如果AABB为空,则返回true


  • has_point has_point(point: Vector3)

如果AABB包含一个点,则返回true


  • intersection intersection(with: AABB)

返回两个AABB之间的交集。空的AABB(大小 0,0,0)返回失败。


  • intersects intersects(with: AABB)

如果AABB与另一个重叠,则返回true


  • intersects_plane intersects_plane(plane: Plane)

如果AABB与平面相交,则返回true


  • intersects_segment intersects_segment(from: Vector3, to: Vector3)

如果AABBfromto之间的线段相交,则传回true


  • is_equal_approx is_equal_approx(aabb: AABB)

如果此AABBaabb大致相等则返回true,通过在每个方向上调用[@IVRScript.is_equal_approx]检查。


  • merge merge(with: AABB)

返回包含此AABBwith中的较大AABB