std::vector<Pt2dr> cICL_Courbe::GetPoly(INT NbPtsMax,bool ForceLosange)
{
    ELISE_ASSERT(pW!=0,"cICL_Courbe::GetPoly()");
    static bool First = true;
    if (! First)
        pW->clik_in();
    First = false;
    pW->clear();
    pW->draw_circle_loc
    (
        ToLoc(Pt2dr(0,0)),
        mScale,
        pW->pdisc()(P8COL::red)
    );
    std::vector<Pt2dr> aRes;

    while (true)
    {
        Clik aCl = pW->clik_in();
	Pt2dr aP = (Pt2dr(aCl._pt)-mP0) / mScale;

	if (NbPtsMax-1 == INT(aRes.size()))
            aCl._b = 3;

	if (ForceLosange && (aRes.size()==3))
        {
            aP = aRes[0]+ aRes[2] - aRes[1];
            aCl._b = 3;
	}
        pW->draw_circle_loc(ToLoc(aP),3.0,pW->pdisc()(P8COL::green));
        
	 if (! aRes.empty())
            pW->draw_seg(ToLoc(aRes.back()),ToLoc(aP),pW->pdisc()(P8COL::green));

	 aRes.push_back(aP);

	 if (aCl._b == 3)
	 {
            pW->draw_seg(ToLoc(aRes[0]),ToLoc(aP),pW->pdisc()(P8COL::green));
	    return aRes;
	 }
    }
    return aRes;
}
Exemplo n.º 2
0
void cElHJaFacette::ShowCont(INT aCoul,Video_Win aW)
{
    INT aNb = (int) mVPt.size();
    for (INT aK=0 ; aK<aNb ; aK++)
        aW.draw_seg(mVPt[aK],mVPt[(aK+1)%aNb],aW.pdisc()(aCoul));
}
Exemplo n.º 3
0
void cElHJaPlan3D::Show
     (
          Video_Win aW,
          INT       aCoul,
          bool ShowDroite,
          bool ShowInterEmpr
     )
{
    if (aCoul >=0)
       ELISE_COPY(aW.all_pts(),aCoul,aW.ogray());

    Box2dr aBoxW(Pt2dr(0,0),Pt2dr(aW.sz()));
    for (INT aK=0; aK<INT(mVInters.size()) ; aK++)
    {
        cElHJaDroite * aDr =mVInters[aK];
	if (aDr)
	{
            ElSeg3D aSeg = aDr->Droite();
	    Pt3dr aQ0 = aSeg.P0();
	    Pt3dr aQ1 = aSeg.P1();
	    Pt2dr aP0(aQ0.x,aQ0.y);
	    Pt2dr aP1(aQ1.x,aQ1.y);

	    Seg2d aS(aP0,aP1);
            Seg2d aSC = aS.clipDroite(aBoxW);
            if (ShowDroite && (! aSC.empty()))
            {
	       aW.draw_seg(aSC.p0(),aSC.p1(),aW.pdisc()(P8COL::magenta));
            }
	}
    }

    tFullSubGrPl aSGrFul;
    if (ShowInterEmpr)
    {
        for (tItSomGrPl itS=mGr->begin(aSGrFul) ; itS.go_on() ; itS++)
	{
            aW.draw_circle_loc
            (
                (*itS).attr().Pt(),
                4.0,
                aW.pdisc()(P8COL::blue)
            );
	    for (tItArcGrPl itA=(*itS).begin(aSGrFul) ; itA.go_on() ; itA++)
	    {
                 tSomGrPl &s1 = (*itA).s1();
                 tSomGrPl &s2 = (*itA).s2();
		 if (&s1 < &s2)
		 {
                     aW.draw_seg
                     (
                         s1.attr().Pt(),
                         s2.attr().Pt(),
                        aW.pdisc()(P8COL::black)
                     );
		 }
	    }
	}
    }

    // for (INT aK=0 ; aK<INT(mFacOblig.size()) ; aK++)
    //    mFacOblig[aK]->Show(PI/2.0,P8COL::cyan,false);
}