当前位置:首页 > 代码 > 正文

计算机图形学源代码(图形学编程语言)

admin 发布:2022-12-19 16:18 141


今天给各位分享计算机图形学源代码的知识,其中也会对图形学编程语言进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

跪求一个能画出彩色花朵的计算机图形学课程设计源代码,如图

目前在电子行业使用比较多的产品主要有ASIC和FPGA,在这两者之间FPGA是最具有技术优势的一种产品,并且具有逐渐取代ASIC的趋势。

ASIC是专用集成电路的英文简称。在过去的一段时间中,ASIC设计技术一直是集成电路设计市场的主流。一般说来,ASIC主要针对大批量生产的专用产品,以尽可能的降低生产设计成本。而FPGA由于其良好的可配置特性广泛应用小批量的产品设计中,尤其是在ASIC的原型验证阶段经常使用FPGA来构建硬件平台。但是随着FPGA在性能、密度上的提升,以及芯片制造工艺的改进导致的NRE成本激增,使ASIC的市场逐渐被FPGA所占据。

对于ASIC与没有使用嵌入式硬核基于LUT的FPGA(图1-2)而言,ASIC与FPGA的延迟性能大概相差12~14倍,并且该结果针对0.25um~90nm的CMOS工艺都是基本适用的。不考虑性能的情况下,对于实现相同的逻辑功能而言,没有使用硬核的FPGA比ASIC面积大35倍,动态功耗增加14倍以上。

22fgcfcvg

高分求一个计算机图形学的源程序

建立一个空的Win32应用程序,添加一个cpp文件,然后把代码拷进去就行了

#pragma comment(lib,"opengl32.lib")

#pragma comment(lib,"glu32.lib")

#pragma comment(lib,"glaux.lib")

#include windows.h

#include gl/gl.h

#include gl/glu.h

#include gl/glaux.h

HDC hDC=NULL;

HGLRC hRC=NULL;

HWND hWnd=NULL;

HINSTANCE hInstance;

BOOL keys[256];

BOOL active=TRUE;

BOOL fullscreen=TRUE;

GLfloat rtri;

GLfloat rquad;

LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);

GLvoid ResizeGLScene(GLsizei width,GLsizei height)

{

if(height==0)

height=1;

glViewport(0,0,width,height);

glMatrixMode(GL_PROJECTION);

glLoadIdentity();

gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);

glMatrixMode(GL_MODELVIEW);

glLoadIdentity();

}

int InitGL(GLvoid)

{

glShadeModel(GL_SMOOTH);

glClearColor(0.0f,0.0f,0.0f,0.5f);

glClearDepth(1.0f);

glEnable(GL_DEPTH_TEST);

glDepthFunc(GL_LEQUAL);

glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);

return TRUE;

}

int DrawGLScene(GLvoid)

{

glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

glLoadIdentity();

glTranslatef(-1.5f,0.0f,-6.0f);

glRotatef(rtri,0.0f,1.0f,0.0f);

glBegin(GL_TRIANGLES);

glColor3f(1.0f,0.0f,0.0f);

glVertex3f(0.0f,1.0f,0.0f);

glColor3f(0.0f,1.0f,0.0f);

glVertex3f(-1.0f,-1.0f,1.0f);

glColor3f(0.0f,0.0f,1.0f);

glVertex3f(1.0f,-1.0f,1.0f);

glColor3f(1.0f,0.0f,0.0f);

glVertex3f(0.0f,1.0f,0.0f);

glColor3f(0.0f,0.0f,1.0f);

glVertex3f(1.0f,-1.0f,1.0f);

glColor3f(0.0f,1.0f,0.0f);

glVertex3f(1.0f,-1.0f,-1.0f);

glColor3f(1.0f,0.0f,0.0f);

glVertex3f(0.0f,1.0f,0.0f);

glColor3f(0.0f,1.0f,0.0f);

glVertex3f(1.0f,-1.0f,-1.0f);

glColor3f(0.0f,0.0f,1.0f);

glVertex3f(-1.0f,-1.0f,-1.0f);

glColor3f(1.0f,0.0f,0.0f);

glVertex3f(0.0f,1.0f,0.0f);

glColor3f(0.0f,0.0f,1.0f);

glVertex3f(-1.0f,-1.0f,-1.0f);

glColor3f(0.0f,1.0f,0.0f);

glVertex3f(-1.0f,-1.0f,1.0f);

glEnd();

glLoadIdentity();

glTranslatef(1.5f,0.0f,-7.0f);

glRotatef(rquad,1.0f,1.0f,1.0f);

glBegin(GL_QUADS);

glColor3f(0.0f,1.0f,0.0f);

glVertex3f(1.0f,1.0f,-1.0f);

glVertex3f(-1.0f,1.0f,-1.0f);

glVertex3f(-1.0f,1.0f,1.0f);

glVertex3f(1.0f,1.0f,1.0f);

glColor3f(1.0f,0.5f,0.0f);

glVertex3f(1.0f,-1.0f,1.0f);

glVertex3f(-1.0f,-1.0f,1.0f);

glVertex3f(-1.0f,-1.0f,-1.0f);

glVertex3f(1.0f,-1.0f,-1.0f);

glColor3f(1.0f,0.0f,0.0f);

glVertex3f(1.0f,1.0f,1.0f);

glVertex3f(-1.0f,1.0f,1.0f);

glVertex3f(-1.0f,-1.0f,1.0f);

glVertex3f(1.0f,-1.0f,1.0f);

glColor3f(1.0f,1.0f,0.0f);

//glVertex3f(1.0f,-1.0f,-1.0f);

//glVertex3f(-1.0f,-1.0f,-1.0f);

//glVertex3f(-1.0f,1.0f,-1.0f);

//glVertex3f(1.0f,1.0f,-1.0f);

glVertex3f(-1.0f,1.0f,-1.0f);

glVertex3f(1.0f,1.0f,-1.0f);

glVertex3f(1.0f,-1.0f,-1.0f);

glVertex3f(-1.0f,-1.0f,-1.0f);

glColor3f(0.0f,0.0f,1.0f);

glVertex3f(-1.0f,1.0f,1.0f);

glVertex3f(-1.0f,1.0f,-1.0f);

glVertex3f(-1.0f,-1.0f,-1.0f);

glVertex3f(-1.0f,-1.0f,1.0f);

glColor3f(1.0f,0.0f,1.0f);

glVertex3f(1.0f,1.0f,-1.0f);

glVertex3f(1.0f,1.0f,1.0f);

glVertex3f(1.0f,-1.0f,1.0f);

glVertex3f(1.0f,-1.0f,-1.0f);

glEnd();

rtri+=0.2f;

rquad-=0.15f;

return TRUE;

}

GLvoid KillGLWindow(GLvoid)

{

if(fullscreen)

{

ChangeDisplaySettings(NULL,0);

ShowCursor(TRUE);

}

if(hRC)

{

if(!wglMakeCurrent(NULL,NULL))

MessageBox(NULL,"释放DC或RC失败","关闭错误",MB_OK|MB_ICONINFORMATION);

if(!wglDeleteContext(hRC))

MessageBox(NULL,"释放RC失败","关闭错误",MB_OK|MB_ICONINFORMATION);

hRC=NULL;

}

if(hDC !ReleaseDC(hWnd,hDC))

{

MessageBox(NULL,"释放DC失败","关闭错误",MB_OK|MB_ICONINFORMATION);

hDC=NULL;

}

if(hWnd !DestroyWindow(hWnd))

{

MessageBox(NULL,"释放窗口句柄失败","关闭错误",MB_OK|MB_ICONINFORMATION);

hWnd=NULL;

}

if(!UnregisterClass("OpenG",hInstance))

{

MessageBox(NULL,"不能注销窗口类","关闭错误",MB_OK|MB_ICONINFORMATION);

hInstance=NULL;

}

}

BOOL CreateGLWindow(char* title,int width,int height,int bits,BOOL fullscreenflag)

