在 python 中使用 asin、sin-1、sin-1、sin逆、三角函数



可能的重复项:
在 python 中使用 Sin-1 或反罪

这是我的代码:

# point of intersection between opposite and hypotenuse
x,y  =    pygame.mouse.get_pos()

# using formula for length of line
lenline1 = (x-x)**2 + (300-y)**2
lenline2 = (x-700)**2 + (y-300)**2
opposite = math.sqrt(lenline1)
adjacent = math.sqrt(lenline2)
# Converting length of lines to angle
PQ = opposite/adjacent
k = math.sin(PQ)
j = math.asin(k)
print(j)

我没有得到我预期的结果,虽然在搞砸了之后我接近了,但它不太正确。有人可以告诉我我做错了什么。我有两条线:相反的和相邻的,我希望使用罪恶的反转来获得角度。我做错了什么。我只是一个初学者,所以不要提供太详细的信息。我无法想象这很难做到。

谢谢。

我正在尝试获得斜边和相邻相遇的角度!

^在Python中意味着排他性或,而不是幂。如果要求幂,请使用 ** 运算符。

最新更新