void Data_El_Geom_GWin::draw_seg_cliped ( Pt2dr p0, Pt2dr p1, Data_Line_St * lst, Box2dr box, bool auto_flush ) { if (_dnext) _dnext->draw_seg_cliped(p0,p1,lst,box,auto_flush); Seg2d s = Seg2d(p0,p1).clip(box); if (! s.empty()) draw_seg(s.p0(),s.p1(),lst,auto_flush); }
void Data_El_Geom_GWin::draw_polyl_cliped ( const REAL * x,const REAL *y,INT nb,Box2dr box, Data_Line_St * lst, bool circ, bool auto_flush ) { if (_dnext) _dnext->draw_polyl_cliped(x,y,nb,box,lst,circ,auto_flush); _degw->set_line_style(lst); REAL x0[NB_BUF_DRAW_POLY]; REAL y0[NB_BUF_DRAW_POLY]; REAL x1[NB_BUF_DRAW_POLY]; REAL y1[NB_BUF_DRAW_POLY]; INT nb_buf = 0; for (INT k0 = 0; k0 <nb-1 ;) { INT k1 = k0; while ( (k1<nb-1) && (box.inside(Pt2dr(x[k1],y[k1]))) && (box.inside(Pt2dr(x[k1+1],y[k1+1]))) ) k1 ++; if (k1 > k0) { draw_polyl(x+k0,y+k0,k1-k0+1,lst,false,false); k0 = k1; } else { Seg2d seg = Seg2d(x[k0],y[k0],x[k0+1],y[k0+1]).clip(box); if (! seg.empty()) { Pt2dr p0 = prto_window_geom(seg.p0()); Pt2dr p1 = prto_window_geom(seg.p1()); x0[nb_buf] = p0.x; y0[nb_buf] = p0.y; x1[nb_buf] = p1.x; y1[nb_buf++] = p1.y; } if (nb_buf == NB_BUF_DRAW_POLY) { _degw->_inst_draw_poly_segs(x0,y0,x1,y1,nb_buf); nb_buf = 0; } k0++; } } if (nb_buf) _degw->_inst_draw_poly_segs(x0,y0,x1,y1,nb_buf); if (circ && (nb > 1)) draw_seg_cliped ( Pt2dr(x[nb-1],y[nb-1]), Pt2dr(x[0],y[0]), lst, box, false ); if (auto_flush) _degw->_degd->auto_flush(); }
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); }