{

GLuint PixelFormat;

WNDCLASS wc;

DWORD dwExStyle;

DWORD dwStyle;

RECT WindowRect;

WindowRect.left=(long)0;

WindowRect.right=(long)width;

WindowRect.top=(long)0;

WindowRect.bottom=(long)height;

fullscreen=fullscreenflag;

hInstance=GetModuleHandle(NULL);

wc.style=CS_HREDRAW|CS_VREDRAW|CS_OWNDC;

wc.lpfnWndProc=(WNDPROC)WndProc;

wc.cbClsExtra=0;

wc.cbWndExtra=0;

wc.hInstance=hInstance;

wc.hIcon=LoadIcon(NULL,IDI_WINLOGO);

wc.hCursor=LoadCursor(NULL,IDC_ARROW);

wc.hbrBackground=NULL;

wc.lpszMenuName=NULL;

wc.lpszClassName="OpenG";

if(!RegisterClass(wc))

{

MessageBox(NULL,"注册窗口失败","错误",MB_OK|MB_ICONINFORMATION);

return FALSE;

}

if(fullscreen)

{

DEVMODE dmScreenSettings;

memset(dmScreenSettings,0,sizeof(dmScreenSettings));

dmScreenSettings.dmSize=sizeof(dmScreenSettings);

dmScreenSettings.dmPelsWidth=width;

dmScreenSettings.dmPelsHeight=height;

dmScreenSettings.dmBitsPerPel=bits;

dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;

if(ChangeDisplaySettings(dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)

{

if(MessageBox(NULL,"全屏模式设置失败!\n使用窗口模式?","OpenGL 3D游戏编程",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)

{

fullscreen=FALSE;

}

else

{

MessageBox(NULL,"程序将被关闭","错误",MB_OK|MB_ICONINFORMATION);

return FALSE;

}

}

}

if(fullscreen)

{

dwExStyle=WS_EX_APPWINDOW;

dwStyle=WS_POPUP;

ShowCursor(FALSE);

}

else

{

dwExStyle=WS_EX_APPWINDOW|WS_EX_WINDOWEDGE;

dwStyle=WS_OVERLAPPEDWINDOW;

}

AdjustWindowRectEx(WindowRect,dwStyle,FALSE,dwExStyle);

if(!(hWnd=CreateWindowEx(dwExStyle,"OpenG",title,

dwStyle|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,0,0,

WindowRect.right-WindowRect.left,WindowRect.bottom-WindowRect.top,

NULL,NULL,hInstance,NULL)))

{

KillGLWindow();

MessageBox(NULL,"窗口创建失败","错误",MB_OK|MB_ICONINFORMATION);

return FALSE;

}

static PIXELFORMATDESCRIPTOR pfd=

{

sizeof(PIXELFORMATDESCRIPTOR),1,

PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER,

PFD_TYPE_RGBA,bits,

0,0,0,0,0,0,

0,

0,

0,

0,0,0,0,

16,

0,

0,

PFD_MAIN_PLANE,

0,

0,0,0

};

if(!(hDC=GetDC(hWnd)))

{

KillGLWindow();

MessageBox(NULL,"不能创建一个窗口设备描述表","错误",MB_OK|MB_ICONINFORMATION);

return FALSE;

}

if(!(PixelFormat=ChoosePixelFormat(hDC,pfd)))

{

KillGLWindow();

MessageBox(NULL,"不能创建一个匹配的像素格式","错误",MB_OK|MB_ICONINFORMATION);

return FALSE;

}

if(!SetPixelFormat(hDC,PixelFormat,pfd))

{

KillGLWindow();

MessageBox(NULL,"不能设置像素格式","错误",MB_OK|MB_ICONINFORMATION);

return FALSE;

}

if(!(hRC=wglCreateContext(hDC)))

{

KillGLWindow();

MessageBox(NULL,"不能创建OpenGL渲染描述表","错误",MB_OK|MB_ICONINFORMATION);

return FALSE;

}

if(!wglMakeCurrent(hDC,hRC))

{

KillGLWindow();

MessageBox(NULL,"不能激活当前的OpenGL渲染描述表","错误",MB_OK|MB_ICONINFORMATION);

return FALSE;

}

ShowWindow(hWnd,SW_SHOW);

SetForegroundWindow(hWnd);

SetFocus(hWnd);

ResizeGLScene(width,height);

if(!InitGL())

{

KillGLWindow();

MessageBox(NULL,"初始化失败","错误",MB_OK|MB_ICONINFORMATION);

return FALSE;

}

return TRUE;

}

LRESULT CALLBACK WndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)

{

switch(uMsg)

{

case WM_ACTIVATE:

{

if(!HIWORD(wParam))

active=TRUE;

else

active=FALSE;

return 0;

}

case WM_SYSCOMMAND:

{

switch(wParam)

{

case SC_SCREENSAVE:

case SC_MONITORPOWER:

return 0;

}

break;

}

case WM_CLOSE:

{

PostQuitMessage(0);

return 0;

}

case WM_KEYDOWN:

{

keys[wParam]=TRUE;

return 0;

}

case WM_KEYUP:

{

keys[wParam]=FALSE;

return 0;

}

case WM_SIZE:

{

ResizeGLScene(LOWORD(lParam),HIWORD(lParam));

return 0;

}

}

return DefWindowProc(hWnd,uMsg,wParam,lParam);

}

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)

