int SWEEP_BASE::line_cb(CGESTUREptr& g, DrawState*& s) { // Activity occurred to extend the deadline for fading away: reset_timeout(); static bool debug = Config::get_var_bool("DEBUG_SWEEP_LINE_CB",false) || debug_all; err_adv(debug, "SWEEP_BASE::line_cb"); // If gesture aligns with guideline: // if it starts near the end and extends past the end, extend // if it starts near the beginning, do uniform sweep // If it's across the gesture, trim // If it's a trim stroke, it has to be short and run // across the guideline. const double TRIM_MAX_LEN = 65; if (g->length() < TRIM_MAX_LEN) { const double TRIM_ANGLE_THRESH = 80; // degrees double angle = line_angle(g->endpt_vec(), pix_line().direction()); if (rad2deg(angle) > TRIM_ANGLE_THRESH) { // Nice angle. But did it cross? if (g->endpt_line().intersect_segs(pix_line())) return trim_line_cb(g, s); } } // do uniform sweep if straight gesture starts at sweep origin // and ends near the guideline: if (from_center(g)) { if (hits_line(g->end())) return do_uniform_sweep(project_to_guideline(g->end()) - sweep_origin()); return stroke_cb(g,s); } // extend the guideline if straight gesture starts near guideline end // and is nearly parallel: const double ALIGN_ANGLE_THRESH = 15; // degrees if (pix_line().endpt().dist(g->start()) < DIST_THRESH_PIXELS && rad2deg(g->endpt_vec().angle(pix_line().direction())) < ALIGN_ANGLE_THRESH) return extend_line_cb(g, s); return stroke_cb(g,s); }
CarriersCell(CGESTUREptr& carrier1, CGESTUREptr& carrier2) : _carrier1(carrier1), _carrier2(carrier2){ compute_carriers_coords(true); compute_carriers_coords(false); _scale = min(carrier1->length(), carrier2->length()); }