本文是在上一篇博客基于MFC的平行投影算法实现的基础上实现透视投影中的一点透视。 两种方法实现 设置 实现效果: 首先在 实现效果:
基于
MFC的透视投影算法实现一、添加事件处理程序实现
ID为
ID_Yidiantoushi,添加事件处理程序
OnYidiantoushi()。void CParallelProjectionView::OnYidiantoushi() { // TODO: 在此添加命令处理程序代码 bianhuan1[0][0] = 1, bianhuan1[0][1] = 0, bianhuan1[0][2] = 0, bianhuan1[0][3] = 0; bianhuan1[1][0] = 0, bianhuan1[1][1] = 1, bianhuan1[1][2] = 0, bianhuan1[1][3] = 0; bianhuan1[2][0] = 0, bianhuan1[2][1] = 0, bianhuan1[2][2] = 0, bianhuan1[2][3] = -0.4; bianhuan1[3][0] = 0.8, bianhuan1[3][1] = -1.6, bianhuan1[3][2] = 0, bianhuan1[3][3] = 1.8; matx_N4(lifang, bianhuan1, jieguo); mydraw(); }
二、利用系统响应函数实现
View类中声明double my_z;
然后在
OnCreate()函数中赋值my_z = -0.4;
最后再利用类向导添加消息中的
WM_LBUTTONDBLCLK处理函数。实现双击鼠标左键来改变投影中心离投影面的距离。void CParallelProjectionView::OnLButtonDblClk(UINT nFlags, CPoint point) { // TODO: 在此添加消息处理程序代码和/或调用默认值 if (my_z >= -0.6) { my_z += 0.05; if (my_z >= -0.0) my_z = -0.6; } RedrawWindow(); //一点透视变换矩阵 bianhuan1[0][0] = 1, bianhuan1[0][1] = 0, bianhuan1[0][2] = 0,bianhuan1[0][3] = 0; bianhuan1[1][0] = 0, bianhuan1[1][1] = 1, bianhuan1[1][2] = 0, bianhuan1[1][3] = 0; bianhuan1[2][0] = 0, bianhuan1[2][1] = 0, bianhuan1[2][2] = 0, bianhuan1[2][3] = my_z; bianhuan1[3][0] = 0.8, bianhuan1[3][1] = -1.6, bianhuan1[3][2] = 0, bianhuan1[3][3] = 1.8; matx_N4(lifang, bianhuan1, jieguo); mydraw(); CView::OnLButtonDblClk(nFlags, point); }
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算