直角坐标转换为极坐标的Java包
我需要将直角坐标转换为极坐标。你能推荐一个我可以使用的库吗,我不想自己写这个。
这用于理解天文学图像文件中包含的元数据。
I need to convert rectangular coordinates to polar coordinates. Can you recommend a library that I can use, I would rather not have to write this myself.
This is used for making sense of metadata included in astronomy image files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我很确定标准库已经有这个了。如果存在虚数类型,它们正是这样做的(real = x,imag = y,arg(val)=角度,abs(val)=半径)。使用数学库(atan2、sin、cos 和 sqrt)也不是那么困难。
I am pretty sure the standard library already has this. If there are imaginary number types, they do precisely this (real = x, imag = y, arg(val) = angle, abs(val) = radius). Using the math library (atan2, sin, cos and sqrt) isn't that difficult either.
这不是就像两个函数吗?当然,您可以用任何语言搜索它并自行转换。
这是我做矩形的代码 ->在 C++ 中,极性(另一种方式非常简单)
注意结果是 x = 长度,y = 角度 1 z = 角度 2,以弧度为单位。
编辑:
我的代码是指我从某处窃取并使用过的一些代码。
isn't this just like 2 functions? surely you could just search for it in any language and convert it yourself.
here is my code to do rectangular -> polar (the other way is very easy) in c++
note the result is x = length, y = angle1 z = angle2, in radians.
EDIT:
by my code, I mean some code that I stole from somewhere and used like once.
您要求的是地图投影库。最流行的开源库之一是 PROJ.4 并且有一个 Java 实现 它。
您必须决定要使用哪种投影。它们具有不同的属性。 墨卡托 很常见,也是 Google 地图使用的一种。墨卡托的缺点是不能在北极周围使用它。
What you are asking for is a Map Projection Library. One of the most popular open source libraries are PROJ.4 and there is one Java Implementation of it.
You have to decide what projection you want to use. They have different properties. Mercator is common and is the one that Google Maps is using. The disadvantage with Mercator is that you can not use it around the arcitc poles.