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

📄 draw.c

📁 关于限制性四叉树实现算法的
💻 C
字号:
/********************************************************************************* draw.C: drawing routines.**** Copyright (C) 1995 by Dani Lischinski **** This program is free software; you can redistribute it and/or modify** it under the terms of the GNU General Public License as published by** the Free Software Foundation; either version 2 of the License, or** (at your option) any later version.**** This program is distributed in the hope that it will be useful,** but WITHOUT ANY WARRANTY; without even the implied warranty of** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the** GNU General Public License for more details.**** You should have received a copy of the GNU General Public License** along with this program; if not, write to the Free Software** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.********************************************************************************/#include "quadedge.h"void PSheader(){	cout << "%!PS-Adobe-2.0 EPSF-2.0\n"	     << "%%Creator: CDT\n"	     << "%%BoundingBox: 30 30 470 470\n"	     << "%%EndComments%\n"	     << "50 50 translate\n"	     << "400 400 scale\n"	     << "0 setlinewidth\n";}#ifdef OPENGL#include <GL/gl.h>void drawEdge(Boolean *ps, Edge *e, Boolean isConstrained){	Point2d a, b;	a = e->Org2d();	b = e->Dest2d();	if (*ps) {		// output postscript		cout << "newpath\n"		     << a[X] << " " << a[Y] << " moveto\n"		     << b[X] << " " << b[Y] << " lineto\n"		     << "stroke\n";	}	if (isConstrained)		glColor3f(1,0,1);	else		glColor3f(1,1,1);	// It is assumed that the glBegin(GL_LINES) call has already	// been issued by the function that called this function.	// glBegin(GL_LINES);	glVertex2dv((double*)&a);	glVertex2dv((double*)&b);	// glEnd();}extern "C"void draw_mesh(Mesh* mesh, int outputPS){	if (outputPS)		PSheader();	glBegin(GL_LINES);	mesh->ApplyEdges(drawEdge, &outputPS);	glEnd();}#endif#ifdef IRISGL// The following hack avoids the conflict between my Boolean// typedef and that of GL:#define Boolean bool#include <gl.h>#undef Booleanvoid drawEdge(Boolean *ps, Edge *e, Boolean isConstrained){	Point2d a, b;	a = e->Org2d();	b = e->Dest2d();	if (*ps) {		// output postscript		cout << "newpath\n"		     << a[X] << " " << a[Y] << " moveto\n"		     << b[X] << " " << b[Y] << " lineto\n"		     << "stroke\n";	}	if (isConstrained)		cpack(0xffff00ff);	else		cpack(0xffffffff);	bgnline();	v2d((double*)&a);	v2d((double*)&b);	endline();}extern "C"void draw_mesh(Mesh* mesh, int outputPS){	if (outputPS)		PSheader();	mesh->ApplyEdges(drawEdge, &outputPS);}#endif

⌨️ 快捷键说明

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