Ejemplo n.º 1
0
mininode_geometry_band::mininode_geometry_band(const minidyna<miniv3d> &pos,const minidyna<miniv3d> &nrm,const minidyna<miniv3d> &col,const minidyna<double> &width)
   : mininode_geometry(3,3,0,0,0,0)
   {
   if (pos.getsize()<2) return;
   if (pos.getsize()!=nrm.getsize()) return;
   if (pos.getsize()!=col.getsize()) return;
   if (pos.getsize()!=width.getsize()) return;

   for (unsigned int i=0; i<pos.getsize(); i++)
      {
      miniv3d dir;

      if (i==0) dir=pos[i+1]-pos[i];
      else if (i==pos.getsize()-1) dir=pos[i]-pos[i-1];
      else dir=get_halfdir(pos[i]-pos[i-1],pos[i+1]-pos[i]);
      dir.normalize();

      miniv3d right=dir/nrm[i];
      right.normalize();

      setnrm(nrm[i]);
      setcol(col[i]);
      addvtx(pos[i]-right*width[i]/2);
      addvtx(pos[i]+right*width[i]/2);
      }
   }
Ejemplo n.º 2
0
void iLine::delete_char()
      {
      if (eol())
            return;
      l->delete_char(col);
      setcol(col);
      }
Ejemplo n.º 3
0
void iLine::decr()
      {
      if (col == 0)
            return;
      --col;
      setcol(col);
      }
