示例#1
0
void fsvtkToolpathMapper::DrawFibre(S1& fib, I1& wrg, double z)
{
    glBegin(GL_LINE_STRIP);
    for (int i = 0; i < fib.size(); i++)
    {
        if ((i % 2) == 0)
        {
            glEnd();
            glBegin(GL_LINE_STRIP);
        }
        //P2 p = ((fib.value_type == 1) ? P2(fib[i].w, fib.wp) : P2(fib.wp, fib[i].w));
        P2 p = ((fib.ftype == 2) ? P2(fib[i].w, fib.wp) : P2(fib.wp, fib[i].w));
        glVertex3d(p.u, p.v, z);
    }

    glEnd();
}
示例#2
0
//////////////////////////////////////////////////////////////////////
// we have some const_casts here so we can get at the 
bool AddBoundListMatches(vector< pair<int, B1*> >& boundlist, const S1& fw, const I1& rg, int edgno, bool bGoingDown, bool bStartIn) 
{
    ASSERT(((edgno & 2) != 0) == bGoingDown);
    pair<int, int> ilr = fw.Loclohi(rg);
    
    // pull-back from any boundaries that just cross.
    if ((ilr.first <= ilr.second) && fw[ilr.first].blower && (fw[ilr.first].w == rg.lo))
        ilr.first++;
    if ((ilr.first <= ilr.second) && !fw[ilr.second].blower && (fw[ilr.second].w == rg.hi))
        ilr.second--;
        
    // deal with the inside/outside info
    ASSERT(fw.empty() || fw.front().blower);
    ASSERT(fw.empty() || !fw.back().blower);
    bool bLeftIn = (ilr.first == 0 ? false : fw[ilr.first - 1].blower);
    bool bRightIn = (ilr.second == (int)(fw.size()) - 1 ? false : !fw[ilr.second + 1].blower);
    ASSERT(bStartIn == (bGoingDown ? bRightIn : bLeftIn));
    bool bEndIn = (bGoingDown ? bLeftIn : bRightIn);

    // feed in the indexes of the entries
    if (!bGoingDown)
    {
        for (int i = ilr.first; i <= ilr.second; i++)
        {
            boundlist.push_back(pair<int, B1*>(edgno, const_cast<B1*>(&(fw[i]))));
            ASSERT(rg.Contains(fw[i].w));
        }
    }
    else
    {
        for (int i = ilr.second; i >= ilr.first; i--)
        {
            boundlist.push_back(pair<int, B1*>(edgno, const_cast<B1*>(&(fw[i]))));
            ASSERT(rg.Contains(fw[i].w));
        }
    }

    return bEndIn;
}