⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 polygon.h

📁 [Game.Programming].Academic - Graphics Gems (6 books source code)
💻 H
字号:
#include <stdio.h>    /* polygon vertex definition */typedef struct vertex_struct {  double x,y;			/* coordinate values */  struct vertex_struct	*next;	/* circular singly linked list from poly */  } vtx, *vtx_ptr;    /* polygon definition */typedef struct polygon_struct {  vtx_ptr last;		/* pointer to end of circular vertex list */  } polygon, *polygon_ptr;    /* return next vertex in polygon list of vertices */#define polygon_get_vertex(poly, vertex)		    \    ((vertex == NULL) ? poly->last->next : vertex->next)    /* create and insert new polygon vertex */#define polygon_new_vertex(vertex, poly, xx, yy, new_vertex) {	\    new_vertex	= (vtx_ptr) malloc (sizeof(vtx));	    \    new_vertex->x = xx;					    \    new_vertex->y = yy;					    \    if (poly->last != NULL) {				    \      new_vertex->next = poly->last->next;		    \      poly->last->next = new_vertex;			    \      }							    \    else {						    \      new_vertex->next = new_vertex;			    \      }							    \    poly->last = new_vertex;				    \    }    /* create new polygon */#define polygon_create(poly)				    \    poly = (polygon_ptr) malloc(sizeof (polygon));	    \    poly->last = NULL;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -