KVector2d.isOpposite() method
检查两个向量的方向在特定容差下是否相反。 当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.
Signature:
isOpposite(other: KVector2d, distanceTolerance?: number, cosTolerance?: number, checkFuzzyZeroVec?: boolean): boolean;
Links: isOpposite(other: KVector2d, distanceTolerance?: number, cosTolerance?: number, checkFuzzyZeroVec?: boolean): boolean;
Parameters
Parameter | Type | Description |
---|---|---|
other | 被比较的另外一向量。 The vector to compare this vector with. | |
distanceTolerance | number | (Optional) 距离容差,默认值是1e-6。 It will provide distance tolerance when the length of vectors are measured.The default value is 1e-6. |
cosTolerance | number | (Optional) 余弦容差,默认值是1e-6。 It will provide cosine tolerance when the direction of vectors are measured.The default value is 1e-6. |
checkFuzzyZeroVec | boolean | (Optional) 默认checkFuzzyZeroVec是真。 The default value is true. |
Returns:
boolean
相反则返回true。
Return true if opposite, otherwise return false.