简体   繁体   English

在arctan中找到0-360的角度

[英]finding angles 0-360 in arctan

I need help with a math issue:我需要数学问题的帮助:

I need to get the angle from 0 until 360 degrees but this code gives the angle between -90 until 90 degrees:我需要获得从 0 到 360 度的角度,但是这段代码给出了 -90 到 90 度之间的角度:

N = math.cos(β * (math.pi / 180)) * math.tan((f + ω) * (math.pi / 180))
N2 = math.atan(N) * (180 / math.pi)

I want to N2 change between 0 to 360 degrees.我想让 N2 在 0 到 360 度之间变化。

Use atan2 like so像这样使用atan2

import math
math.atan2(-0.1, 0.1) + math.pi

The problem is atan does not know which quadrant you are in, while atan2 does as it accepts an x and y coordinate as input.问题是atan不知道你在哪个象限,而atan2知道你在哪个象限,因为它接受 x 和 y 坐标作为输入。

If you compute atan(y / x) you need to switch things around so you compute atan2(y, x) instead.如果您计算atan(y / x) ,则需要进行转换,以便改为计算atan2(y, x) I can't understand how that relates to your example exactly.我不明白这与您的示例有什么关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM