MCPcopy Create free account
hub / github.com/cxapython/catvm / get_generate_tracks

Function get_generate_tracks

geetest/guiji.py:1126–1144  ·  view source on GitHub ↗

根据轨迹离散分布生成的数学 生成 # 参考文档 https://www.jianshu.com/p/3f968958af5a 成功率很高 90% 往上 :param distance: 缺口位置 :param seconds: 时间 :param ease_func: 生成函数 :return: 轨迹数组

(distance)

Source from the content-addressed store, hash-verified

1124
1125
1126def get_generate_tracks(distance):
1127 """
1128 根据轨迹离散分布生成的数学 生成 # 参考文档 https://www.jianshu.com/p/3f968958af5a
1129 成功率很高 90% 往上
1130 :param distance: 缺口位置
1131 :param seconds: 时间
1132 :param ease_func: 生成函数
1133 :return: 轨迹数组
1134 """
1135 distance += 20
1136 tracks = [0]
1137 offsets = [0]
1138 seconds = random.randint(2,4)
1139 for t in np.arange(0.0, seconds, 0.1):
1140 offset = round((1 - pow(1 - (t / seconds), 4)) * distance)
1141 tracks.append(offset - offsets[-1])
1142 offsets.append(offset)
1143 tracks.extend([-3, -2, -3, -2, -2, -2, -2, -1, -0, -1, -1, -1])
1144 return tracks

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected