• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ RED函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中RED函数的典型用法代码示例。如果您正苦于以下问题:C++ RED函数的具体用法?C++ RED怎么用?C++ RED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RED函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: HAC_CONS

Word HAC_CONS(Word c, Word P)
{
  Word r,P_r,n,i,M,L,k,m,T,p,cp,I;

Step1: /* Construct empty multiplicity vector. */
  r = LELTI(c,LEVEL);
  P_r = LELTI(P,r);
  n = LENGTH(P_r);
  for(i = 0, M = NIL; i < n; i++)
    M = COMP(0,M);

Step2: /* Set non-zero entries from cells multiplicity list. */
  for(L = LELTI(c,MULSUB); L != NIL; L = RED(L)) {
    FIRST2(FIRST(L),&k,&m);

    /*-- Find p, the p.f. with index k. --*/
    for(T = P_r, i = 1; T != NIL; T = RED(T),i++) {
      p = FIRST(T);
      if (k == THIRD(LELTI(p,PO_LABEL)))
	break; }

    /*-- Proj.fac. with index k has been removed from the set. --*/
    if (T == NIL) continue;

    SLELTI(M,i,m); }

Return: /* Construct cp and return. */
  I = LELTI(c,INDX);
  cp = LIST2(I,M); 
  return cp;
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:31,代码来源:HAC_CONS.c


示例2: comp1

static Word comp1(Word a,Word b) {
  Word A,B,t;
  A = RED(a); B = RED(b); t = 0;
  while ( t == 0 && A != NIL ) {
    t = BDCOMP(FIRST(A),FIRST(B));
    A = RED(A); B = RED(B); }
  return (t); }
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:7,代码来源:MINPFSETNSC.c


示例3: ESPCADCTPILSNC

/* ESPCAD cell triple and polynomial index list of strong necessary conditions. */
Word ESPCADCTPILSNC(Word c1,Word c2, Word c3, Word i, Word j,Word k, Word P)
{
  Word Lt,Lf,C,c,A,tt,tf,L,Lp,Ls;

Step1: /* Classify cells as true or false. */
  C = LIST3(c1,c2,c3);
  for(Lt = NIL, Lf = NIL; C != NIL; C = RED(C)) {
    c = FIRST(C);
    switch(LELTI(c,SC_TMPM)) {
    case TRUE:  Lt = COMP(c,Lt); break;
    case FALSE: Lf = COMP(c,Lf); break;
    default: break; } }

Step2: /* Need a true cell and a false cell to continue. */
  if (Lt == NIL || Lf == NIL) {
    L = NIL;
    goto Return; }

Step3: /* Weed out conditions that are not strong & necessary. */
  Ls = FMAAFPIRN(i,j,k);
  for(L = NIL; Ls != NIL; Ls = RED(Ls)) {
    A = FIRST(Ls);
    for(tt = 1, Lp = Lt; tt && Lp != NIL; Lp = RED(Lp))
      tt = FMACELLEVAL(A,FIRST(Lp),P);
    for(tf = 1, Lp = Lf; tf && Lp != NIL; Lp = RED(Lp))
      tf = FMACELLEVAL(A,FIRST(Lp),P);
    if (tt && !tf)
      L = COMP(A,L); }

Return: /* */
  return L;
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:33,代码来源:ESPCADLSNC.c


示例4: VECTOR_LTEQ

Word VECTOR_LTEQ(Word u, Word v)
{
  for(; u != NIL; u = RED(u), v = RED(v))
    if (FIRST(u) > FIRST(v))
      return 0;
  return 1;
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:7,代码来源:VECTOR_LTEQ.c


示例5: compose_over

pixel_t compose_over(pixel_t fg, pixel_t bg)
{
	double mul;
	double mul_cmp;

	double res_a;
	double res_r;
	double res_g;
	double res_b;

	if (ALPHA(bg) == 255) {
		res_a = 1;
		mul = ((double) ALPHA(fg)) / 255.0;
		mul_cmp = 1 - mul;
	} else {
		double fg_a = ((double) ALPHA(fg)) / 255.0;
		double bg_a = ((double) ALPHA(bg)) / 255.0;

		res_a = 1 - (1 - fg_a) * (1 - bg_a);
		mul = fg_a / res_a;
		mul_cmp = 1 - mul;
	}

	res_r = mul * ((double) RED(fg)) + mul_cmp * ((double) RED(bg));
	res_g = mul * ((double) GREEN(fg)) + mul_cmp * ((double) GREEN(bg));
	res_b = mul * ((double) BLUE(fg)) + mul_cmp * ((double) BLUE(bg));

	return PIXEL((unsigned) (res_a * 255),
	    (unsigned) res_r, (unsigned) res_g, (unsigned) res_b);
}
开发者ID:jvesely,项目名称:helenos,代码行数:30,代码来源:compose.c


示例6: glEnable

void PointSet::Draw ( float* view_mat, float rad )
{
	char* dat;
	Point* p;
	glEnable ( GL_NORMALIZE );	

	if ( m_Param[PNT_DRAWMODE] == 0 ) {
		glLoadMatrixf ( view_mat );
		dat = mBuf[0].data;	
		for (int n = 0; n < NumPoints(); n++) {
			p = (Point*) dat;
			glPushMatrix ();
			glTranslatef ( p->pos.x, p->pos.y, p->pos.z );		
			glScalef ( 0.2, 0.2, 0.2 );	
			if(p->type == 0)
			glColor4f ( 0.1,0.3,1.0,1.0 );//glColor4f ( RED(p->clr), GRN(p->clr), BLUE(p->clr), ALPH(p->clr) );
			else
            glColor4f ( RED(p->clr), GRN(p->clr), BLUE(p->clr), 0.0 );
			drawSphere ();
			glPopMatrix ();		
			dat += mBuf[0].stride;
		}	
	} else if ( m_Param[PNT_DRAWMODE] == 1 ) {
		glLoadMatrixf ( view_mat );
		dat = mBuf[0].data;
		glBegin ( GL_POINTS );
		for (int n=0; n < NumPoints(); n++) {
			p = (Point*) dat;
			glColor3f ( RED(p->clr), GRN(p->clr), BLUE(p->clr) );			
			glVertex3f ( p->pos.x, p->pos.y, p->pos.z );			
			dat += mBuf[0].stride;
		}
		glEnd ();
	}
}
开发者ID:lakshmiboorgu,项目名称:SPH_Simulation,代码行数:35,代码来源:point_set.cpp


示例7: CINV

Word QepcadCls::ACCCVBCR(Word k, Word c, Word B1, Word b, Word* B1h)
{
  Word d, nnf, dV, IV, cp, i, I_i, d_i, c_i, L, Q, Qb, Qbs, F, Fp, a;

Step1: /* Initialization **********************************************/
  a = NIL; /* this is the pseudo-sample point we're building up *******/
  F = NIL; /* Useless now, could be usefull later. ********************/
  d = 0;   /* dimension of cell c_i. **********************************/
  nnf = 0; /* number of variables not fixed. **************************/
  dV = CINV(RED(PDEGV(k+1,B1))); /* vector of degrees of first k ******
				    variables of B1. ******************/
  IV = LELTI(c,INDX);            /* vector of indices of cell c. ******/


Step2: /* Loop over each level from 1 to k ****************************/
  c_i = GVPC;
  for(i = 1; i <= k; i++) {
    I_i = LELTI(IV,i);
    d_i = LELTI(dV,i);
    c_i = LELTI(LELTI(c_i,CHILD),I_i);
    
Step3: /* c_i is a section over a 0-dimensional cell ******************/
    if ((I_i % 2 == 0) && d == 0) {
      a = SUFFIX(a,LELTI(b,i));
      continue; }
    
Step4: /* c_i is a section over a cell of dimension greater than zero */
    if ((I_i % 2 == 0) && d > 0) {
      for(L=SECTIONPOLS(i,c_i,GVPF),Qbs=1,Fp=NIL; L != NIL; L=RED(L)) {
	Q = RPFIP(i,LELTI(FIRST(L),PO_POLY));
	Qb = SPECIALSUBSR(i,a,Q); /* Qb can't be zero, by definition of 
				     SECTIONPOLS */
	Qbs = RPEMV(nnf + 1,Qb,LELTI(b,i));
	if (Qbs == 0) {
	  a = SUFFIX(a,LELTI(b,i));
	  break; }
	else
	  Fp = COMP(Qb,Fp); }
      if (L == NIL) {
	F = CCONC(F,Fp);
	nnf++;
	a = SUFFIX(a,NIL);
      } }
    
Step5: /* c_i is a sector *********************************************/
    if (I_i % 2 == 1) {
      d++;
      nnf++;
      a = SUFFIX(a,NIL); }
  }

/*Step6: a is the psuedo-sample point, check that B1 is univariate at a. */
  bool uniq = true;
  Word B1b = SPECIALSUBSR(k+1,a,RPFIP(k+1,B1));
  for(Word B1s = B1b; uniq && B1s != 0; B1s = PRED(B1s))
    uniq = IPCONST(nnf,PLDCF(B1s));
  if (B1h != 0) *B1h = B1b;

  return uniq ? TRUE : UNDET;
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:60,代码来源:ACCCVBCR.c


示例8: ADJ_2D1

Word ADJ_2D1(Word c, Word c_l, Word P, Word J)
{
  Word U,V,v_l,Sol,S,A,Ap,a,b;
  /*
init();
sa_send("[");
  */
Step1: /* Initialization. */
  v_l = LDCOEFMASK(c,P,J);
  U = AD2DS_CONS(c_l,P);
  V = AD2DS_CONS(c,P);

Step2: /* Get Adjacencies. */
  /* Sol = ADJ_2D1_SIMPLE(U,V,v_l,FIRST(LELTI(c,INDX))); */
  Sol = ADJ_2D1P1(U,V,v_l,FIRST(LELTI(c,INDX)));

Step3: /* If c_l is to the right of c, reverse order of pairs. */
  if (FIRST(LELTI(c,INDX)) < FIRST(LELTI(c_l,INDX))) {
    for(S = NIL; Sol != NIL; Sol = RED(Sol)) {
      for(A = NIL, Ap = FIRST(Sol); Ap != NIL; Ap = RED(Ap)) {
	FIRST2(FIRST(Ap),&a,&b);
	A = COMP(LIST2(b,a),A); }
      S = COMP(A,S); }
    Sol = S; }

Return: /* Prepare to return. */
  /*
  sa_send("]\n");
  uninit();
  */
  return Sol;
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:32,代码来源:ADJ_2D1.c


示例9: PCADCSV

Word PCADCSV(Word cs, Word Ps)
{
      Word c,l,S,s,I,V,Vs;

Step1: /* */
      c = LELTI(cs,SC_REP);
      l = LELTI(c,LEVEL);
      if (l == 0) {
	Vs = NIL; goto Return; }
      S = LELTI(Ps,l);

      for(I = NIL; S != NIL; S = RED(S)) {
	s = FIRST(S);
	I = COMP(THIRD(LELTI(s,PO_LABEL)),I); }

      LBIBMS(I);
      I = CINV(I);

      V = FIRST(LELTI(c,SIGNPF));
      for(Vs = NIL;I != NIL; I = RED(I))
	Vs = COMP(LELTI(V,FIRST(I)),Vs);      

Return: /* Prepare to return. */
      return (Vs);
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:25,代码来源:PCADCSV.c


示例10: CADFPCAD

Word CADFPCAD(Word D, Word P, Word S, Word I, Word Pb)
{
      Word Db,Is,N,Sb,Pb_N,Ts,L,p,i,is,Q,Ms,C,Cs,Ds,Ss;
      Word Mb,mb;

Step1: /* Is D the root cell? */
      Db = LELTI(D,SC_REP);
      if (LELTI(D,SC_PAR) == NIL) {
	Is = NIL;
	Ss = NIL;
	Ms = NIL; }

      else {
Step2: /* D is not the root cell. */
	Is = CINV(COMP(LELTI(D,SC_INX),CINV(I)));
	N = LENGTH(Is);

Step3: /* Signiture & multiplicity information. */
	Sb = FIRST(LELTI(Db,SIGNPF));
	Pb_N = LELTI(Pb,N);
	Ts = NIL; Ms = NIL; is = 0;

 /* Loop over each level N polynomial in P. */
	for(L = CINV(LELTI(P,N)); L != NIL; L = RED(L)) {
	  p = FIRST(L); i = 1; is++;

 /* Set i so that p is the ith level N pol in Pb. */
	  i = PFPIPFL(p,Pb_N);
	  if (i == 0) { SWRITE("CAPFPCAD: Can't find the polynomial!\n"); }
	  Ts = COMP(LELTI(Sb,i),Ts);

 /* Set the multiplicity list if necessary */
	  for (Mb = LELTI(Db,MULSUB); Mb != NIL; Mb = RED(Mb)) {
	    mb = FIRST(Mb);
	    if (FIRST(mb) == THIRD(LELTI(p,PO_LABEL))) {
	      Ms = COMP(mb,Ms); } } }
	/*	Ms = CINV(Ms); */
	Ss = COMP(Ts,S); }

Step4: /* Children. */
	C = LELTI(D,SC_CDTV);
	if ( ISATOM(C) ) {
	  Cs = NIL; }
	else {
	  for(Cs = NIL; C != NIL; C = RED(C)) {
	    Cs = COMP(CADFPCAD(FIRST(C),P,Ss,Is,Pb),Cs); }
	  Cs = CINV(Cs); }

Step5: /*  */
	Ds = LCOPY(Db);
	SLELTI(Ds,CHILD,Cs);
	SLELTI(Ds,INDX,Is);
	SLELTI(Ds,SIGNPF,Ss);
	SLELTI(Ds,HOWTV,NOTDET); /* Might want to change. */
	SLELTI(Ds,MULSUB,Ms);

Return: /* Prepare to return. */
	return (Ds);
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:59,代码来源:CADFPCAD.c


示例11: comp

static Word comp(Word a, Word b) {
      Word ap,bp,t,q;
      ap = a; bp = b;
      t =  BDCOMP(LENGTH(ap),LENGTH(bp));
      while ((t == 0) && (bp != NIL) && (ap != NIL)) { 
	 t = BDCOMP(FIRST(ap),FIRST(bp)); ap = RED(ap); bp = RED(bp); }
      if (t == 0) { t = BDCOMP(ap,bp); }
      return (t); }
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:8,代码来源:MINHITSETSRDR.c


示例12: DOPFSUFF

Word DOPFSUFF(Word P, Word K)
{
      Word t,L,Kp,Lp,T,F,N,Lpp,tp;

Step1: /* Initialize. */
      if (LELTI(FIRST(K),LEVEL) == 0 && LELTI(FIRST(K),CHILD) == NIL) {
	t = LELTI(FIRST(K),TRUTH);
	goto Return; }
      else
	t = NIL;

Step3: /* List cells of level r, sorted by signiture. */
      L = NIL;
      for(Kp = K; Kp != NIL; Kp = RED(Kp)) {
	L = CCONC(LELTI(FIRST(Kp),CHILD),L); }
      L = GMSL(L,comp);

Step4: /* Loop over each block of cells with same signiture. */
      while (L != NIL) {
	Lp = NIL;
	do {
	  Lp = COMP(FIRST(L),Lp);
	  L = RED(L);
	} while (L != NIL && comp(FIRST(Lp),FIRST(L)) == 0);

Step5: /* Get the number of TRUE leaf cells and FALSE leaf cells. */
	T = 0; F = 0; N = 0;
	for(Lpp = Lp; Lpp != NIL; Lpp = RED(Lpp)) {
	  switch( LELTI(FIRST(Lpp),TRUTH) ) {
	  case TRUE : T++; break;
	  case FALSE: F++; break;
	  case NA:    N++; break; } }

Step6: /* Case:  All cells are leaf cells. */
	if (T + F + N == LENGTH(Lp)) {
	  if ( T == 0 && F == 0 ) { tp = NA; goto Step8; }
	  if ( T > 0 && F == 0 )  { tp = TRUE; goto Step8; }
	  if ( F > 0 && T == 0 )  { tp = FALSE; goto Step8; }
	  t = NIL; goto Return; }

Step7: /* Case:  Not all cells are leaf cells. */
	tp = DOPFSUFF(P,Lp);
	if ( ( F == 0 && T == 0 && tp != NIL) ||
	     ( F == 0 && T > 0 && tp == TRUE ) ||
	     ( F > 0 && T == 0 && tp == FALSE ) )
	  goto Step8;
	t = NIL; goto Return;

Step8: /* Set t to the proper value.  t = NIL at this step only if
	  it is the first time through the loop. */
	if (t == NIL || t == NA) 
	  t = tp;
	else if (tp != NA && t != tp)
	  t = UNDET; }

Return: /* Prepare to return. */
      return (t);
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:58,代码来源:DOPFSUFF.c


示例13: VECTOR_SUM

Word VECTOR_SUM(Word u, Word v)
{
  Word s,w;

  for(s = NIL; u != NIL; u = RED(u), v = RED(v))
    s = COMP(FIRST(u) + FIRST(v),s);
  w = INV(s);

  return w;
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:10,代码来源:VECTOR_SUM.c


示例14: LDCOEFMASK

Word LDCOEFMASK(Word c, Word P, Word J)
{
  Word *A,P_2,n,i,M,P_1,L,m,j,p,Lp,h,q,v,l;

Step1: /* Set up A to be a characteristic vector for the set of
level 2 proj fac's whose leading coefficients vanish in c. */
  P_2 = LELTI(P,2);
  n = THIRD(LELTI(LAST(P_2),PO_LABEL));
  A = GETARRAY(n + 1);
  for(i = 1; i <= n; i++)
    A[i] = 0;

Step2: /* Set L to be the list of projection factors which vanish in c. */
  M = LELTI(c,MULSUB);
  P_1 = LELTI(P,1);
  L = NIL;
  while(M != NIL) {
    ADV(M,&m,&M);
    j = FIRST(m); 
    do
      ADV(P_1,&p,&P_1);
    while(j != THIRD(LELTI(p,PO_LABEL)));
    L = COMP(p,L); }

Step3: /* Set Lp to the list of projection polynomials with factors in L. */
  Lp = NIL;
  while(L != NIL) {
    ADV(L,&p,&L);
    for(h = LELTI(p,PO_PARENT); h != NIL; h = RED(h))
      Lp = COMP(THIRD(FIRST(h)),Lp); }

Step4: /* Run through the histories of each polynomial in Lp.  If the 
polynomial is the leading coefficient of some bivariate projection factor,
set A at the index for that projection factor to 1. */
  while(Lp != NIL) {
    ADV(Lp,&p,&Lp);
    for(h = LELTI(p,PO_PARENT); h != NIL; h = RED(h)) {
      q = FIRST(h);
      if (FIRST(q) == PO_LCO) {
	l = LELTI(THIRD(q),PO_LABEL);
	if (SECOND(l) == 2)
	  A[ THIRD(l) ] = 1; } } }

Step5: /* Create the vector itself! */
  v = NIL;
  while(P_2 != NIL) {
    ADV(P_2,&p,&P_2);
    j = THIRD(LELTI(p,PO_LABEL));
    v = COMP(A[j],v); }
  v = INV(v);

Return: /* Prepare to return. */
  FREEARRAY(A);
  return v;
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:55,代码来源:LDCOEFMASK.c


示例15: ALPHA

ColorARGB GifTranscoder::computeAverage(ColorARGB c1, ColorARGB c2, ColorARGB c3, ColorARGB c4) {
    char avgAlpha = (char)(((int) ALPHA(c1) + (int) ALPHA(c2) +
                            (int) ALPHA(c3) + (int) ALPHA(c4)) / 4);
    char avgRed =   (char)(((int) RED(c1) + (int) RED(c2) +
                            (int) RED(c3) + (int) RED(c4)) / 4);
    char avgGreen = (char)(((int) GREEN(c1) + (int) GREEN(c2) +
                            (int) GREEN(c3) + (int) GREEN(c4)) / 4);
    char avgBlue =  (char)(((int) BLUE(c1) + (int) BLUE(c2) +
                            (int) BLUE(c3) + (int) BLUE(c4)) / 4);
    return MAKE_COLOR_ARGB(avgAlpha, avgRed, avgGreen, avgBlue);
}
开发者ID:b-project,项目名称:Messaging,代码行数:11,代码来源:GifTranscoder.cpp


示例16: rb_single

static node_t *
rb_single(node_t *root, int dir)
{
	node_t *save = root->link[!dir];

	root->link[!dir] = save->link[dir];
	save->link[dir] = root;

	RED(root) = 1;
	RED(save) = 0;
	return save;
}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:12,代码来源:ctrees.c


示例17: PT_CopyBlend

internal void
PT_CopyBlend(u32 *destPixels, PT_Rect *destRect, u32 destPixelsPerRow,
             u32 *srcPixels, PT_Rect *srcRect, u32 srcPixelsPerRow,
             u32 *newColor)
{
    // If src and dest rects are not the same size ==> bad things
    assert(destRect->w == srcRect->w && destRect->h == srcRect->h);

    // For each pixel in the destination rect, alpha blend to it the 
    // corresponding pixel in the source rect.
    // ref: https://en.wikipedia.org/wiki/Alpha_compositing

    u32 stopX = destRect->x + destRect->w;
    u32 stopY = destRect->y + destRect->h;

    for (u32 dstY = destRect->y, srcY = srcRect->y; 
         dstY < stopY; 
         dstY++, srcY++) {
        for (u32 dstX = destRect->x, srcX = srcRect->x; 
             dstX < stopX; 
             dstX++, srcX++) {

            u32 srcColor = srcPixels[(srcY * srcPixelsPerRow) + srcX];
            u32 *destPixel = &destPixels[(dstY * destPixelsPerRow) + dstX];
            u32 destColor = *destPixel;

            // Colorize our source pixel before we blend it
            srcColor = PT_ColorizePixel(srcColor, *newColor);

            if (ALPHA(srcColor) == 0) {
                // Source is transparent - so do nothing
                continue;
            } else if (ALPHA(srcColor) == 255) {
                // Just copy the color, no blending necessary
                *destPixel = srcColor;
            } else {
                // Do alpha blending
                float srcA = ALPHA(srcColor) / 255.0;
                float invSrcA = (1.0 - srcA);
                float destA = ALPHA(destColor) / 255.0;

                float outAlpha = srcA + (destA * invSrcA);
                u8 fRed = ((RED(srcColor) * srcA) + (RED(destColor) * destA * invSrcA)) / outAlpha;
                u8 fGreen = ((GREEN(srcColor) * srcA) + (GREEN(destColor) * destA * invSrcA)) / outAlpha;
                u8 fBlue = ((BLUE(srcColor) * srcA) + (BLUE(destColor) * destA * invSrcA)) / outAlpha;
                u8 fAlpha = outAlpha * 255;

                *destPixel = COLOR_FROM_RGBA(fRed, fGreen, fBlue, fAlpha);
            }
        }
    }
}
开发者ID:pdetagyos,项目名称:RoguelikeTutorial,代码行数:52,代码来源:pt_console.c


示例18: GS_TRACE1

/*! Rebalance the tree after insertion of a node. */
void GsTreeBase::_rebalance ( GsTreeNode *x )
 {
   GS_TRACE1("Rebalance");

   GsTreeNode *y;

   while ( x!=_root && RED(x->parent) )
    { // if ( !x->parent->parent ) REPORT_ERROR
      if ( x->parent==x->parent->parent->left )
       { y = x->parent->parent->right;
         if ( RED(y) )
          { // handle case 1 (see CLR book, pp. 269)
            x->parent->color = GsTreeNode::Black;
            y->color = GsTreeNode::Black;
            x->parent->parent->color = GsTreeNode::Red;
            x = x->parent->parent;
          }
         else
          { if ( x==x->parent->right )
             { // transform case 2 into case 3 (see CLR book, pp. 269)
               x = x->parent;
               _rotate_left ( x );
             }
            // handle case 3 (see CLR book, pp. 269)
            x->parent->color = GsTreeNode::Black;
            x->parent->parent->color = GsTreeNode::Red;
            _rotate_right ( x->parent->parent );
          }
       }
      else
       { y = x->parent->parent->left;
         if ( RED(y) )
          { // handle case 1 (see CLR book, pp. 269)
            x->parent->color = GsTreeNode::Black;
            y->color = GsTreeNode::Black;
            x->parent->parent->color = GsTreeNode::Red;
            x = x->parent->parent;
          }
         else
          { if ( x==x->parent->left )
             { // transform case 2 into case 3 (see CLR book, pp. 269)
               x = x->parent;
               _rotate_right ( x );
             }
            // handle case 3 (see CLR book, pp. 269)
            x->parent->color = GsTreeNode::Black;
            x->parent->parent->color = GsTreeNode::Red;
            _rotate_left ( x->parent->parent );
          }
       }
    }
 }
开发者ID:Nic-Bush,项目名称:Computer-Graphics,代码行数:53,代码来源:gs_tree.cpp


示例19: hippo_cairo_set_source_rgba32

void
hippo_cairo_set_source_rgba32(cairo_t *cr,
                              guint32  color)
{
    /* trying to avoid alpha 255 becoming a double alpha that isn't quite opaque ?
     * not sure this is needed.
     */
    if ((color & 0xff) == 0xff) {
        cairo_set_source_rgb(cr, RED(color), GREEN(color), BLUE(color));
    } else {
        cairo_set_source_rgba(cr, RED(color), GREEN(color), BLUE(color), ALPHA(color));
    }
}
开发者ID:manoj-makkuboy,项目名称:magnetism,代码行数:13,代码来源:hippo-canvas.c


示例20: DOPFSUFF_FULLD

Word QepcadCls::SFCFULLDf(Word D, Word P, Word J, Word n)
{
      Word t,SF,Dp,Pp,Lt,Lf,LA,Q,D1,P1,D0,P0,J0,i,Lp,pflag, L;
      char e,s,m,c;

Step1: /* Space is either empty or R^n. */
      t = DOPFSUFF_FULLD(P,LIST1(D));
      if (t == TRUE) {       
        SF = LIST1(TRUE);  /* CAD is identically TRUE. */
        goto Return; }
      else if (t == FALSE) {
        SF = LIST1(FALSE); /* CAD is identically FALSE. */
        goto Return; }

Step2: /* Extended language. */
      /* Dp,Pp are a simplified CAD for D,P (based only on full-dimensional cells!) */
      CCADCONmod(n,P,D,&Pp,&Dp); 
      Dp = PCAD2ESPCAD(P,Pp,Dp,NIL);

      /* Get list of all the true and false cells. */
      LTFOCALWTV(Dp,n,&Lt,&Lf);

      /* Filter out all but the full-dimensional true/false cells. */
      for(L = NIL; Lt != NIL; Lt = RED(Lt))
	if (LELTI(LELTI(FIRST(Lt),SC_REP),LEVEL) == CELLDIM(LELTI(FIRST(Lt),SC_REP)))
	  L = COMP(FIRST(Lt),L);
      Lt = L;
      for(L = NIL; Lf != NIL; Lf = RED(Lf))
	if (LELTI(LELTI(FIRST(Lf),SC_REP),LEVEL) == CELLDIM(LELTI(FIRST(Lf),SC_REP)))
	  L = COMP(FIRST(Lf),L);
      Lf = L;
	

      if (Lt == NIL && Lf == NIL) {
	SWRITE("No cells have truth values!\n");
	goto Return; }
      t = ESPCADDOPFSUFF(Pp,LIST1(Dp));
      LA = LISTOETAmod(Pp,n,t==NIL);

      /* Construct formula */
      SF = NECCONDS(Lt,Lf,LA,Pp); 
      SF = FMASORT(SF);
      SF = FMA_REMCONST(SF);
      SF = FMASMOOTH(SF);
      SF = FMAOPCOMBINE(SF);

 Return: /* Prepare to return. */
      return SF;
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:49,代码来源:SFCFULLDf.c



注:本文中的RED函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ REDEBUG函数代码示例发布时间:2022-05-30
下一篇:
C++ RECVINFO函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap