Python conversion between coordinates

前端 未结 7 1722
我寻月下人不归
我寻月下人不归 2020-12-01 05:03

Are there functions for conversion between different coordinate systems?

For example, Matlab has [rho,phi] = cart2pol(x,y) for conversion from cartesian

7条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-01 05:37

    There is a better way to write polar(), here it is:

    def polar(x,y):
      `returns r, theta(degrees)`
      return math.hypot(x,y),math.degrees(math.atan2(y,x))
    

提交回复
热议问题