static void place_ellipse_x(int x, int y) { canvas_leftbut_proc = null_proc; canvas_middlebut_proc = null_proc; canvas_rightbut_proc = null_proc; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; adjust_pos(x, y, fix_x, fix_y, &x, &y); translate_ellipse(new_e, x - fix_x, y - fix_y); if (return_proc == copy_selected) { add_ellipse(new_e); } else { list_add_ellipse(&objects.ellipses, new_e); clean_up(); set_lastposition(fix_x, fix_y); set_newposition(x, y); set_action_object(F_MOVE, O_ELLIPSE); set_latestellipse(new_e); set_modifiedflag(); } redisplay_ellipse(new_e); /* turn back on all relevant markers */ update_markers(new_objmask); (*return_proc) (); draw_mousefun_canvas(); }
void ARCBuilder::add_ellipse(Vector center, Vector sm_axis, Double axis_ratio, Double start_angle, Double end_angle, Vector extrusion) { if (start_angle.is_equal_with_epsilon(0.0, constants::EPSILON) && end_angle.is_equal_with_epsilon(2*constants::PI, constants::EPSILON)) { Vector a = center - sm_axis; Vector b = center + Vector(-a.y()+center.y(),a.x()-center.x(), 0.0)*axis_ratio; // Only 2D add_ellipse(center, a, b); } else { // TODO Elliptic Arc } }
//______________________________________________________________________ void radialgradients() { gRandom->SetSeed(4357);//;) TCanvas * const cnv = new TCanvas("radial gradients", "radial gradients", 800, 800); if (gVirtualX && !gVirtualX->InheritsFrom("TGCocoa")) { ::Error("radialgradients", "this demo requires OS X and ROOT built with --enable-cocoa"); delete cnv; return; } for (unsigned i = 0; i < 100; ++i) if (!add_ellipse(gRandom->Rndm(), gRandom->Rndm(), 0.5 * gRandom->Rndm())) break; cnv->Modified(); cnv->Update(); }
static void init_flipellipse(F_ellipse *old_e, int px, int py) { F_ellipse *new_e; new_e = copy_ellipse(old_e); flip_ellipse(new_e, px, py, flip_axis); if (copy) { add_ellipse(new_e); } else { toggle_ellipsemarker(old_e); draw_ellipse(old_e, ERASE); change_ellipse(old_e, new_e); } /* redisplay objects under this object before it was rotated */ redisplay_ellipse(old_e); /* and this object and any other objects on top */ redisplay_ellipse(new_e); }
//______________________________________________________________________ void radialgradients() { gRandom->SetSeed(4357);//;) gStyle->SetCanvasPreferGL(kTRUE); TCanvas * const cnv = new TCanvas("radial gradients", "radial gradients", 800, 800); if (!cnv->UseGL()) { ::Error("radialgradients", "this demo OpenGL"); delete cnv; return; } for (unsigned i = 0; i < 100; ++i) if (!add_ellipse(gRandom->Rndm(), gRandom->Rndm(), 0.5 * gRandom->Rndm())) break; cnv->Modified(); cnv->Update(); }
static void create_circlebydia(int x, int y) { F_ellipse *c; double rx, ry; elastic_cbd(); center_marker(fix_x, fix_y); if ((c = create_ellipse()) == NULL) return; c->type = T_CIRCLE_BY_DIA; c->style = cur_linestyle; c->thickness = cur_linewidth; c->style_val = cur_styleval * (cur_linewidth + 1) / 2; c->angle = 0.0; c->pen_color = cur_pencolor; c->fill_color = cur_fillcolor; c->depth = cur_depth; c->pen_style = -1; c->fill_style = cur_fillstyle; c->direction = 1; c->center.x = round((fix_x + x) / 2); c->center.y = round((fix_y + y) / 2); rx = x - c->center.x; ry = y - c->center.y; c->radiuses.x = c->radiuses.y = round(sqrt(rx * rx + ry * ry)); c->start.x = fix_x; c->start.y = fix_y; c->end.x = x; c->end.y = y; c->next = NULL; add_ellipse(c); reset_action_on(); /* this signals redisplay_curobj() not to refresh */ /* draw it and anything on top of it */ redisplay_ellipse(c); circle_ellipse_bydiameter_drawing_selected(); draw_mousefun_canvas(); }
static void create_ellipsebyrad(int x, int y) { F_ellipse *ellipse; elastic_ebr(); center_marker(fix_x, fix_y); if ((ellipse = create_ellipse()) == NULL) return; ellipse->type = T_ELLIPSE_BY_RAD; ellipse->style = cur_linestyle; ellipse->thickness = cur_linewidth; ellipse->style_val = cur_styleval * (cur_linewidth + 1) / 2; ellipse->angle = cur_elltextangle/180.0*M_PI; /* convert to radians */ ellipse->pen_color = cur_pencolor; ellipse->fill_color = cur_fillcolor; ellipse->depth = cur_depth; ellipse->pen_style = -1; ellipse->fill_style = cur_fillstyle; ellipse->direction = 1; ellipse->center.x = fix_x; ellipse->center.y = fix_y; ellipse->radiuses.x = abs(x - fix_x); ellipse->radiuses.y = abs(y - fix_y); ellipse->start.x = fix_x; ellipse->start.y = fix_y; ellipse->end.x = x; ellipse->end.y = y; ellipse->next = NULL; add_ellipse(ellipse); reset_action_on(); /* this signals redisplay_curobj() not to refresh */ /* draw it and anything on top of it */ redisplay_ellipse(ellipse); circle_ellipse_byradius_drawing_selected(); draw_mousefun_canvas(); }
void Shape2D::add_circle(const Pointf ¢er, float radius, bool reverse) { add_ellipse(center, Pointf(radius, radius), reverse); }
void Shape2D::add_ellipse(float center_x, float center_y, float radius_x, float radius_y, bool reverse) { add_ellipse(Pointf(center_x, center_y), Pointf(radius_x, radius_y), reverse); }