Logo Search packages:      
Sourcecode: inkscape version File versions

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

Add a coverage portion.

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

Definition at line 44 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("b= %f %f -> %f %f \n",spos,sval,epos,eval);
    if ( spos >= epos ) {
        return -1;
    }

    float pente = (eval - sval) / (epos - spos);
    
#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;
    }
    
    // add the left boundary
    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);

    // insert it in the doubly-linked list
    InsertBord(n, spos, guess);
    
    // add the right boundary
    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);
    
    // insert it in the doubly-linked list, knowing that boundary at index n-1 is not too far before me
    InsertBord(n, epos, n - 1);
      
    return n;
}


Generated by  Doxygen 1.6.0   Back to index