Ejemplo n.º 4
0
void main(void){
	FXCGinitTerminal
	puts("This is a demonstration of the Fxcg termianl emulator");
	puts("The goal is xterm compatibility");
	puts("This demo shows off the color and cursor features that are currently implemented");
	int key;
	GetKey(&key);
	puts("\f\0337Saved cursor");
	puts("Press any key to continue");
	GetKey(&key);
	puts("\0338Cursor restored");
	GetKey(&key);
	putchar('\f');
	puts("Colors 30-37 and 40-47");
	int i;
	for(i=40;i<=47;++i){
		setcol(i);
		putchar(' ');
	}
	putchar('\n');
	for(i=0;i<=7;++i){
		setcol((7-i)+30);
		setcol(i+40);
		putchar(ColorfulMessage[i]);
	}
	puts("\x9bm");
	GetKey(&key);
	for(i=0;i<16;++i)
		fputs(stdout,"\x9b""A");
	putchar('\f');
	setcol(0);
	puts("\x9b""30m\x9b""47mBlack\x9b""0m");
	puts("\x9b""31mRed");
	puts("\x9b""32mGreen");
	puts("\x9b""33mYellow");
	puts("\x9b""34mBlue");
	puts("\x9b""35mMagenta");
	puts("\x9b""36mCyan");
	puts("\x9b""37mWhite");
	puts("\x9b""39mDefault");
	puts("Press the menu key to exit");
	while(1)
		GetKey(&key);
}
Ejemplo n.º 5
0
Archivo: ul.c Proyecto: Romutk/lab3.2n
void fwd(void)
{
	int oldcol, oldmax;

	oldcol = col;
	oldmax = maxcol;
	flushln();
	setcol(oldcol);
	maxcol = oldmax;
}
Ejemplo n.º 6
0
Archivo: ul.c Proyecto: Romutk/lab3.2n
void initbuf(void)
{
	if (obuf == NULL) {	/* First time. */
		obuflen = INITBUF;
		obuf = xmalloc(sizeof(struct CHAR) * obuflen);
	}

	/* assumes NORMAL == 0 */
	memset(obuf, 0, sizeof(struct CHAR) * obuflen);
	setcol(0);
	maxcol = 0;
	mode &= ALTSET;
}
Ejemplo n.º 7
0
/* Wiggle plot subroutine for vertical plotting */
void wigplot(float *dataptr, int nt, int ntr)
{
	float scalet;		/* time axis scale			*/
	float scalex;		/* trace axis scale			*/
	float sizet;		/* length of t-axis (inches)		*/
	float sizex;		/* length of x-axis (inches)		*/
	float zerot;		/* base of plot to bot. of screen	*/
	float zerox;		/* left of plot to left of screen	*/
	int fill;		/* fill flag				*/
	float overlap;		/* maximum trace overlap		*/
	int plotfat;		/* line thickness of traces		*/
	register int i;		/* counter				*/


	/* Get parameters */
	if (!igetpar("fill", &fill))		fill = FILL;

	if (!fgetpar("overlap", &overlap))	overlap = OVERLAP;

	if (!fgetpar("zerot", &zerot))		zerot = ZEROT;
	if (!fgetpar("zerox", &zerox))		zerox = ZEROX;

	if (!fgetpar("sizet", &sizet))		sizet = SIZET;
	if (!fgetpar("sizex", &sizex))		sizex = SIZEX;

	scalet = -sizet/nt;
	scalex = sizex/MAX(ntr, 8);

	if (!igetpar("plotfat", &plotfat))	plotfat = PLOTFAT;

	setscl(scalex, scalet);
	set0(zerox, zerot + sizet);

	/* Draw wiggle traces */
	setcol(RED);  
	setfat(plotfat);
	setscl(scalex*overlap, scalet);
	for (i = 0; i < ntr; i++) {
		setu0(-(float) i / overlap, 0.0);
		vertwig(dataptr + nt*i, nt, fill);
	}
}
Ejemplo n.º 8
0
yellow()	{setcol(YELLOW);}
Ejemplo n.º 9
0
orange()	{setcol(ORANGE);}
Ejemplo n.º 10
0
skyblue()	{setcol(SKYBLUE);}
Ejemplo n.º 11
0
purple()	{setcol(PURPLE);}
Ejemplo n.º 12
0
green()		{setcol(GREEN);}
Ejemplo n.º 13
0
blue()		{setcol(BLUE);}
Ejemplo n.º 14
0
white()		{setcol(WHITE);}
Ejemplo n.º 15
0
//_________________________________(SINGLE) CUBE
void mycube(int pic,float siz,float x,float y,float z,int d,int f,int u,int b,int r,int l)
{
    siz/=2;
    glPushMatrix();

    if(yro[pic])
        glRotatef(ang*di,0.0,1.0,0.0);
    if(xro[pic])
        glRotatef(ang*di,1.0,0.0,0.0);
    if(zro[pic])
        glRotatef(ang*di,0.0,0.0,1.0);
    //glScalef(ang/15,ang/15,ang/15);
    //glPopMatrix();
    //glPushMatrix();
    glTranslatef(x,y,z);

    glBegin(GL_POLYGON);
    setcol(d);
        glVertex3f(  siz, -siz,  siz );
        glVertex3f(  siz, -siz, -siz );
        glVertex3f( -siz, -siz, -siz );
        glVertex3f( -siz, -siz,  siz );
    glEnd();

    glBegin(GL_POLYGON);
    setcol(b);
        glVertex3f(  siz,  siz,  siz );
        glVertex3f(  siz, -siz,  siz );
        glVertex3f( -siz, -siz,  siz );
        glVertex3f( -siz,  siz,  siz );
    glEnd();

    glBegin(GL_POLYGON);
    setcol(u);
        glVertex3f(  siz,  siz,  siz );
        glVertex3f(  siz,  siz, -siz );
        glVertex3f( -siz,  siz, -siz );
        glVertex3f( -siz,  siz,  siz );
    glEnd();

    glBegin(GL_POLYGON);
    setcol(f);
        glVertex3f(  siz,  siz,  -siz );
        glVertex3f(  siz, -siz,  -siz );
        glVertex3f( -siz, -siz,  -siz );
        glVertex3f( -siz,  siz,  -siz );
    glEnd();

    glBegin(GL_POLYGON);
    setcol(r);
        glVertex3f(  siz,  siz,  siz );
        glVertex3f(  siz, -siz,  siz );
        glVertex3f(  siz, -siz, -siz );
        glVertex3f(  siz,  siz, -siz );
    glEnd();

    glBegin(GL_POLYGON);
    setcol(l);
        glVertex3f( -siz,  siz,  siz );
        glVertex3f( -siz, -siz,  siz );
        glVertex3f( -siz, -siz, -siz );
        glVertex3f( -siz,  siz, -siz );
    glEnd();

    glPopMatrix();
}
Ejemplo n.º 16
0
Colour::Colour(void)
{
	setcol(0.0);
}
Ejemplo n.º 17
0
void iLine::insert_char(QChar c)
      {
      l->insert_char(col, c);
      setcol(col);
      }
Ejemplo n.º 18
0
Colour::Colour(const double val)
{
	setcol(val);
}
Ejemplo n.º 19
0
 void blackwhite()
 {
     setcol(eku::black, eku::white);
 }
