目录

Plane

Class Info

class Plane

平面类。包含平面类对象的赋值、比较操作,及设置平面法向量、原点到平面距离等。

Public Field Summary

Qualifier and Type

Field and Description

Value

Vector3

m_normal

平面的法向量。

Vector3::ZERO

f32

m_distance

原点到平面的距离。

0.0f

Public Constructor Summary

Constructor Name

Plane()

构造函数。

Public Destructor Summary

Destructor Name

~Plane()

析构函数。

Public Method Summary

Qualifier and Type

Method Name and Description

Plane&

operator=(const Plane& other)

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

bool

operator==(const Plane& plane) const

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

bool

operator!=(const Plane& plane) const

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

void

Set(const Vector3& normal, f32 distance)

设置平面的法向量和原点到平面的距离。

void

Set(const Vector3& normal, const Vector3& point)

设置平面的法线,并根据指定点的坐标,计算出原点到平面的距离。

void

Set(const Vector3& point1, const Vector3& point2, const Vector3& point3)

三点确定一个平面,根据3个点计算出平面的法向量及原点到平面的距离。

String

ToString() const

Plane类型转字符串类型,形如“Plane(Normal: (a, b, c);Distance: 原点到平面距离)”。

Public Constructors

[h2]Plane

Constructor

Plane()

构造函数。

Public Destructors

[h2]~Plane

Destructor

~Plane()

析构函数。

Public Methods

[h2]operator=

Method

Plane& operator=(const Plane& other)

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

Parameters

Name

Description

other

给当前对象赋值的Plane类对象。

Returns

Type

Description

Plane&

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

[h2]operator==

Method

bool operator==(const Plane& plane) const

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

Parameters

Name

Description

plane

与当前对象进行比较的Plane类对象。

Returns

Type

Description

bool

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

[h2]operator!=

Method

bool operator!=(const Plane& plane) const

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

Parameters

Name

Description

plane

与当前对象进行比较的Plane类对象。

Returns

Type

Description

bool

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

[h2]Set(const Vector3& normal, f32 distance)

Method

void Set(const Vector3& normal, f32 distance)

设置平面的法向量和原点到平面的距离。

Parameters

Name

Description

normal

待设置的法向量。

distance

原点到平面的距离。

[h2]Set(const Vector3& normal, const Vector3& point)

Method

void Set(const Vector3& normal, const Vector3& point)

设置平面的法线,并根据指定点的坐标,计算出原点到平面的距离。

Parameters

Name

Description

normal

待设置的法向量。

point

平面上某一点的坐标。

[h2]Set(const Vector3& point1, const Vector3& point2, const Vector3& point3)

Method

void Set(const Vector3& point1, const Vector3& point2, const Vector3& point3)

三点确定一个平面,根据三个点的坐标计算出平面的法向量及原点到平面的距离。

Parameters

Name

Description

point1

第一个点。

point2

第二个点。

point3

第三个点。

[h2]ToString

Method

String ToString() const

Plane类型转字符串类型,形如“Plane(Normal: (a, b, c);Distance: 原点到平面距离)”。

Returns

Type

Description

String

返回Plane类型转换成的字符串,返回值形如“Plane(Normal: (a, b, c);Distance: 原点到平面距离)”。