Logo Search packages:      
Sourcecode: inkscape version File versions

int FloatLigne::AddBordR ( float  spos,
float  sval,
float  epos,
float  eval,
float  pente,
int  guess = -1 
)

Add a coverage portion.

Parameters:
guess Position from where we should try to insert the last boundary, or -1 if we don't have a clue.

Definition at line 178 of file float-line.cpp.

References bords, float_ligne_bord::other, float_ligne_bord::pente, float_ligne_bord::pos, float_ligne_bord::s_next, float_ligne_bord::s_prev, float_ligne_bord::start, and float_ligne_bord::val.

{
//  if ( showCopy ) printf("br= %f %f -> %f %f \n",spos,sval,epos,eval);
//    return AddBord(spos,sval,epos,eval,pente,guess);
    if ( spos >= epos ){
        return -1;
    }
    
#ifdef faster_flatten
    if ( std::abs(epos - spos) < 0.001 || std::abs(pente) > 1000 ) {
        return -1;
        epos = spos;
        pente = 0;
    }
#endif

    if ( guess >= int(bords.size()) ) {
        guess=-1;
    }

    float_ligne_bord b;
    int n = bords.size();
    b.pos = spos;
    b.val = sval;
    b.start = true;
    b.other = n + 1;
    b.pente = pente;
    b.s_prev = b.s_next = -1;
    bords.push_back(b);
    
    n = bords.size();
    b.pos = epos;
    b.val = eval;
    b.start = false;
    b.other = n - 1;
    b.pente = pente;
    b.s_prev = b.s_next = -1;
    bords.push_back(b);
    
    InsertBord(n, epos, guess);
    InsertBord(n - 1, spos, n);
    
/*    if ( bords[n].s_prev < 0 ) {
            bords[n-1].s_prev=-1;
            s_first=n-1;

            bords[n-1].s_next=n;
            bords[n].s_prev=n-1;
      } else if ( bords[bords[n].s_prev].pos <= spos ) {
            bords[n-1].s_prev=bords[n].s_prev;
            bords[bords[n-1].s_prev].s_next=n-1;

            bords[n-1].s_next=n;
            bords[n].s_prev=n-1;
      } else {
            int c=bords[bords[n].s_prev].s_prev;
            while ( c >= 0 && bords[c].pos > spos ) c=bords[c].s_prev;
            if ( c < 0 ) {
                  bords[n-1].s_next=s_first;
                  bords[s_first].s_prev=n-1;
                  s_first=n-1;
            } else {
                  bords[n-1].s_next=bords[c].s_next;
                  bords[bords[n-1].s_next].s_prev=n-1;

                  bords[n-1].s_prev=c;
                  bords[c].s_next=n-1;
            }
            
                }*/
    return n - 1;
}


Generated by  Doxygen 1.6.0   Back to index