{

MSG msg;

BOOL done=FALSE;

if(MessageBox(NULL,"你想在全屏模式下运行吗?","设置全屏模式",MB_YESNO|MB_ICONQUESTION)==IDNO)

{

fullscreen=FALSE;

}

if(!CreateGLWindow("Win32 SDK风格 OpenGL程序框架",640,480,16,fullscreen))

return 0;

while(!done)

{

if(PeekMessage(msg,NULL,0,0,PM_REMOVE))

{

if(msg.message==WM_QUIT)

done=TRUE;

else

{

TranslateMessage(msg);

DispatchMessage(msg);

}

}

else

{

if(active)

{

if(keys[VK_ESCAPE])

done=TRUE;

else

{

DrawGLScene();

SwapBuffers(hDC);

}

}

if(keys[VK_F1])

{

keys[VK_F1]=FALSE;

KillGLWindow();

fullscreen=!fullscreen;

if(!CreateGLWindow("Win32 SDK风格 OpenGL程序框架",640,480,16,fullscreen))

return 0;

}

}

}

KillGLWindow();

return msg.wParam;

}

计算机图形学 画任意弧度圆弧和椭圆弧的算法代码c++

给出起点和终点:

#include stdio.h

#include stdlib.h

#include math.h

#include graphics.h

void swap_start_end(int x1,int y1,int x2,int y2);

void s_line(int x1,int y1,int x2,int y2);

main()

void swap_start_end(int x1,int y1,int x2,int y2)

