Three 球(Sphere)、球坐标(Spherical)

球(Sphere)

一个球由球心和半径所定义。

构造函数

Sphere( center : Vector3, radius : Float )

center - 球心的位置,默认值是一个位于(0, 0, 0)的Vector3。
radius - 球的半径,默认值是0。

创建一个新的Sphere。

属性

# .center : Vector3

A Vector3定义了球心的位置,默认值位于(0, 0, 0)。

# .radius : Float

球的半径,默认值为0。

方法

# .applyMatrix4 ( matrix : Matrix4 ) : Sphere

matrix - 将被应用的Matrix4矩阵。

使用所传入的Matrix4矩阵来对球进行变换。

# .clampPoint ( point : Vector3, target : Vector3 ) : Vector3

point - Vector3 将要夹取的点。
target — 结果将被复制到这个Vector3中。

从球中夹取一个点。若这一点位于球外,则将会夹取到该点球边缘最近的点。已位于球中的点将不会受到影响。

# .clone () : Sphere

返回一个新的球,新的球与这个球具有相同的center和radius。

# .containsPoint ( point : Vector3 ) : Boolean

point - the Vector3 to be checked

检查球体中是否包含所传入的point点,包括球的表面。

# .copy ( sphere : Sphere ) : Sphere

复制所传入的球的center和radius到这个球上。

# .distanceToPoint ( point : Vector3 ) : Float

返回球的边界到所传入的point点的最近距离。 若这个点,则距离将为负值。

# .empty () : Boolean

检查球是否为空(其半径设为了0).

# .equals ( sphere : Sphere ) : Boolean

检查这两个球的球心与半径是否相等。

# .getBoundingBox ( target : Box3 ) : Box3

target — 结果将被复制到这个Box3中。

返回这个球的Minimum Bounding Box(最小包围盒)。

# .intersectsBox ( box : Box3 ) : Boolean

box - 将被用于测试是否与这个球有交集的Box3。

检测这个球与所传入的box是否有交集。

# .intersectsPlane ( plane : Plane ) : Boolean

plane - 将被用于测试是否与这个球有交集的Plane。

检测这个球与所传入的plane是否有交集。

# .intersectsSphere ( sphere : Sphere ) : Boolean

sphere - 将被用于测试是否与这个球有交集的Sphere。

检测两球之间是否有交集。

# .set ( center : Vector3, radius : Float ) : Sphere

center - 球心位置。
radius - 球的半径。

设置球的center和radius属性。

# .setFromPoints ( points : Array, optionalCenter : Vector3 ) : Sphere

points - 一个包含有Vector3位置的Array。
optionalCenter - 可选, Vector3 球心位置。

计算一个points数组(中的点)的最小边界球。如果给定了optionalCenter,则它将被用作该球的球心; 否则,环绕points的包围盒的轴心将通过计算来得到。

# .translate ( offset : Vector3 ) : Sphere

使用所给定Vector3 offset(偏移量)平移球心。

球坐标(Spherical)

一个点的spherical coordinates(球坐标)。

构造函数

Spherical( radius : Float, phi : Float, theta : Float )

radius - 半径值,或者说从该点到原点的 Euclidean distance(欧几里得距离,即直线距离)。默认值为1.0
phi - polar angle from the y (up) axis. Default is 0.
theta - equator angle around the y (up) axis. Default is 0.

The poles (phi) are at the positive and negative y axis. The equator (theta) starts at positive z.

属性

# .radius : Float

# .phi : Float

# .theta : Float

方法

# .clone () : Spherical

返回一个新的球坐标,新的球坐标与该球坐标具有相同的 radius、phi和theta。

# .copy ( s : Spherical ) : Spherical

复制所传入的球坐标的radius、 phi 和theta属性到该球坐标中。

# .makeSafe () : Spherical

将极角 phi 的值限制在0.000001 和 pi - 0.000001 之间。

# .set ( radius : Float, phi : Float, theta : Float ) : Spherical

设置球坐标中radius、phi 和 theta 属性的值。

# .setFromVector3 ( vec3 : Vector3 ) : Spherical

从Vector3中设置球坐标的radius、phi和theta值。

# .setFromCartesianCoords ( x : Float, y : Float, z : Float ) : Spherical

从笛卡尔坐标系中设置球坐标的radius、phi和theta值。

猜你喜欢

转载自blog.csdn.net/n_229397218/article/details/140374196