计算机图形学几何变换公式

绝世美人儿
712次浏览
2020年12月06日 06:48
最佳经验
本文由作者推荐

金沟情仇记-汴京八景

2020年12月6日发(作者:满涛)




实验步骤
算法分析:

图形变换是指对图形 的几何信息经过几何变换后产生新的图形。
图形变换既可以看作坐标系不动而图形变动,变动后的图形在 坐标系
中的坐标值发生变化;也可以看作图形不动而坐标系变动,变动后,
该图形在新的坐标系 下具有新的坐标值。
设(x,y)为图形原坐标值,经几何变换后坐标值变为(
x
*
,y
*
)。
以下为四种常用的几何变换公式。
(a) 平移变换:
平移变换在前面的任务中已经用到过,它的变换公式为:

1
< br>**

x,y,1x,y,1


0

T
x

0
1
T
y
0

0




xT
x
,yTy
,1



1


(b) 旋转变换:
绕原点旋转的变换公式为:

cos

< br>sin

**

x,y,1x,y,1

 



0
sin

cos

0
0

0




xcos
< br>ysin

,xsin

ycos

,1

1



(c) 放缩变换:

S< br>x

0
**

x,y,1x,y,1





0
0
S
y
0
0

0




S
x
x ,S
y
y,1


1


几种变换可以 组合在一起形成复合变换。例如平移变换与旋
转变换组合得到:
(d) 相对点
(x
0
,y
0
)
的旋转变换:
cos


**

x,y,1x,y,1sin
< br>




(1cos

)x0
y
0
sin

sin

cos

(1cos

)y
0
x
0
sin

0

0


1





ii、算法程序:
void CZhouView::pingyi()
{
CClientDC dc(this);
(m_nPoint1.x,m_nPoint1.y);
(m_nPoint2.x,m_nPoint2.y);
(m_nPoint1.x+100,m_nPoint1.y+100);
(m_nPoint2.x+100,m_nPoint2.y+100);
}


void CZhouView::xuanzhuan()
{
CClientDC dc(this);
(m_nPoint1.x,m_nPoint1.y);
(m_nPoint2.x,m_nPoint2.y);
((m_nPoint1.x*cos( 0.5))-(m_nPoint1.y*sin(0.5)),(m_nPoint
1.x*sin( 0.5))+(m_nPoint1.y*cos(0.5)));
((m_nPoint2.x* cos(0.5))-(m_nPoint2.y*sin(0.5)),(m_nPoint2
.x* sin(0.5))+(m_nPoint2.y*cos(0.5)));
}

void CZhouView::bili()
{
CClientDC dc(this);
(m_nPoint1.x,m_nPoint1.y);
(m_nPoint2.x,m_nPoint2.y);
(m_nPoint1.x*2,m_nPoint1.y*2);
(m_nPoint2.x*2,m_nPoint2.y*2);
}

void CZhouView::XCQ()
{
CClientDC dc(this);
(m_nPoint1.x,m_nPoint1.y);
(m_nPoint2.x,m_nPoint2.y);
(m_nPoint1.x,m_nPoint1.y);
(m_nPoint2.x+100,m_nPoint2.y);
}

void CZhouView::DC()
{
CClientDC dc(this);
(m_nPoint1.x,m_nPoint1.y);
(m_nPoint2.x,m_nPoint2.y);
(m_nPoint1.y,m_nPoint1.x);
(m_nPoint2.y,m_nPoint2.x);
}



(m_nPoint1.y,m_nPoint1.x);
(m_nPoint2.y,m_nPoint2.x);
}

void CZhouView::YCQ()
{
CClientDC dc(this);
(m_nPoint1.x,m_nPoint1.y);
(m_nPoint2.x,m_nPoint2.y);
(m_nPoint1.x,m_nPoint1.y);
(m_nPoint2.x,m_nPoint2.y+100);
}
OnLButtonUp(UINT nFlags, CPoint point)
case 8:
pingyi();
break;
case 9:
xuanzhuan();
break;
case 10:
bili();
break;
case 11:
XCQ();
break;
case 12:
YCQ();
break;
case 13:
DC();
break;



编译,运行:
平移:






















金融报告-甜蜜的伤口歌词


项目建设-curiously


烧烤菜单-陶喆的歌


荷花作文网-准确的近义词


格言警句-借贷记帐法


塔吊维修保养记录-优派显示器


禁烟标志-爬叉


篮球火歌词-将什么求什么