{

int mid;

mid=x1;

x1=y1;

y1=mid;

mid=x2;

x2=y2;

y2=mid;

if(x2-x1=0)

dutx=1;

cury+=ty;

putpixel(i,j,2);

outtextxy(320,245,"0"); /*原点坐标*/

outtextxy(320-5*20,245,"-5");circle(320-5*20,240,2); /*横坐标值*/

outtextxy(320 5*20,245,"5");circle(320 5*20,240,2);

outtextxy(320-10*20,245,"-10");circle(320-10*20,240,2);

outtextxy(320 10*20,245,"10");circle(320 10*20,240,2);

outtextxy(320-15*20,245,"-15");circle(320-15*20,240,2);

outtextxy(320 15*20,245,"15");circle(320 15*20,240,2);

outtextxy(320,240-5*20,"-5");circle(320,240-5*20,2); /*纵坐标值*/

outtextxy(320,240 5*20,"5");circle(320,240 5*20,2);

outtextxy(320,240-10*20,"-10");circle(320,240-10*20,2);

outtextxy(320,240 10*20,"10");circle(320,240 10*20,2);

outtextxy(20,10,"The center of the circle is (0,0) "); /*坐标轴左上角显示提示信息*/

setcolor(RED); /*标记坐标轴*/

line(20,240,620,240); outtextxy(320 15*20,230,"X");

line(320,20,320,460); outtextxy(330,20,"Y");

扩展资料:

C++语言的程序因为要体现高性能,所以都是编译型的。但其开发环境,为了方便测试,将调试环境做成解释型的。即开发过程中,以解释型的逐条语句执行方式来进行调试,以编译型的脱离开发环境而启动运行的方式来生成程序最终的执行代码。

生成程序是指将源码(C++语句)转换成一个可以运行的应用程序的过程。如果程序的编写是正确的,那么通常只需按一个功能键,即可搞定这个过程。该过程实际上分成两个步骤。

第一步是对程序进行编译,这需要用到编译器(compiler)。编译器将C++语句转换成机器码(也称为目标码);如果这个步骤成功,下一步就是对程序进行链接,这需要用到链接器(linker)。链接器将编译获得机器码与C++库中的代码进行合并。

参考资料来源:百度百科-C++

计算机图形学的weiler-atherton算法代码

CS 535

WEILER-ATHERTON

PROBLEM

Implement Weiler-Atherton. You should draw each polygon in a different color and fill the clip areas generated with a third color.

NOTES:

The Weiler-Atherton algorithm is the most general of the clipping algorithms. We have two 2D polygons (may be convex or concave and they both may have holes). The polygon to be clipped is called the SUBJECT polygon and the polygon defining the clipping area is called the CLIP polygon. To make the algorithm work easier (in the data structures, etc.) we usually assume that the exterior vertices are given clockwise and the hole vertices are given counterclockwise. In clipping we usually want to find the parts of the subject polygon that are inside the clip polygon. However, this algorithm can be used in modeling to find the "union", "intersection", and "difference" of the polygons.

The data structures are several circular linked lists of vertices which are also linked together and the clipping is done by traversing these. The lists could be doubly linked. This enables the traversal in either direction at any node in the list. Starting at a particular node and traversing in one direction will produce the interior polygon(s) while starting at a different node and traversing can produce the outside. Note that producing the exterior does need the doubly linking and care must be taken in performing the traversal.

STEP 1:

The first phase of the building of the data structures occurs when we input the edges and put them in two linked lists - the SUBJ list and the CLIP list. The vertices are place in order from input (thus clockwise). There are separate lists for the exterior and for each hole. Thus, the initial build is a standard queue insert (input a vertex - insert it at end of list). Note that this creates a list in which a standard list traversal is equivalent to "walking around" the polygon edge visiting the vertices in order.

STEP 2:

The second phase of the list building is computing and inserting the INTERSECTION points. If we have a SUBJECT polygon edge (SVi to SVi+1) that intersects a CLIP polygon edge (CVj to CVj+1) at a point INTER. Note that the edges form straight lines that may intersect, we are assuming that the line segments SVi to SVi+1 intersects the line segment CVj to CVj+1. The intersection point INTER is then inserted on BOTH of the linked lists - SUBJ and CLIP. It is inserted BETWEEN SVi and SVi+1 on the SUBJ list and CVj and CVj+1 on the CLIP list. The idea is still that traversing the list using a standard list traversal we would encounter the points in their geometric order. Note that there may be several intersection points between any given pair of vertices and they must be inserted in the correct order in the lists. This is done by using the t and u values computed in the vector line intersection subprogram. Each intersection point thus has TWO nodes - one on each list (SUBJ and CLIP). We link these two entries together which provides a way of getting from one list to the other.

STEP 2.5:

Any straight line divides the plane into two half-planes. Thus each polygon edge (extended to a line) will divide the plane into two half-planes. Because we listed the vertices clockwise, we consider the half-plane to the right as containing the interior of the polygon. Thus the right half-plane is called the interior half-plane. If we consider ourselves as "walking along" a polygon edge, then we can categorize each of the INTERSECTION points as "entering" or "exiting". This is usually done from the SUBJ polygon's point of view. Thus, as we walk along the SUBJ polygon edge SVi to SVi+1 and we encounter intersection point INTER, we can ask the question - am I "entering" the CLIP polygon or am I "exiting" the CLIP polygon? The second part of computing the intersection point is to classify them as "entering" or "exiting". We create one or two lists - one for entering intersections and one for exiting intersections.

STEP3:

Once the lists are built the basic idea to do the clipping is as follows

Pick an entry from the ENTERING list - it will be an intersection point (and delete it)

Locate that point on the SUBJ list

Traverse the current (SUBJ) list until you find the next intersection point - it should be an exiting or entering point. Output each vertex encountered to some data structure, say POLY

Follow the link from the current (SUBJ) list to the other (CLIP) list and

Continue the traversal until you find the next intersection (Note: delete each entering intersection from the ENTERING list - not the linked lists. By deleting it we will get the distinct intersecting polygons and not duplicate a polygon multiple times).

Terminate the traversal when you get to an intersection that is the SAME as the initial one that you removed from the ENTERING list. At this point POLY will have one of the clip regions and can be output.

REPEAT the construction and output of POLY until the ENTERING list is empty.

Remark: For the exterior, try starting with an EXITING point. Start the traversal on the SUBJ list (same direction as the Interior). At what point do you need to use the double link and to traverse in the opposite direction? (Hint: look at the CLIP polygon list).

IMPLEMENTATION:

In the below data structures we place all of the vertices and intersection points in a 1D array and use the subscript instead of the actual coordinates.

const int MAXVERT = 500;

const int MAXPOLYV = 50;

const int MAXH = 10;

struct Point2D

{float x,y;

};

typedef Point2D Vertices[MAXVERT];

enum VerType = {Polygon, Intersection};

typedef struct ClipListRec * ClipPtr;

struct ClipListRec

{ int Vindex;

ClipPtr next;

VerType Kind;

float t;

ClipPtr otherList;

}

struct Polygon

{ int nVertex;

int vert[MAXPOLYV];

ClipPtr list;

}

struct GenPolygon

{ Polygon exterior;

int numHoles;

Polygon Holes[MAXH];

}

GenPolygon Sub,Clip;

int entering[MAXVERT],exiting[MAXVERT];

Vertices V;

int numVertex = 0; // size of the array of verticies

int clipPoly[MAXVERT]; // a clip polygon

int readPoint();

{ cin inX; cin inY;

if (numVertex MAXVERT)

{ V[numVertex].x = inX;

V[numVertex].y = inY;

idNo = numVertex;

numVertex++;

}

else

idNo = -1;

return idNo;

}

void readPolygon (GenPolygon p)

{ cin p.exterior.nVertex;

for (i = 0; i p.exterior.nVertex; i++)

{ newId = readPoint();

if (newId 0)

error

else

{ insertAtRear (p.exterior.list,newId);

p.exterior.vert[i] = newId;

}

}

// now do the holes basically the same way

. . .

}

// the "main" program loop would then be (pseudocode)

while (!EMPTY(entering))

{ nextInter = delete (entering);

SEARCH (SubjectPolygon,nextInter,ptr1);

AddToOutputList (ptr1-. . .)

StartPoint = ptr1-. . .

ptr1 = prt1-next;

while (ptr1-. . . != StartPoint)

{ AddToOutputList (ptr1-. . .);

if (ptr1- . . == INTERSECTION)

ptr1 = prt1-otherList-next;

else

ptr1 = ptr1-next;

}

FixListForOutput();

DrawPolygon();

EmptyOutputList();

}

求C源码:计算机图形学程序——扫描线算法

这是我以前上学的时候写的,你改改,凑活用巴。

=============================

#include graphics.h

#include stdio.h

#include dos.h

#include math.h

#include bios.h

#include string.h

void parspl ( int p[10000][2] , long n , int precision , int color )

{

int x = 0 , y = 0 , i = 0 , j = 0 , m = 0 ;

double t2 = 0 , t3 = 0 , t = 0 , a , b , c , d , e = p[1][0] + 5 , f = p[1][1] + 5 ;

setcolor ( color ) ;

m=n+1;

p[0][0] = p[n][0] ;

p[0][1] = p[n][1] ;

p[m][0] = p[1][0] ;

p[m][1] = p[1][1] ;

p[m+1][0] = p[2][0] ;

p[m+1][1] = p[2][1] ;

moveto ( p[1][0] , p[1][1] ) ;

for ( i = 0 ; i n ; i ++ )

{

t = 0.5 / precision ;

for ( j = 1 ; j precision ; j ++ )

{

t2 = t * t ;

t3 = t2 * t ;

a = 4 * t2 - t - 4 * t3 ;

b = 1 - 10 * t2 + 12 * t3 ;

c = t + 8 * t2 - 12 * t3 ;

d = 4 * t3 - 2 * t2 ;

x = a * p[i][0] + b * p[i+1][0] + c * p[i+2][0] + d * p[i+3][0] ;

y = a * p[i][1] + b * p[i+1][1] + c * p[i+2][1] + d * p[i+3][1] ;

lineto ( x , y ) ;

line ( e , f , x + 5 , y + 5 ) ;

moveto ( x , y ) ;

t += 0.5 / precision ;

e = x + 5 ;

f = y + 5 ;

}

lineto ( p[i+2][0] , p[i+2][1] ) ;

moveto ( e , f ) ;

lineto ( p[i+2][0] + 5 , p[i+2][1] + 5 ) ;

moveto ( p[i+2][0] , p[i+2][1] ) ;

}

}

int main()

{

long n = 5 ;

char pwd[4] ;

int p[100][2] ;

int a1 , a2 , b1 , b2 , c1 , c2 , d1 , d2 , e1 , e2 ;

int gdriver = VGA , gmode = VGAHI ;

initgraph( gdriver , gmode , "c:\\tc" ) ;

setbkcolor ( 0 ) ;

a1 = p[1][0] = 320 ;

a2 = p[1][1] = 240 ;

b1 = p[2][0] = 320 ;

b2 = p[2][1] = 120 ;

c1 = p[3][0] = 452 ;

c2 = p[3][1] = 128 ;

d1 = p[4][0] = 382 ;

d2 = p[4][1] = 388 ;

e1 = p[5][0] = 364 ;

e2 = p[5][1] = 280 ;

loop:

if ( a1 = p[1][0] p[1][0] = 520 )

{

a1 = p[1][0] ;

p[1][0] += 1 ;

}

else

{

if ( p[1][0] = 120 )

{

a1 = p[1][0] ;

p[1][0] -= 1 ;

}

else

a1 = p[1][0] = 120 ;

}

if ( a2 = p[1][1] p[1][1] = 60 )

{

a2 = p[1][1] ;

p[1][1] -= 2 ;

}

else

{

if ( p[1][1] = 420 )

{

a2 = p[1][1] ;

p[1][1] += 2 ;

}

else

a2 = p[1][1] = 420 ;

}

if ( b1 = p[2][0] p[2][0] = 120 )

{

b1 = p[2][0] ;

p[2][0] -= 2 ;

}

else

{

if ( p[2][0] = 520 )

{

b1 = p[2][0] ;

p[2][0] += 2 ;

}

else

b1 = p[2][0] = 520 ;

}

if ( b2 = p[2][1] p[2][1] = 420 )

{

b2 = p[2][1] ;

p[2][1] += 1 ;

}

else

{

if ( p[2][1] = 60 )

{

b2 = p[2][1] ;

p[2][1] -= 1 ;

}

else

b2 = p[2][1] = 60 ;

}

if ( c1 = p[3][0] p[3][0] = 520 )

{

c1 = p[3][0] ;

p[3][0] += 1 ;

}

else

{

if ( p[3][0] = 120 )

{

c1 = p[3][0] ;

p[3][0] -= 1 ;

}

else

c1 = p[3][0] = 120 ;

}

if ( c2 = p[3][1] p[3][1] = 420 )

{

c2 = p[3][1] ;

p[3][1] += 1 ;

}

else

{

if ( p[3][1] = 60 )

{

c2 = p[3][1] ;

p[3][1] -= 1 ;

}

else

c2 = p[3][1] = 60 ;

}

if ( d1 = p[4][0] p[4][0] = 120 )

{

d1 = p[4][0] ;

p[4][0] -= 1 ;

}

else

{

if ( p[4][0] = 520 )

{

d1 = p[4][0] ;

p[4][0] += 1 ;

}

else

d1 = p[4][0] = 520 ;

}

if ( d2 = p[4][1] p[4][1] = 60 )

{

d2 = p[4][1] ;

p[4][1] -= 1 ;

}

else

{

if ( p[4][1] = 420 )

{

d2 = p[4][1] ;

p[4][1] += 1 ;

}

else

d2 = p[4][1] = 420 ;

}

if ( e1 = p[5][0] p[5][0] = 520 )

{

e1 = p[5][0] ;

p[5][0] += 1 ;

}

else

{

if ( p[5][0] = 120 )

{

e1 = p[5][0] ;

p[5][0] -= 1 ;

}

else

e1 = p[5][0] = 120 ;

}

if ( e2 = p[5][1] p[5][1] = 420 )

{

e2 = p[5][1] ;

p[5][1] += 2 ;

}

else

{

if ( p[5][1] = 60 )

{

e2 = p[5][1] ;

p[5][1] -= 2 ;

}

else

e2 = p[5][1] = 60 ;

}

parspl ( p , n , 100 , 4 ) ;

parspl ( p , n , 100 , 4 ) ;

if ( bioskey ( 1 ) 0 )

{

printf ("Please Input Password:") ;

gets (pwd) ;

if ( !strcmp(pwd,"cmy") )

{

clearviewport () ;

closegraph () ;

return 1 ;

}

}

cleardevice () ;

goto loop ;

}

Computer Graphics with OpenGL Third Edition 求本书源代码。

很想帮助你,可真滴不知道。 回答者: AlwaysOnline群 | 五级 | 2011-3-15 17:37 | 检举

第一本书也就是“计算机网络——自顶向下方法与Internet特色”,网络上的版本都来源于超星阅读,也就是PDG格式,且只有第一版。这个第一版在CSDN上广为流传,我忍辱负重,注册了一个帐号,还要邮箱验证,随便注册了一个邮箱,还要受它的破下载积分限制!仔细找了找,就找到上面我写的,还有些习题答案和“计算机网络——自顶向下方法与Internet特色”的第一版英文版。

第二本书只能找到计算机图形学(OpenGL)第二版的源代码

所以我已将第一本书的第一版的中英文PDF版和PDG版发送。21:24。中文PDF是我自己做的,CSDN上的PDF没目录没封面,也不清晰,所以我又将PDG转换成PDF一次,清晰是清晰,就是图片会有些黑影。PDG就不会有问题。英文版也是CSDN上的。

另外看到这个问题的人也省得浪费时间了,我想啊还不如买一本呢。为了方便下载,地址如下。都是第一版。

计算机网络——自顶向下方法与Internet特色.pdf

计算机网络——自顶向下方法与Internet特色(PDG).7z

计算机网络——自顶向下方法与Internet特色(英文).pdf 回答者: fsdhzxlfq | 一级 | 2011-3-18 10:05 | 检举

第一本书也就是“计算机网络——自顶向下方法与Internet特色”,网络上的版本都来源于超星阅读,也就是PDG格式,且只有第一版。这个第一版在CSDN上广为流传,我忍辱负重,注册了一个帐号,还要邮箱验证,随便注册了一个邮箱,还要受它的破下载积分限制!仔细找了找,就找到上面我写的,还有些习题答案和“计算机网络——自顶向下方法与Internet特色”的第一版英文版。

第二本书只能找到计算机图形学(OpenGL)第二版的源代码

所以我已将第一本书的第一版的中英文PDF版和PDG版发送。21:24。中文PDF是我自己做的,CSDN上的PDF没目录没封面,也不清晰,所以我又将PDG转换成PDF一次,清晰是清晰,就是图片会有些黑影。PDG就不会有问题。英文版也是CSDN上的。

另外看到这个问题的人也省得浪费时间了,我想啊还不如买一本呢。为了方便下载,地址如下。都是第一版。

计算机网络——自顶向下方法与Internet特色.pdf

计算机网络——自顶向下方法与Internet特色(PDG).7z

关于计算机图形学源代码和图形学编程语言的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/12534.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载