本文整理汇总了C++中RED函数的典型用法代码示例。如果您正苦于以下问题:C++ RED函数的具体用法?C++ RED怎么用?C++ RED使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RED函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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); }
示例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;
}
示例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;
}
示例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);
}
示例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 ();
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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); }
示例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);
}
示例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;
}
示例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;
}
示例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);
}