资源描述:
《计算机图形学实验报告》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实验报告实验课程:计算机图形学学生姓名:XXXX学号:XXXX专业班级:软件2014年12月25日目录i.实验一矩阵变换ii.实验二图形绘制iii.实验三曲线的生成算法实现iv.实验四二维基本图形生成的算法v.实验五二维填充图的生成算法实验一矩阵变换实验题目:求绕平面中任一点P(x,y)旋转ɑ角的变换矩阵,并编程检验。实验目的:掌握图形变换的几何化表示的基本原理和方法;采用几何化方法实现二维图形的组合变换;算法思想:1、根据题意构建新的坐标系; 构成新坐标
2、系的两条直线方程分别为: L2:过点P,且与x轴的夹角为ɑ的逆向直线; L1:过点P,且与x轴的夹角为π/2+ɑ的正向直线。2、写出新旧坐标系的坐标变换矩阵Txy_x*y* 该矩阵就完成了新坐标系下绕原点(原坐标系下P点)的旋转3、输出原坐标系下的线性变换矩阵: R=Txy_x*y*Ttr程序代码:voi
3、dCZhouView::pingyi(){CClientDCdc(this);dc.MoveTo(m_nPoint1.x,m_nPoint1.y);dc.LineTo(m_nPoint2.x,m_nPoint2.y);dc.MoveTo(m_nPoint1.x+100,m_nPoint1.y+100);dc.LineTo(m_nPoint2.x+100,m_nPoint2.y+100);}voidCZhouView::xuanzhuan(){CClientDCdc(this);dc.MoveTo
4、(m_nPoint1.x,m_nPoint1.y);dc.LineTo(m_nPoint2.x,m_nPoint2.y);dc.MoveTo((m_nPoint1.x*cos(0.5))-(m_nPoint1.y*sin(0.5)),(m_nPoint1.x*sin(0.5))+(m_nPoint1.y*cos(0.5)));dc.LineTo((m_nPoint2.x*cos(0.5))-(m_nPoint2.y*sin(0.5)),(m_nPoint2.x*sin(0.5))+(m_nPoi
5、nt2.y*cos(0.5)));}voidCZhouView::bili(){CClientDCdc(this);dc.MoveTo(m_nPoint1.x,m_nPoint1.y);dc.LineTo(m_nPoint2.x,m_nPoint2.y);dc.MoveTo(m_nPoint1.x*2,m_nPoint1.y*2);dc.LineTo(m_nPoint2.x*2,m_nPoint2.y*2);}voidCZhouView::XCQ(){CClientDCdc(this);dc.M
6、oveTo(m_nPoint1.x,m_nPoint1.y);dc.LineTo(m_nPoint2.x,m_nPoint2.y);dc.MoveTo(m_nPoint1.x,m_nPoint1.y);dc.LineTo(m_nPoint2.x+100,m_nPoint2.y);}voidCZhouView::DC(){CClientDCdc(this);dc.MoveTo(m_nPoint1.x,m_nPoint1.y);dc.LineTo(m_nPoint2.x,m_nPoint2.y);d
7、c.MoveTo(m_nPoint1.y,m_nPoint1.x);dc.LineTo(m_nPoint2.y,m_nPoint2.x);}voidCZhouView::YCQ(){CClientDCdc(this);dc.MoveTo(m_nPoint1.x,m_nPoint1.y);dc.LineTo(m_nPoint2.x,m_nPoint2.y);dc.MoveTo(m_nPoint1.x,m_nPoint1.y);dc.LineTo(m_nPoint2.x,m_nPoint2.y+10
8、0);}//OnLButtonUp(UINTnFlags,CPointpoint)case8:pingyi();break;case9:xuanzhuan();break;case10:bili();break;case11:XCQ();break;case12:YCQ();break;case13:DC();break;dc.MoveTo(m_nPoint1.y,m_nPoint1.x);dc.LineTo(m_nPoint2.y,m_nPoint2.x);}voidCZhouView::YC