Ejemplo n.º 20
0
Archivo: ul.c Proyecto: Romutk/lab3.2n
void filter(FILE *f)
{
	wint_t c;
	int i, w;

	while ((c = getwc(f)) != WEOF) switch(c) {

	case '\b':
		setcol(col - 1);
		continue;

	case '\t':
		setcol((col+8) & ~07);
		continue;

	case '\r':
		setcol(0);
		continue;

	case SO:
		mode |= ALTSET;
		continue;

	case SI:
		mode &= ~ALTSET;
		continue;

	case IESC:
		switch (c = getwc(f)) {

		case HREV:
			if (halfpos == 0) {
				mode |= SUPERSC;
				halfpos--;
			} else if (halfpos > 0) {
				mode &= ~SUBSC;
				halfpos--;
			} else {
				halfpos = 0;
				reverse();
			}
			continue;

		case HFWD:
			if (halfpos == 0) {
				mode |= SUBSC;
				halfpos++;
			} else if (halfpos < 0) {
				mode &= ~SUPERSC;
				halfpos++;
			} else {
				halfpos = 0;
				fwd();
			}
			continue;

		case FREV:
			reverse();
			continue;

		default:
			errx(EXIT_FAILURE,
				_("unknown escape sequence in input: %o, %o"),
				IESC, c);
			break;
		}
		continue;

	case '_':
		if (obuf[col].c_char || obuf[col].c_width < 0) {
			while(col > 0 && obuf[col].c_width < 0)
				col--;
			w = obuf[col].c_width;
			for (i = 0; i < w; i++)
				obuf[col++].c_mode |= UNDERL | mode;
			setcol(col);
			continue;
		}
		obuf[col].c_char = '_';
		obuf[col].c_width = 1;
		/* fall through */
	case ' ':
		setcol(col + 1);
		continue;

	case '\n':
		flushln();
		continue;

	case '\f':
		flushln();
		putwchar('\f');
		continue;

	default:
		if (!iswprint(c))	/* non printing */
			continue;
		w = wcwidth(c);
		needcol(col + w);
		if (obuf[col].c_char == '\0') {
			obuf[col].c_char = c;
			for (i = 0; i < w; i++)
				obuf[col+i].c_mode = mode;
			obuf[col].c_width = w;
			for (i = 1; i < w; i++)
				obuf[col+i].c_width = -1;
		} else if (obuf[col].c_char == '_') {
			obuf[col].c_char = c;
			for (i = 0; i < w; i++)
				obuf[col+i].c_mode |= UNDERL|mode;
			obuf[col].c_width = w;
			for (i = 1; i < w; i++)
				obuf[col+i].c_width = -1;
		} else if (obuf[col].c_char == c) {
			for (i = 0; i < w; i++)
				obuf[col+i].c_mode |= BOLD|mode;
		} else {
			w = obuf[col].c_width;
			for (i = 0; i < w; i++)
				obuf[col+i].c_mode = mode;
		}
		setcol(col + w);
		continue;
	}
	if (maxcol)
		flushln();
}
Ejemplo n.º 21
0
void setcursor(int posx, int posy)
{
	setrow(posy);
	setcol(posx);
}
Ejemplo n.º 22
0
red()		{setcol(RED);}
Ejemplo n.º 23
0
static void eblock_accept_notify_proc(Widget, XtPointer, XtPointer)
{
    int i = 0;
    char buf[256];
    int setno, graphno;
    int cx, cy, c1 = 0, c2 = 0, c3 = 0, c4 = 0; //d1,
    double *tx, *ty, *t2, *t3, *t4, *t5;

    //d1 = (int) GetChoice(eblock_type_choice_item);
    cx = (int)GetChoice(eblock_x_choice_item) - 1;
    cy = (int)GetChoice(eblock_y_choice_item);
    if (cx >= 0 && cx >= blockncols)
    {
        errwin("Column for X exceeds the number of columns in block data");
        return;
    }
    if (cy >= blockncols)
    {
        errwin("Column for Y exceeds the number of columns in block data");
        return;
    }
    switch (block_curtype)
    {
    case XY:
        break;
    case XYRT:
    case XYDX:
    case XYDY:
    case XYZ:
        c1 = (int)GetChoice(eblock_e1_choice_item);
        if (c1 >= blockncols)
        {
            errwin("Column for E1 exceeds the number of columns in block data");
            return;
        }
        break;
    case XYDXDX:
    case XYDYDY:
    case XYDXDY:
        c1 = (int)GetChoice(eblock_e1_choice_item);
        c2 = (int)GetChoice(eblock_e2_choice_item);
        if (c1 >= blockncols)
        {
            errwin("Column for E1 exceeds the number of columns in block data");
            return;
        }
        if (c2 >= blockncols)
        {
            errwin("Column for E2 exceeds the number of columns in block data");
            return;
        }
        break;
    case XYHILO:
    case XYBOX:
        c1 = (int)GetChoice(eblock_e1_choice_item);
        c2 = (int)GetChoice(eblock_e2_choice_item);
        c3 = (int)GetChoice(eblock_e3_choice_item);
        if (c1 >= blockncols)
        {
            errwin("Column for E1 exceeds the number of columns in block data");
            return;
        }
        if (c2 >= blockncols)
        {
            errwin("Column for E2 exceeds the number of columns in block data");
            return;
        }
        if (c3 >= blockncols)
        {
            errwin("Column for E3 exceeds the number of columns in block data");
            return;
        }
        break;
    case XYBOXPLOT:
        c1 = (int)GetChoice(eblock_e1_choice_item);
        c2 = (int)GetChoice(eblock_e2_choice_item);
        c3 = (int)GetChoice(eblock_e3_choice_item);
        c4 = (int)GetChoice(eblock_e4_choice_item);
        if (c1 >= blockncols)
        {
            errwin("Column for E1 exceeds the number of columns in block data");
            return;
        }
        if (c2 >= blockncols)
        {
            errwin("Column for E2 exceeds the number of columns in block data");
            return;
        }
        if (c3 >= blockncols)
        {
            errwin("Column for E3 exceeds the number of columns in block data");
            return;
        }
        if (c4 >= blockncols)
        {
            errwin("Column for E4 exceeds the number of columns in block data");
            return;
        }
    }
    setno = -1;
    graphno = (int)GetChoice(eblock_graph_choice_item) - 1;

    if (graphno == -1)
    {
        graphno = cg;
    }
    if (setno == -1)
    {
        setno = nextset(graphno);
    }
    if (setno == -1)
    {
        return;
    }
    if (g[graphno].active == OFF)
    {
        set_graph_active(graphno);
    }
    activateset(graphno, setno);
    settype(graphno, setno, block_curtype);

    tx = (double *)calloc(blocklen, sizeof(double));
    if (tx == NULL)
    {
        errwin("Can't allocate memory for X");
        return;
    }
    ty = (double *)calloc(blocklen, sizeof(double));
    if (ty == NULL)
    {
        cfree(tx);
        errwin("Can't allocate memory for Y");
        return;
    }
    for (i = 0; i < blocklen; i++)
    {
        if (cx == -1)
        {
            tx[i] = i + 1;
        }
        else
        {
            tx[i] = blockdata[cx][i];
        }
        ty[i] = blockdata[cy][i];
    }
    setcol(graphno, tx, setno, blocklen, 0);
    setcol(graphno, ty, setno, blocklen, 1);

    switch (block_curtype)
    {
    case XY:
        sprintf(buf, "Cols %d %d", cx + 1, cy + 1);
        break;
    case XYRT:
    case XYDX:
    case XYDY:
    case XYZ:
        sprintf(buf, "Cols %d %d %d", cx + 1, cy + 1, c1 + 1);
        t2 = (double *)calloc(blocklen, sizeof(double));
        for (i = 0; i < blocklen; i++)
        {
            t2[i] = blockdata[c1][i];
        }
        setcol(graphno, t2, setno, blocklen, 2);
        break;
    case XYDXDX:
    case XYDYDY:
    case XYDXDY:
        sprintf(buf, "Cols %d %d %d %d", cx + 1, cy + 1, c1 + 1, c2 + 1);
        t2 = (double *)calloc(blocklen, sizeof(double));
        t3 = (double *)calloc(blocklen, sizeof(double));
        for (i = 0; i < blocklen; i++)
        {
            t2[i] = blockdata[c1][i];
            t3[i] = blockdata[c2][i];
        }
        setcol(graphno, t2, setno, blocklen, 2);
        setcol(graphno, t3, setno, blocklen, 3);
        break;
    case XYHILO:
    case XYBOX:
        sprintf(buf, "Cols %d %d %d %d %d", cx + 1, cy + 1, c1 + 1, c2 + 1, c3 + 1);
        t2 = (double *)calloc(blocklen, sizeof(double));
        t3 = (double *)calloc(blocklen, sizeof(double));
        t4 = (double *)calloc(blocklen, sizeof(double));
        for (i = 0; i < blocklen; i++)
        {
            t2[i] = blockdata[c1][i];
            t3[i] = blockdata[c2][i];
            t4[i] = blockdata[c3][i];
        }
        setcol(graphno, t2, setno, blocklen, 2);
        setcol(graphno, t3, setno, blocklen, 3);
        setcol(graphno, t4, setno, blocklen, 4);
        break;
    case XYBOXPLOT:
        sprintf(buf, "Cols %d %d %d %d %d %d", cx + 1, cy + 1, c1 + 1, c2 + 1, c3 + 1, c4 + 1);
        t2 = (double *)calloc(blocklen, sizeof(double));
        t3 = (double *)calloc(blocklen, sizeof(double));
        t4 = (double *)calloc(blocklen, sizeof(double));
        t5 = (double *)calloc(blocklen, sizeof(double));
        for (i = 0; i < blocklen; i++)
        {
            t2[i] = blockdata[c1][i];
            t3[i] = blockdata[c2][i];
            t4[i] = blockdata[c3][i];
            t5[i] = blockdata[c4][i];
        }
        setcol(graphno, t2, setno, blocklen, 2);
        setcol(graphno, t3, setno, blocklen, 3);
        setcol(graphno, t4, setno, blocklen, 4);
        setcol(graphno, t5, setno, blocklen, 5);
        break;
    }

    setcomment(graphno, setno, buf);
    updatesetminmax(graphno, setno);
    update_status_popup(NULL, NULL, NULL);
    drawgraph();
}
Ejemplo n.º 24
0
void subplot(float *data, int nt, int nx, string title,
	string label1, string label2, float truemax, float max)
{
	int i,plotfat,axisfat,dtict,ntict,nticx;
	float sizet,sizex,scalet,scalex,zerot,zerox,margint,marginx,dticx;
	float dash,gap,truedticx,xmin,dx;
	int titlsz,lablsz,ticsz,hcopy,dashflag;
	char tval[8];		/* tic value string			*/

	zerot = 0.5;		fgetpar("zerox",&zerot);
	zerox = 1.0;		fgetpar("zeroy",&zerox);

	sizet = 8.0;		fgetpar("sizex",&sizet);
	sizex = 5.0;		fgetpar("sizey",&sizex);

	dashflag = 0; 		igetpar("dash",&dashflag);

	nticx = 1; 		igetpar("nticy",&nticx);
	ntict = 5;		fgetpar("nticx",&ntict);

	dtict = nt/ntict;
	if (dtict>10) dtict -= dtict%10;
	igetpar("dticx",&dtict);

	margint = 0.01;		fgetpar("marginx",&margint);
	marginx = 0.04;		fgetpar("marginy",&marginx);

	ticsz = 3;		igetpar("ticsz",&ticsz);

	hcopy = 0;		igetpar("hcopy",&hcopy);
	if ( hcopy == 1 ) {
		sizet=4.5; 
		sizex=3.5;
		ticsz=2;
	}

	scalet = sizet/nt;	
	scalex = 0.5*sizex;
	setscl(scalet,scalex);
	set0(zerot, zerox + 0.5*sizex );
	setfat(axisfat);


	/* ZERO LINE*/
	setcol(3);  
	umove( 0.0,         0.0 );
	udraw( (float)nt,   0.0 );

	/* Amplitude tics */

	dticx = max/nticx;
	truedticx = truemax/nticx;

	
	for ( i = -nticx ; i <= nticx ; i++ ) {
		umove( (float)nt , i*dticx  / max );
		udraw( (1.0 + margint) * nt, i*dticx / max ); 
		sprintf( tval, "%.3g", i*truedticx );
		utext( (1.0 + 2*margint) * nt, i*dticx / max , ticsz, 0, tval);
	}


	/* DRAW N2 WIGGLE TRACES */
	for ( i = 0 ; i < nx ; i++ ) {
		if ( dashflag ) {
			dash = ( i % 6 ) * .05;
			gap = dash;
			if ( dash ) {
				setdash(dash,gap,dash,gap);
			}
		}
	 	setcol(6 - i % 6); 
		wgl1( data + nt*i, nt); 
	}
}
Ejemplo n.º 25
0
black()		{setcol(BLACK);}
Ejemplo n.º 26
0
iLine::iLine(Line* line, int spalte)
      {
      l = line;
      setcol(spalte);
      }