void cICL_Courbe::AddSeg ( Pt2dr P0, bool isP0OnCerle, Pt2dr P1, bool isP1OnCerle ) { if (pW) { pW->draw_arrow ( ToLoc(P0), ToLoc(P1), Line_St(pW->pdisc()(P8COL::blue),2), Line_St(pW->pdisc()(P8COL::blue),2), 10.0 ); pW->draw_circle_loc ( ToLoc(P0), 5.0, pW->pdisc()(isP0OnCerle?P8COL::yellow : P8COL::green) ); pW->draw_circle_loc ( ToLoc(P1), 5.0, pW->pdisc()(isP1OnCerle?P8COL::yellow : P8COL::green) ); } mVArcs.push_back(cICL_Arc(P0,isP0OnCerle,P1,isP1OnCerle)); }
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; }
void bench_delaunay() { Pt2di sz (950,950); Disc_Pal Pdisc = Disc_Pal::P8COL(); Elise_Set_Of_Palette SOP(NewLElPal(Pdisc)); Video_Display Ecr((char *) NULL); Ecr.load(SOP); Video_Win W (Ecr,SOP,Pt2di(50,50),sz); for (INT nb = 100; nb < 500 ; nb +=50) { std::list<PtDelTest> L; ElFilo<PtDelTest> Pts; for (INT k= 0; k< nb; k++) { PtDelTest pt ( (INT)( 10 + (sz.x -20) * NRrandom3()), (INT)( 10 + (sz.y -20) * NRrandom3()) ); // Pts.pushlast(pt); L.push_back(pt); //W.draw_circle_loc(pt.pt(),4,Pdisc(P8COL::red)); W.draw_circle_loc(Pt2dr(pt.pt()),4,Pdisc(P8COL::red)); // __NEW } DelTestAct Act(W); Delaunay_Mediatrice ( L.begin(), L.end(), Pt_of_DPT, Act, 200.0, (PtDelTest *) 0 ); // W.clik_in(); W.clear(); } }
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); }