| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1093 人关注过本帖
标题:[求助]计算机图形学
只看楼主 加入收藏
unicorn
Rank: 4
等 级:贵宾
威 望:14
帖 子:1066
专家分:0
注 册:2005-10-25
收藏
 问题点数:0 回复次数:4 
[求助]计算机图形学

计算机图形学设计的内容还真是多啊,openGL环境下画图实在太麻烦了
刚刚看了看MFC的东东 只能做出这个最基本的啦 但很多想要完成的东东却无从下手啊

我想问的是如何对"DDA算法生成直线"那项进行操作,不是点击就画图了,比如点完之后可以弹出个对话框 ,可以输入直线启始坐标,然后再生成图,谢谢指点


搜索更多相关主题的帖子: 计算机图形学 quot body document 画图 
2006-09-27 21:35
Bekky
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:354
专家分:0
注 册:2006-5-29
收藏
得分:0 
完全可以啊,既可以像你说的那样,也可以用鼠标拉线,都可以啊
你再做个对话框让点击响应你对话框就可以了

[此贴子已经被作者于2006-9-28 8:48:35编辑过]


我的编译环境为WinXp + VC 6.0 http://blog..cn/yobo
2006-09-28 08:46
unicorn
Rank: 4
等 级:贵宾
威 望:14
帖 子:1066
专家分:0
注 册:2005-10-25
收藏
得分:0 
以下是引用Bekky在2006-9-28 8:46:18的发言:
完全可以啊,既可以像你说的那样,也可以用鼠标拉线,都可以啊
你再做个对话框让点击响应你对话框就可以了

是弹出对话框 用Dialog做吧

如何用确定按钮来响应接下来的画图动作呢 因为这里的对话框里是可以输入值的 所以不知道怎么把输入的值传给要相应的函数


unicorn-h.spaces. ◇◆ sava-scratch.spaces.  noh enol ! pue pu!w hw u! shemle aq ll!m noh 
2006-09-28 10:49
ming206
Rank: 2
来 自:重庆
等 级:等待验证会员
威 望:3
帖 子:545
专家分:7
注 册:2005-8-2
收藏
得分:0 

用C就可以了。呵呵,简单的做了一下,可以参考参考,本方法,不好意思。

/*************************************/
/* name : mo xiaoming */
/* write date: 2006-9-21 */
/*************************************/

#include "stdio.h"
#include "math.h"
#include "graphics.h"
/**************************************************
* the function name: WriteMuem
* select the number to write a line or exit window
* return the select number
**************************************************/
int WriteMuem()
{
int select;
printf("*--------- Enter n -----------------*\n");
printf("* [1].Start Write a Line *\n");
printf("* [0].Exit Window *\n");
printf("*-----------------------------------*\n");
printf("Please Enter n:");
scanf("%d",&select);
return select;
}
/*************************************************************
* the function name : WriteLine
* write a line function
* no return nothing
*************************************************************/
void WriteLine(float x1,float y1,float x2,float y2,int color)
{

float x,y,x3,y3,n,t;

printf("\n\nx1=%f,y1=%f,x2=%f,y2=%f,color=%d\n",x1,y1,x2,y2,color);

x3=x2-x1;
y3=y2-y1;
n=fabs(x3);
t=fabs(y3);

n=(t>n)?t:n;
if(n!=0.0){
x=x3/n;
y=y3/n;
}
x1+=0.5;
y1+=0.5;

x3=(int)x1;
y3=(int)y1;

x2=(int)(x2+0.5);
y2=(int)(y2+0.5);

n=fabs(x3-x2);
t=fabs(y3-y2);

n=(t>n)?t:n;
putpixel((int)x3,(int)y3,(int)color);
/*getch();*/
while(n>0){
x1+=x;
y1+=y;
n--;
putpixel((int)x1,(int)y1,(int)color);
}
}
/*************************************
* the function name:inner
* the inner function
*****************************************/
void inner()
{
float x1=0.0,y1=0.0;
float x2=0.0,y2=0.0;
int n=1,color=1;
while(n!=0){
/*call the function WriteMuem*/
n=WriteMuem();
switch((int)n){
case 1:
printf("Enter x1:"); scanf("%f",&x1);
printf("\nEnter y1:"); scanf("%f",&y1);
printf("\nEnter x2:"); scanf("%f",&x2);
printf("\nEnter y2:"); scanf("%f",&y2);
printf("Select the color:(1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:)");
scanf("%d",&color);
printf("\n\n\n Write Out the line :\n");
/*call the function:WriteLine*/
WriteLine(x1,y1,x2,y2,color);
printf("Press the Enter!\n");
getch();
break;
case 0:exit(0);/*Exit The Window */
default :break;
}
}
}

/*the main function*/
int main(void)
{

int VGA_driver=VGA,VGA_mode=VGAHI; /* create the driver */
clrscr(); /* clear the window */
initgraph(&VGA_driver,&VGA_mode,""); /* initgraph */
inner(); /* call the function inner */
closegraph(); /* closegraph */
return 0;
}



外贸综合平台:E贸通
2006-09-28 15:45
unicorn
Rank: 4
等 级:贵宾
威 望:14
帖 子:1066
专家分:0
注 册:2005-10-25
收藏
得分:0 
谢谢参与...呵呵

画这简单的元素c还好说

关键是想用可视的菜单和对话框来做 而且强调VC的环境...openGL的环境都不得用 C当然也不行了
继续看看MFC ...

unicorn-h.spaces. ◇◆ sava-scratch.spaces.  noh enol ! pue pu!w hw u! shemle aq ll!m noh 
2006-09-28 19:08
快速回复:[求助]计算机图形学
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013975 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved