void Binary_tree_rectangle::draw_lines() const{ if(fill_color().visibility()) { // fill fl_color(fill_color().as_int()); for(int i = 0; i < number_of_points(); ++i) fl_rectf(point(i).x, point(i).y, radius * 2, radius * 2); // ノード(正方形)を描画 fl_color(color().as_int()); // reset color } if(color().visibility()) { fl_color(color().as_int()); int parent = 0; // point(i)に対する親ノードのインデックス for(int i = 0; i < number_of_points(); ++i){ fl_rect(point(i).x, point(i).y, radius * 2, radius * 2); // ノード(正方形)を描画 // エッジ(線)を描画 if(i != 0){ fl_line(point(parent).x + radius, point(parent).y + radius * 2, point(i).x + radius, point(i).y); if(i % 2 == 0) parent++; } } } }
void Closed_polyline::draw_lines() const { Open_polyline::draw_lines(); if (color().visibility()) // draw closing line: fl_line(point(number_of_points()-1).x,point(number_of_points()-1).y,point(0).x,point(0).y); }
void Closed_polyline::draw_lines() const { Open_polyline::draw_lines(); // first draw the "open poly line part" // then draw closing line: if (color().visibility()) fl_line(point(number_of_points()-1).x, point(number_of_points()-1).y, point(0).x, point(0).y); }
void Parallelogram::draw_lines() const { /* if (fill_color().visibility()) { // fill fl_color(fill_color().as_int()); fl_paraf(point(0).tl,point(0).tr,point(0).bl,point(0).br); fl_color(color().as_int()); // reset color } if (color().visibility()) { // lines on top of fill fl_color(color().as_int()); fl_rect(point(0).tl,point(0).tr,point(0).bl,point(0).br); } */ if (fill_color().visibility()) { fl_color(fill_color().as_int()); fl_begin_complex_polygon(); for(int i=0; i<number_of_points(); ++i){ fl_vertex(point(i).x, point(i).y); } fl_end_complex_polygon(); fl_color(color().as_int()); // reset color } if (color().visibility()) Shape::draw_lines(); }
void Lines::draw_lines() const { // if (number_of_points()%2==1) error("odd number of points in set of lines"); if (color().visibility()) for (int i=1; i<number_of_points(); i+=2) fl_line(point(i-1).x,point(i-1).y,point(i).x,point(i).y); }
void Binary_tree_triangle::draw_lines() const { for (int i = 0; i < number_of_points(); ++i) { Regular_polygon tri {point(i), 3, radius()}; tri.draw(); labels[i].draw(); } for (int i = 0; i < lines.size(); ++i) { lines[i].draw(); } }
void Open_polyline::draw_lines() const { if (fill_color().visibility()) { fl_color(fill_color().as_int()); fl_begin_complex_polygon(); for(int i=0; i<number_of_points(); ++i){ fl_vertex(point(i).x, point(i).y); } fl_end_complex_polygon(); fl_color(color().as_int()); // reset color } if (color().visibility()) Shape::draw_lines(); }
void Polygon::add(Point p) { int np = number_of_points(); if (1<np) { // check that thenew line isn't parallel to the previous one if (p==point(np-1)) error("polygon point equal to previous point"); bool parallel; line_intersect(point(np-1),p,point(np-2),point(np-1),parallel); if (parallel) error("two polygon points lie in a straight line"); } for (int i = 1; i<np-1; ++i) { // check that new segment doesn't interset and old point Point ignore(0,0); if (line_segment_intersect(point(np-1),p,point(i-1),point(i),ignore)) error("intersect in polygon"); } Closed_polyline::add(p); }
// draw lines connecting pairs of points void Lines::draw_lines() const { if (color().visibility()) for (int i=1; i<number_of_points(); i+=2) fl_line(point(i-1).x,point(i-1).y,point(i).x,point(i).y); }
void Marked_polyline::draw_lines() const { Open_polyline::draw_lines(); for (int i=0; i<number_of_points(); ++i) draw_mark(point(i),mark[i%mark.size()]); }
void Polygon::draw_lines() const { if (number_of_points() < 3) error("less than 3 points in a Polygon"); Closed_polyline::draw_lines(); }