球([name])

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

构造函数

[name]( [param:Vector3 center], [param:Float radius] )

[page:Vector3 center] - 球心的位置,默认值是一个位于(0, 0, 0)的[page:Vector3]。
[page:Float radius] - 球的半径,默认值是-1。

创建一个新的[name]。

属性

[property:Vector3 center]

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

[property:Float radius]

球的半径,默认值为0。

方法

[method:Sphere applyMatrix4]( [param:Matrix4 matrix] )

[page:Matrix4 matrix] - 将被应用的[Page:Matrix4]矩阵。

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

[method:Vector3 clampPoint]( [param:Vector3 point], [param:Vector3 target] )

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

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

[method:Sphere clone]()

返回一个新的球,新的球与这个球具有相同的[page:.center center]和[page:.radius radius]。

[method:Boolean containsPoint]( [param:Vector3 point] )

[page:Vector3 point] - the [page:Vector3] to be checked

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

[method:Sphere copy]( [param:Sphere sphere] )

复制所传入的球的[page:.center center]和[page:.radius radius]到这个球上。

[method:Float distanceToPoint]( [param:Vector3 point] )

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

[method:this expandByPoint]( [param:Vector3 point] )

[page:Vector3 point] - [page:Vector3] that should be included in the sphere.

Expands the boundaries of this sphere to include [page:Vector3 point].

[method:Boolean isEmpty]()

检查球是否为空(the radius set to a negative number). Spheres with a radius of 0 contain only their center point and are not considered to be empty.

[method:Sphere makeEmpty]()

Makes the sphere empty by setting [page:.center center] to (0, 0, 0) and [page:.radius radius] to -1.

[method:Boolean equals]( [param:Sphere sphere] )

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

[method:Box3 getBoundingBox]( [param:Box3 target] )

[page:Box3 target] — 结果将被复制到这个Box3中。

返回这个球的[link:https://en.wikipedia.org/wiki/Minimum_bounding_box Minimum Bounding Box](最小包围盒)。

[method:Boolean intersectsBox]( [param:Box3 box] )

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

检测这个球与所传入的[page:Box3 box]是否有交集。

[method:Boolean intersectsPlane]( [param:Plane plane] )

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

检测这个球与所传入的[page:Plane plane]是否有交集。

[method:Boolean intersectsSphere]( [param:Sphere sphere] )

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

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

[method:Sphere set]( [param:Vector3 center], [param:Float radius] )

[page:Vector3 center] - 球心位置。
[page:Float radius] - 球的半径。

设置球的[page:.center center]和[page:.radius radius]属性。
Please note that this method only copies the values from the given center.

[method:Sphere setFromPoints]( [param:Array points], [param:Vector3 optionalCenter] )

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

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

[method:Sphere translate]( [param:Vector3 offset] )

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

[method:this union]( [param:Sphere sphere] )

[page:Sphere sphere] - Bounding sphere that will be unioned with this sphere.

Expands this sphere to enclose both the original sphere and the given sphere.

源代码

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]