| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1184 人关注过本帖
标题:[求助] 实心小球沿正弦曲线运动
只看楼主 加入收藏
动来动去
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-7-2
收藏
 问题点数:0 回复次数:9 
[求助] 实心小球沿正弦曲线运动
要求画出一个实心小球,并让小球沿着正弦曲线运动.
我还不太会用图形函数 希望 大家能帮帮我
搜索更多相关主题的帖子: 实心小球 正弦曲线运动 图形 函数 
2007-07-02 12:52
cdmalcl
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:4091
专家分:524
注 册:2005-9-23
收藏
得分:0 
2007-07-03 21:40
动来动去
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-7-2
收藏
得分:0 

2007-07-03 21:56
动来动去
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-7-2
收藏
得分:0 

谢谢~ 其实不想谢你!!

2007-07-03 21:58
cdmalcl
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:4091
专家分:524
注 册:2005-9-23
收藏
得分:0 

不用谢 不用谢 多请我几顿饭就行

2007-07-03 22:14
动来动去
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-7-2
收藏
得分:0 

我看这个机会还是留给别人吧~~

2007-07-03 22:17
cdmalcl
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:4091
专家分:524
注 册:2005-9-23
收藏
得分:0 
随意随意 能有饭吃就行
2007-07-04 00:47
动来动去
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-7-2
收藏
得分:0 
那你就等等吧`
2007-07-04 12:39
cdmalcl
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:4091
专家分:524
注 册:2005-9-23
收藏
得分:0 

晕了
另一个程序我怎么也粘贴不上来

你上QQ了管我要吧

2007-07-04 17:55
cdmalcl
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:4091
专家分:524
注 册:2005-9-23
收藏
得分:0 

还是把程序贴出来吧 要不 苍穹大哥会怒的


#include <graphics.h>
#include <math.h>
#include <stdlib.h>

#define PI 3.14
#define LINECOLOR 7
#define ESC 283

typedef struct
{
int x ;
int y ;
}SITE;

typedef struct
{
SITE s0 ;
SITE s1 ;
SITE s2 ;
SITE s3 ;
}RECTSITE;

int Init() ;
int drawProcess() ;
int moveRectangle(RECTSITE rectSite) ;
int End() ;

int screenMaxx2, screenMaxy2 ;

main()
{
Init();
drawProcess();
End();
}

int Init()
{
int gd = DETECT, gm = 0 ;

initgraph(&gd, &gm, "") ;

screenMaxx2 = getmaxx()/2 ;
screenMaxy2 = getmaxy()/2 ;

}
/*
Len0
s0-------s1
| |
| |Len1
| |
| |
s3-------s2

*/
int drawProcess()
{
RECTSITE rectSite ;
int moveCenterX, moveCenterY ;
int i ;
float LenR, Len0, Len1 ;
float startr, r ;

Len0 = 50 ;
Len1 = 80 ;
LenR = sqrt(Len0*Len0+Len1*Len1) ;
startr = atan(Len1/Len0) ;

moveCenterX = screenMaxx2 ;
moveCenterY = screenMaxy2 ;

rectSite.s0.x = moveCenterX ;
rectSite.s0.y = moveCenterY ;

while(!kbhit())
{
for(r = 0;r <= PI*2;r+=0.0314)
{
rectSite.s1.x = Len0*sin(r)+moveCenterX ;
rectSite.s2.x = LenR*sin(r-startr)+moveCenterX ;
rectSite.s3.x = Len1*sin(r-PI/2)+moveCenterX ;
rectSite.s1.y = Len0*cos(r)+moveCenterY ;
rectSite.s2.y = LenR*cos(r-startr)+moveCenterY ;
rectSite.s3.y = Len1*cos(r-PI/2)+moveCenterY ;

setcolor(LINECOLOR) ;
moveRectangle(rectSite) ;

delay(1000) ;

setcolor(0) ;
moveRectangle(rectSite) ;

if(kbhit())
{
if(bioskey(0) == ESC)
return 0 ;
}
}

}
}

int moveRectangle(RECTSITE rectSite)
{
line(rectSite.s0.x, rectSite.s0.y, rectSite.s1.x, rectSite.s1.y) ;
line(rectSite.s1.x, rectSite.s1.y, rectSite.s2.x, rectSite.s2.y) ;
line(rectSite.s2.x, rectSite.s2.y, rectSite.s3.x, rectSite.s3.y) ;
line(rectSite.s3.x, rectSite.s3.y, rectSite.s0.x, rectSite.s0.y) ;

}

int End()
{
setcolor(4) ;
outtextxy(screenMaxx2, screenMaxy2, "END!") ;
getch() ;
closegraph() ;
}

2007-07-05 08:38
快速回复:[求助] 实心小球沿正弦曲线运动
数据加载中...
 
   



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

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