next up previous
Next: Initialization and termination Up: RECView.m Program Listing Previous: RECView.m Program Listing

Declarations

The declarations shown below contain several extraneous elements, and are only included for consistency with the rest of the program, in case the definition of terms used elsewhere is needed.

/* 
 * RECView.m -- Implementation file for the RECView class 
 *
 * You may freely copy, distribute, and reuse the code in this example.
 * NeXT disclaims any warranty of any kind, expressed or implied, as to 
 * its fitness for any particular use, or that it even has a use.
 *
 */

#import "rec.h"
#import "recdtbl.h"
#import "RECView.h"
#import <NXCType.h>
#import <math.h>
#import <stdlib.h>
#import <string.h>

# define   KK 2
# define CLEN 300	/* buffer length for rec source        */
# define PLEN 900	/* buffer length for rec object        */
# define HMAX  25	/* maximum depth pushdown stack        */
# define PMAX  12	/* maximum polygon accepted by program */
# define  NMU   5	/* number of items in first column     */
# define   NY   8	/* number of demonstration programs    */
# define  NIP  12	/* number of initial polygons          */
# define  NSK   4	/* number of prototype skeletons       */
# define PI 3.14159

//int  rec(char *z);
void refen(int n);

char   cstr[CLEN];	/* console rec program     */
Inst   rprg[PLEN];	/* rec program array       */
int    phil;		/* length of cstr	   */
int    plev;		/* pushdown depth	   */
char   idef[1][30] = { " (()) " };  //(z(!100!0r:;)1r2r(0r:;);) a€" };
char   recrule[NY][CLEN] = {
	" ([pentagonal] X5 P CN CN CN CN C p;)",
	" ([bipentag] X5 P CN CN CN Cn Cn Cn Cn C p;)",
	" (TC NC NC NC nC nC nC nC;)"
	};
char   skeletons[NSK][CLEN] = {
	" ([show polygon] O C;)",
	" ([sector] O (! n ! C N:;);)",
	" ([binary] O (! n-1 ! C N:;)(! n-1 ! C n :;);)",
	" ([second] O (! n ! C N:;);)"
	};

int    isErrm=FALSE;
int    drawBack=YES;
int    exSource=YES;
int    options[4]={FALSE,FALSE,FALSE,FALSE};
int    pgon=3, edge=0;
char   errm[50];
double scale=25.0;

char dfclr[KK][12] = {"1.0,0.0,0.0","0.0,1.0,0.0"};
struct inpoly {int order; double points[8][3]; char *title;};
struct inpoly inpollies[NIP] = {
		3,{	{ 0.0,  0.0, 0.25},
			{ 5.0,  0.0, 0.25},
			{ 0.0,  8.6, 0.25}},
			"3 - 30-60-90 triangle",
		3,{	{ 0.0,  0.0, 0.25},
			{10.0,  0.0, 0.25},
			{ 0.0, 10.0, 0.25}},
			"3 - 45-45-90 triangle",
		3,{	{ 0.0,  0.0, 0.25},
			{ 5.0,  0.0, 0.25},
			{ 0.0,  8.6, 0.25}},
			"3 - skew triangle",
		4,{	{ 0.0,  0.0, 0.25},
			{10.0,  0.0, 0.25},
			{15.0,  8.7, 0.25},
			{ 5.0,  8.7, 0.25}},
			"4 - rhombus",
		4,{	{ 0.0,  0.0, 0.25},
			{30.0,  0.0, 0.25},
			{20.0, 10.0, 0.25},
			{10.0, 10.0, 0.25}},
			"4 - 45 degree trapezoid",
		4,{	{ 0.0,  0.0, 0.25},
			{20.0,  0.0, 0.25},
			{15.0,  8.6, 0.25},
			{ 5.0,  8.6, 0.25}},
			"4 - 60 degree trapezoid",
		5,{	{ 0.0,  0.0, 0.25},
			{10.0,  0.0, 0.25},
			{10.0,  5.0, 0.25},
			{ 5.0, 10.0, 0.25},
			{ 0.0, 10.0, 0.25}},
			"5 - snub square",
		5,{	{ 0.0,  0.0, 0.5},
			{10.0,  0.0, 0.5},
			{10.0, 10.0, 0.5},
			{ 5.0, 15.0, 0.5},
			{ 0.0, 10.0, 0.5}},
			"5 - 45 gable house",
		5,{	{ 0.0,  0.0, 0.5},
			{10.0,  0.0, 0.5},
			{10.0, 10.0, 0.5},
			{ 5.0, 18.6, 0.5},
			{ 0.0, 10.0, 0.5}},
			"5 - 60 gable house",
		6,{	{ 0.0,  0.0, 0.5},
			{30.0,  0.0, 0.5},
			{30.0, 10.0, 0.5},
			{20.0, 20.0, 0.5},
			{10.0, 20.0, 0.5},
			{ 0.0, 10.0, 0.5}},
			"6 - barn",
		};
			
double high, wide;
double eks, wye, angle, alpha;
double exoff=0.0, wyoff=0.0;
extern double r_dblpar;
double polystack[HMAX][PMAX][3];
double pointbase[PMAX][3],edgebase[PMAX][3];
double pointtraj[PMAX][3],edgetraj[PMAX][3];
double pointsnow[PMAX][3],edgesnow[PMAX][3];
double pointinit[3][3]={{0.0,0.0,1.0}, {0.0,10.0,1.0}, {10.0,0.0,1.0}};
double halftr[3][3]={	{ 0.0,  0.0, 0.25},
			{ 5.0,  0.0, 0.25},
			{ 0.0,  8.6, 0.25}};
double isosrt[3][3]={	{ 0.0,  0.0, 0.25},
			{10.0,  0.0, 0.25},
			{ 0.0, 10.0, 0.25}};
double rhombos[4][3]={	{ 0.0,  0.0, 0.25},
			{10.0,  0.0, 0.25},
			{12.0, 08.0, 0.25},
			{ 5.0,  7.0, 0.25}};
double rhombus[4][3]={	{ 0.0,  0.0, 0.25},
			{10.0,  0.0, 0.25},
			{15.0,  8.7, 0.25},
			{ 5.0,  8.7, 0.25}};
double snubsq[5][3]={	{ 0.0,  0.0, 0.25},
			{10.0,  0.0, 0.25},
			{10.0,  5.0, 0.25},
			{ 5.0, 10.0, 0.25},
			{ 0.0, 10.0, 0.25}};



Microcomputadoras
2000-09-28