KVector3d interface
KVector3d表示一个三维向量。 三维向量包含三个数。 注意:三维向量的三个分量不可变。
The KVector3d class represents a 3D vector. A 3D vector is an ordered triplet of numbers (labeled x, y, and z). NOTE: KVector3d's x, y and z are immutable.
Signature:
export interface KVector3d
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
| number | 获得向量的长度。 Get vector's length. | |
| number | 获得向量的x值。 Get vector's x value. | |
| number | 获得向量的y值。 Get vector's y value. | |
| number | 获得向量的z值。 Get vector's z value. |
Methods
Method | Description |
---|---|
两向量相加。 Return a new KVector3d which is this vector add the input vector. | |
计算两向量的夹角,以弧度计。 Calculate the angle between this vector and the other vector in radians. | |
以特定方向来计算两向量的夹角,以弧度计。 Calculate the angle to other vector, with vecRef as reference. | |
对当前向量应用一个由欧拉角定义的旋转变换,得到一个新向量。 Return a new Vector which is the result of this vector transformed by the input euler angles. | |
对当前向量应用一个矩阵来进行变换。 Return a new Vector which is the result of this vector transformed by the input matrix. | |
对当前向量应用一个由四元数定义的旋转变换,得到一个新向量。 Return a new Vector which is the result of this vector transformed by the input quaternion. | |
复制一个当前向量。 Return the cloned vector of this. | |
两向量的叉积。 Return the cross result of this vector and the input other vector. | |
两向量的点积。 Return the dot product of this vector and the input other vector. | |
在特定容差下,判断两个向量是否相等。 两个向量相等需要满足在距离容差下长度相等和余弦容差下方向相等。 Check whether two vectors are equal with specified tolerances. If the length of two vectors are equal in the distance tolerance and the direction are same in the cosine tolerance, it will return true. | |
isOnSameSide(other, distanceTolerance, cosTolerance, checkFuzzyZeroVec) | 检查两个向量在特定容差下是否为相同侧,相同侧意味着夹角小于九十度。 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 Check if the directions of two vectors are equal within specified tolerance. If checkFuzzyZeroVec is true, any vector's length is nearly zero within the tolerance, false will be returned directly. If checkFuzzyZeroVec if false, only when any vector's length is exact 0, false will be returned directly. |
isOpposite(other, distanceTolerance, cosTolerance, checkFuzzyZeroVec) | 检查两个向量的方向在特定容差下是否相反。 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 Check if this vector is opposite with other vector with specified tolerance. If checkFuzzyZeroVec is true, any vector's length is nearly zero within the tolerance, false will be returned directly. If checkFuzzyZeroVec if false, only when any vector's length is exact 0, false will be returned directly. |
在特定容差下判断两个向量是否平行。 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 Check if this vector is parallel with other vector with specified tolerance. If checkFuzzyZeroVec is true and any vector's length is nearly zero with the tolerance, false will be return directly. If checkFuzzyZeroVec if false, only when any vector's length is exact 0, false will be returned directly. | |
在特定容差下判断两个向量是否垂直。 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 Check if this vector is perpendicular with other vector with specified tolerance. If checkFuzzyZeroVec is true, any vector's length is nearly zero within the tolerance, false will be returned directly. If checkFuzzyZeroVec is false, only when any vector's length is exact 0, false will be returned directly. | |
isSameDirection(other, distanceTolerance, cosTolerance, checkFuzzyZeroVec) | 检查两个向量在特定容差下是否方向相同。 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 Check if the directions of two vectors are equal within specified tolerance. If checkFuzzyZeroVec is true, any vector's length is nearly zero within the tolerance, false will be returned directly. If checkFuzzyZeroVec if false, only when any vector's length is exact 0, false will be returned directly. |
检查当前向量是否为零向量。 注意:零向量是指向量的长度在容差范围内等于零。 Check whether a vector is zero vector. NOTE: A vector is zero vector if its length is 0 with specified tolerance. | |
返回一个新的向量,该新向量为当前向量的倍乘。 Return a new vector which is the scaler result of this vector. | |
返回当前向量的单位向量。 Return this vector's normalized vector. | |
返回一个新的向量,该新向量为当前向量的翻转。 Return a new vector which is the reverse of this vector. | |
两向量相减。 Return a new KVector3d which is this vector subtract the input vector. |