gpt4 book ai didi

math - 如何将圆上的坐标转换为方形上的坐标?

转载 作者:行者123 更新时间:2023-12-04 10:19:38 26 4
gpt4 key购买 nike

我目前正在使用LBP2开发一款游戏,该游戏已经修改了 Controller 提供输入的方式。这个问题:
How can I convert coordinates on a square to coordinates on a circle?
我所做的事情对我有很大帮助,但是我确实有一个问题。我需要它们给出的逆函数。它们从正方形->圆形开始,我尝试在各处搜索如何将圆形映射到正方形。

上一个问题中给出的功能是:

xCircle = xSquare * sqrt(1 - 0.5*ySquare^2)

yCircle = ySquare * sqrt(1 - 0.5*xSquare^2)

From Mapping a Square to a Circle



给我的问题是xCircle和yCircle ...如何找到xSquare和ySquare?

我已经尝试了所有我知道的代数,填写了两页笔记,试图让Wolfram alpha获得逆函数,但是这个问题超出了我的能力范围。

感谢您的关注。

最佳答案

x = ½ √( 2 + u² - v² + 2u√2 ) - ½ √( 2 + u² - v² - 2u√2 )
y = ½ √( 2 - u² + v² + 2v√2 ) - ½ √( 2 - u² + v² - 2v√2 )



关于符号的注释:我使用x = xSquare,y = ySquare,u = xCircle和v = yCircle;

(u,v)是圆盘坐标,而 (x,y)是方形坐标。

grid mapping

对于等式的C++实现,请转到
http://squircular.blogspot.com/2015/09/mapping-circle-to-square.html

参见 http://squircular.blogspot.com
有关更多示例图像。
另外,请参见 http://arxiv.org/abs/1509.06344的证明/推导

此映射是

u = x √( 1 - ½ y² )
v = y √( 1 - ½ x² )



P.S.映射不是唯一的。还有其他映射。下图说明了映射的非唯一性。

Boston Celtics squared

关于math - 如何将圆上的坐标转换为方形上的坐标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13211595/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com