KVector2d.isOnSameSide() method
检查两个向量在特定容差下是否为相同侧,相同侧意味着夹角小于九十度。 当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.
Signature:
isOnSameSide(other: KVector2d, distanceTolerance?: number, cosTolerance?: number, checkFuzzyZeroVec?: boolean): boolean;
Links: isOnSameSide(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 same, otherwise return false.