日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

c语言画简谐振动图像,[求助] 实心小球沿正弦曲线运动

發布時間:2024/3/13 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c语言画简谐振动图像,[求助] 实心小球沿正弦曲线运动 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

還是把程序貼出來吧 要不 蒼穹大哥會怒的

#include

#include

#include

#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() ;

}

總結

以上是生活随笔為你收集整理的c语言画简谐振动图像,[求助] 实心小球沿正弦曲线运动的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。