文档管理中心

AABB

展开

Class Info

class AABB

描述网格包围盒的类,包围盒为一个立方体。包括包围盒对象间的赋值、比较,获取包围盒最小、最大坐标、中心点坐标、角坐标等。

Public Constructor Summary

展开

Constructor Name

AABB()

构造函数,初始化包围盒坐标最小值、坐标最大值、指向八个角坐标的指针。

AABB(const AABB& other)

拷贝构造函数。

Public Destructor Summary

展开

Destructor Name

~AABB()

析构函数,释放内存。

Public Method Summary

展开

Qualifier and Type

Method Name and Description

AABB&

operator=(const AABB& other)

重载赋值运算符,使用AABB类对象给当前对象赋值。

bool

operator==(const AABB& other) const

重载==运算符,比较当前对象与指定AABB类对象是否相等,相等返回true,不相等返回false。

bool

operator!=(const AABB& other) const

重载!=运算符,比较当前对象与指定AABB类对象是否不相等,不相等返回true,相等返回false。

Vector3

GetMinDistanceVertex(const Vector3& normal) const

获取AABB包围盒最远离指定方向上的顶点。

Vector3

GetMaxDistanceVertex(const Vector3& normal) const

获取AABB包围盒最靠近指定方向上的顶点。

const Vector3&

GetMinimum() const

获取包围盒的坐标最小值。

const Vector3&

GetMaximum() const

获取包围盒的坐标最大值。

void

SetMinimum(const Vector3& vec)

设置包围盒的坐标最小值。

void

SetMaximum(const Vector3& vec)

设置包围盒的坐标最大值。

const Vector3*

GetCorners() const

获取包围盒八个角的坐标。

Vector3

GetCenter() const

获取包围盒中心点的坐标。

Vector3

GetSize() const

获取包围盒三个维度上的大小。

Vector3

GetHalfSize() const

获取包围盒三个维度上一半的大小。

void

AddInternalPoint(const Vector3& p)

增加包围盒中的点,并根据该点的坐标更新包围盒的坐标最小值和最大值。

void

AddInternalBox(const AABB& b)

增加一个包围盒,根据该包围盒的坐标最小值、最大值,更新当前包围盒的坐标最小值、最大值。

String

ToString() const

包围盒类型转字符串类型,形如“(包围盒最小值,包围盒最大值)”。

bool

Contains(const AABB& other) const

是否包含在包围盒中。

Public Constructors

AABB

展开

Constructor

AABB()

构造函数,初始化包围盒坐标最小值、坐标最大值、指向八个角坐标的指针。

AABB(const AABB& other)

展开

Constructor

AABB(const AABB& other)

拷贝构造函数。

Parameters

展开

Name

Description

other

已存的AABB类对象引用。

Public Destructors

~AABB

展开

Destructor

~AABB()

析构函数,释放内存。

Public Methods

operator=

展开

Method

AABB& operator=(const AABB& other)

重载赋值运算符,使用AABB类对象给当前对象赋值。

Parameters

展开

Name

Description

other

用于赋值的AABB类对象。

Returns

展开

Type

Description

AABB&

返回赋值后对当前对象的引用。

operator==

展开

Method

bool operator==(const AABB& other) const

重载==运算符,比较当前对象与指定AABB类对象是否相等,相等返回true,不相等返回false。

Parameters

展开

Name

Description

other

与当前对象进行比较的AABB类对象的引用。

Returns

展开

Type

Description

bool

  • true:相等。
  • false:不相等。

operator!=

展开

Method

bool operator!=(const AABB& other) const

重载!=运算符,比较当前对象与指定AABB类对象是否不相等,不相等返回true,相等返回false。

Parameters

展开

Name

Description

other

与当前对象进行比较的AABB类对象的引用。

Returns

展开

Type

Description

bool

  • true:不相等。
  • false:相等。

GetMinDistanceVertex

展开

Method

Vector3 GetMinDistanceVertex(const Vector3& normal) const

获取AABB包围盒最远离指定方向上的顶点。

Parameters

展开

Name

Description

normal

三维的方向向量。

Returns

展开

Type

Description

Vector3

获取AABB包围盒最远离指定方向上的顶点。

GetMaxDistanceVertex

展开

Method

Vector3 GetMaxDistanceVertex(const Vector3& normal) const

获取AABB包围盒最靠近指定方向上的顶点。

Parameters

展开

Name

Description

normal

三维的方向向量。

Returns

展开

Type

Description

Vector3

获取AABB包围盒最靠近指定方向上的顶点。

GetMinimum

展开

Method

const Vector3& GetMinimum() const

获取包围盒的坐标最小值。

Returns

展开

Type

Description

const Vector3&

返回包围盒的坐标最小值。

GetMaximum

展开

Method

const Vector3& GetMaximum() const

获取包围盒的坐标最大值。

Returns

展开

Type

Description

const Vector3&

返回包围盒的坐标最大值。

SetMinimum

展开

Method

void SetMinimum(const Vector3& vec)

设置包围盒的坐标最小值。

Parameters

展开

Name

Description

vec

三维向量表示的XYZ坐标。

SetMaximum

展开

Method

void SetMaximum(const Vector3& vec)

设置包围盒的坐标最大值。

Parameters

展开

Name

Description

vec

三维向量表示的XYZ坐标。

GetCorners

展开

Method

const Vector3* GetCorners() const

获取包围盒八个角坐标。

Returns

展开

Type

Description

const Vector3*

返回指向包围盒八个角坐标的指针。

GetCenter

展开

Method

Vector3 GetCenter() const

获取包围盒中心点的坐标。

Returns

展开

Type

Description

Vector3

返回包围盒中心点的坐标。

GetSize

展开

Method

Vector3 GetSize() const

获取包围盒三个维度上的大小。

Returns

展开

Type

Description

Vector3

返回包围盒三个维度上的大小,返回值形如“(宽度,高度,深度)”。

GetHalfSize

展开

Method

Vector3 GetHalfSize() const

获取包围盒三个维度上一半的大小。

Returns

展开

Type

Description

Vector3

返回包围盒三个维度上一半的大小,返回值形如“(宽度,高度,深度)”。

AddInternalPoint

展开

Method

void AddInternalPoint(const Vector3& p)

增加包围盒中的点,并根据该点的坐标更新包围盒的坐标最小值和最大值。

Parameters

展开

Name

Description

p

待添加点的三维坐标。

AddInternalBox

展开

Method

void AddInternalBox(const AABB& b)

增加一个包围盒,根据该包围盒的坐标最小值、最大值,更新当前包围盒的坐标最小值、最大值。

Parameters

展开

Name

Description

b

待添加的包围盒。

ToString

展开

Method

String ToString() const

包围盒类型转字符串类型,形如“(包围盒最小值,包围盒最大值)”。

Returns

展开

Type

Description

String

返回AABB类型转换成的字符串,返回值形如“(包围盒最小值,包围盒最大值)”。

Contains

展开

Method

bool Contains(const AABB& other) const

是否包含在包围盒中。

Parameters

展开

Name

Description

other

待判断的物体。

Returns

展开

Type

Description

bool

  • true:在包围盒中。
  • false:不在包围盒中。
在 API参考 中进行搜索
请输入您想要搜索的关键词