将点从半圆映射到矩形 [英] map points from semicircle to rectangle

查看:179
本文介绍了将点从半圆映射到矩形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以建议我如何将半圆形映射为矩形.换句话说,我想要360度图像的一部分(一半)并将点转换为矩形图像.

非常感谢对此的任何帮助或建议.是否有算法,示例代码甚至数学公式?

谢谢

Can someone pls advice me how can i map a semi-circle into a rectangle. In other words i want to a part of a 360 degree image (half of it) and convert the points to rectangle image.

really appreciate any help or suggestions on this. is there any algortigm, sample codes or even math formula?

thank you

推荐答案

有关
{x,y}->{sqrt(x*x+y*y), atan2(y,x)}


?
:)


?
:)


圆的最大可能上半部
放在边界矩形的底部:):
The max possible up-half of the circle
placed on the bottom of the bounding rectangle :) :
void GetCenterAndRadius(const CRect& cRect, // in-parameter
                        CPoint& cpCenter,   // out-parameter
                        int& iRadius)       // out-parameter
{
  cRect.NormalizeRect();
  iRadius = min(cRect.Width() / 2, cRect.Height());
  cpCenter.y = cRect.bottom;
  cpCenter.x = (cRect.right - cRect.left) / 2;
}


这篇关于将点从半圆映射到矩形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