new Sphere(normal, constant)
根据球心和半径定义一个球
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
normal | 
            
            ht.Math.Vector3 | 
                
                    <optional> | 
            
            
            |
constant | 
            
            number | 
                
                    <optional> | 
            
            
            
Members
- 
center :ht.Math.Vector3
 - 
    
    
球心的位置
 - 
radius :Array.<number>
 - 
    
    
球的半径
 
Methods
- 
    
        
applyMatrix4(Matrix4) → {ht.Math.Sphere}
 - 
    
    
使用所传入的矩阵 Matrix4 来对球进行变换
Parameters:
Name Type Description Matrix4ht.Math.Matrix4 Returns:
ht.Math.Sphere - 
    
        
clampPoint(point, target) → {ht.Math.Vector3}
 - 
    
    
若 point 在球外,则获取该点与球边缘最近的点,若 point 位于球中则获取 point
Parameters:
Name Type Attributes Description pointht.Math.Vector3 要检测的点
targetht.Math.Vector3 <optional> 
结果将复制到这个向量中
Returns:
ht.Math.Vector3 - 
    
        
clone() → {ht.Math.Sphere}
 - 
    
    
返回一个与当前球具有相同的 center 和 radius 的球
Returns:
ht.Math.Sphere - 
    
        
containsPoint(point) → {boolean}
 - 
    
    
判断球体中是否包含 point,包括球的表面
Parameters:
Name Type Description pointht.Math.Vector3 要检测的点
Returns:
boolean - 
    
        
copy(Sphere) → {ht.Math.Sphere}
 - 
    
    
将传入的球中的 center 和 radius 拷贝到当前球
Parameters:
Name Type Description Sphereht.Math.Sphere Returns:
ht.Math.Sphere - 
    
        
distanceToPoint(point) → {number}
 - 
    
    
返回球的边界到所传入的 point 的最近距离,若这个点在球内,则距离将为负值
Parameters:
Name Type Description pointht.Math.Vector3 Returns:
number - 
    
        
empty() → {boolean}
 - 
    
    
判断球是否为空
Returns:
boolean - 
    
        
equals(Sphere) → {boolean}
 - 
    
    
判断两个球是否相等
Parameters:
Name Type Description Sphereht.Math.Sphere Returns:
boolean - 
    
        
getBoundingBox(Box3) → {ht.Math.Box3}
 - 
    
    
获取这个球的最小包围盒
Parameters:
Name Type Description Box3ht.Math.Box3 结果将复制到这个 Box3 中
Returns:
ht.Math.Box3 - 
    
        
intersectsBox(Box3) → {boolean}
 - 
    
    
判断当前球与所传入的 Box3 是否有交集
Parameters:
Name Type Description Box3ht.Math.Box3 Returns:
boolean - 
    
        
intersectsPlane(Plane) → {boolean}
 - 
    
    
判断当前球与所传入的 Plane 是否有交集
Parameters:
Name Type Description Planeht.Math.Plane Returns:
boolean - 
    
        
intersectsSphere(Sphere) → {boolean}
 - 
    
    
判断当前球与所传入的 Sphere 是否有交集
Parameters:
Name Type Description Sphereht.Math.Sphere Returns:
boolean - 
    
        
set(center, radius) → {ht.Math.Sphere}
 - 
    
    
设置当前球的 center 和 radius 属性
Parameters:
Name Type Description centerht.Math.Vector3 radiusht.Math.Vector3 Returns:
ht.Math.Sphere - 
    
        
setFromPoints(points, center) → {ht.Math.Sphere}
 - 
    
    
计算一个 points 数组中的点的最小边界球。如果给定了 center,则 center 将被用作该球的球心
Parameters:
Name Type Attributes Description pointsArray.<Object> centerht.Math.Vector3 <optional> 
Returns:
ht.Math.Sphere - 
    
        
translate(offset) → {ht.Math.Sphere}
 - 
    
    
使用传入的 offset 平移球心
Parameters:
Name Type Description offsetht.Math.Vector3 Returns:
ht.Math.Sphere