Exemplo n.º 1
0
int main(int argc, char *argv[])

{
	int w,h;
	Rect gb;

	HNN=MakeHashTable();
	HEL=MakeHashTable();
	HLI=MakeHashTable();
	HVC=MakeHashTable();
	CM=MakeQueueTable();

	SetOptions(argc,argv);

	ReadFiles(argc,argv);

	CheckNodes(HNN,HEL,HLI,HVC);
	if( OpCheck )
		CheckMore(HNN,HEL,HLI);

	InitMinMax(&gb);
	GetNodeMinMax(HNN,&gb);
	GetNodeMinMax(HVC,&gb);
	SetMinMax(&gb);

	printf("Min/Max values : %f %f %f %f\n",
		gb.low.x,gb.low.y,gb.high.x,gb.high.y);
	printf("Center values  : %f %f \n",
		(gb.low.x+gb.high.x)/2.,(gb.low.y+gb.high.y)/2.);

	GbAll = GbPlo = gb;

	QGraphInit();
	QNewPen(PlotCol);

	SetColors(OpCol);
	QWindowMaxXY(&w,&h);
	ResizeWindow(w,h);
	ScaleFactor(HVC);

	MakeGridMenu();

/*	MouseInit();	*/
	QInitEvent();

	LoopForInput();

	QGraphClose();

	WriteFiles();

	return 0;
}
Exemplo n.º 2
0
void main()
{
	char instring[MAXSTRING];
	MakeHashTable();
	printf("\n");
	printf(" 输入一个中缀表达式:");
	gets(instring);
	while (strlen(instring)!=0)
	{
		if (ProcessExpress(instring))
		{
			DispInfix();
			Translate();
			DispPostfix();
			printf(" 运算结果:%g\n\n",EvaluatePostfix());
		}
		printf(" 输入一个中缀表达式:");
		gets(instring);
	}
	printf("\n");
}
Exemplo n.º 3
0
int main(int argc, char *argv[])

{
	int ntotal,external;
	NodeList hull, intern, boundary, given;

	HNN=MakeHashTable();
	HEL=MakeHashTable();
	HLI=MakeHashTable();
	NEL=MakeListTable();
	CM=MakeQueueTable();

 	SetOptions(argc,argv);

	ReadFiles(argc,argv);
	/* CheckBoundary(); */

	ntotal = CheckInput();
	hull = MakeNodeList(ntotal);
	intern = MakeNodeList(ntotal);

	printf("Making convex hull... %d\n",hull->count);
	ConvexHull(hull,intern);
/*
	CheckConvex(hull,intern);
	PrintNodeList("hull",hull);
	PrintNodeList("intern",intern);
*/

	printf("Making maxi elements...\n");
	MakeMaxiTriang(hull);
	CheckNeibor(-1);

	printf("Inserting convex hull... %d\n",hull->count);
	InsertBoundaryNodes(hull);
	CheckCircumCircle();
	CheckNeibor(-2);

	WriteAll("M_hull.grd",hull);
	CheckNeibor(-3);

	printf("Inserting internal boundary points... %d\n",intern->count);
	InsertBoundaryNodes(intern);
	CheckCircumCircle();
	CheckNeibor(-4);
	WriteAll("M_orgbound.grd",NULL);

	SetResolution(hull);
	CopyBoundaryLine();

	printf("Recovering boundary lines 1...\n");
	RecoverBoundary();
	CheckCircumCircle();
	CheckNeibor(-43);
	WriteAll("M_bndrecover.grd",NULL);

	printf("Refining boundary points 1...\n");
	boundary = RefineBoundary();

	if( boundary ) {
	    printf("Inserting new boundary points... %d\n",boundary->count);
	    InsertBoundaryNodes(boundary);
	    CheckCircumCircle();
	    CheckCircumCircleProperty();
	    CheckNeibor(-5);
	}

	TestVersion();

	printf("Marking external elements...");
	external=MarkExternalElements( hull );
	printf(" %d / %d\n",external,NTotElems);
	WriteGrd("M_finebound.grd");

/*
	printf("Marking outer elements...");
	external=MarkOuterElements();
	printf(" %d / %d\n",external,NTotElems);
	WriteGrd("M_test.grd");
*/

	FreeNodeList(hull);
	FreeNodeList(intern);
	FreeNodeList(boundary);

	given = GivenNodes();
	printf("Inserting internal given points... %d\n",given->count);
	InsertNodes(given);
	FreeNodeList(given);
	CheckCircumCircle();
	CheckNeibor(-44);
	WriteAll("M_given.grd",NULL);

	printf("Recovering boundary lines 2...\n");
	RecoverBoundary();
	CheckCircumCircle();
	CheckNeibor(-45);
	WriteAll("M_intrecover.grd",NULL);

	CheckArea();
	printf("Inserting internal points...\n");
	InsertInternalNodes();
	CheckCircumCircle();
	CheckCircumCircleProperty();
	WriteGrd("M_insert.grd");

	TestVersion();

	CheckArea();
	printf("Refining internal points... %f\n",OpAspect);
	RefineInternalNodes();
	CheckArea();
	CheckCircumCircle();
	CheckCircumCircleProperty();
	WriteGrd("M_refine.grd");

	CheckArea();
	printf("Recovering boundary lines 3...\n");
	RecoverBoundary();
	printf("Recovering fault lines...\n");
	RecoverInternalFault();
	CheckCircumCircle();
	CheckNeibor(-48);
	WriteAll("M_intrecover2.grd",NULL);

	printf("Marking outer elements...");
	external=MarkOuterElements();
	printf(" %d / %d\n",external,NTotElems);
	printf("Marking outer nodes...");
	external=MarkOuterNodes();
	printf(" %d / %d\n",external,NTotNodes);
	WriteGrd("M_test.grd");

	TestVersion();

	CheckArea();
	printf("Smoothing internal points... %f\n",OpSmoothOmega);
	SmoothInternalNodes();
	CheckArea();
	WriteGrd("final.grd");

	return 0;
}
Exemplo n.º 4
0
//HASH EVALUATOR **************************************
HashEvaluator::HashEvaluator()
{
	MakeHashTable();
}