How to make sure cartesian to polar coordinates are in the correct quadrant using math.atan() (without using atan2)

后端 未结 0 401
无人及你
无人及你 2020-12-30 03:10

So far I have

def cartesiantopolar(x,y):
    a=math.atan(y/x)
    if x<=0 and y<=0:
        a=a-math.pi
    return math.sqrt(x**2+y**2),a
相关标签:
回答
  • 消灭零回复
提交回复
热议问题