| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6abe366 commit 962a6db
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,17 @@ | |||
| 1 | + 2017-10-30 Ethan A Merritt <merritt@u.washington.edu> | ||
| 2 | + | ||
| 3 | + * src/gadgets.c (draw_clip_arrow): Do not call term->arrow() if the | ||
| 4 | + entire arrow is out of range. | ||
| 5 | + | ||
| 6 | + * src/graphics.c (plot_vectors): The code for 2D "plot with vectors" | ||
| 7 | + is redundant. Replace the core of it with a call to draw_clip_arrow(). | ||
| 8 | + | ||
| 9 | + * src/boundary.c (do_key_sample): Illustrate revision of a | ||
| 10 | + draw_clip_arrow() call site to use (double) rather than (int) | ||
| 11 | + parameters. The only reason for this is to allow draw_clip_arrow() | ||
| 12 | + itself to switch to (double) parameters if we decide that is useful, | ||
| 13 | + e.g. to handle arrows with length approaching zero. | ||
| 14 | + | ||
| 1 | 15 | 2017-10-13 Petr Mikulik <mikulik@physics.muni.cz> | |
| 2 | 16 | ||
| 3 | 17 | * src/pm3d.c (pm3d_draw_one pm3d_plot): Move call of term->layer() with | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | #ifndef lint | |
| 2 | - static char *RCSid() { return RCSid("$Id: graphics.c,v 1.575 2017-09-29 19:23:36 sfeam Exp $"); } | ||
| 2 | + static char *RCSid() { return RCSid("$Id: graphics.c,v 1.576 2017-10-31 18:52:59 sfeam Exp $"); } | ||
| 3 | 3 | #endif | |
| 4 | 4 | ||
| 5 | 5 | /* GNUPLOT - graphics.c */ | |
@@ -2414,17 +2414,18 @@ plot_vectors(struct curve_points *plot) | |||
| 2414 | 2414 | { | |
| 2415 | 2415 | int i; | |
| 2416 | 2416 | int x1, y1, x2, y2; | |
| 2417 | - struct termentry *t = term; | ||
| 2418 | 2417 | struct coordinate points[2]; | |
| 2419 | - double ex, ey; | ||
| 2420 | - double lx[2], ly[2]; | ||
| 2421 | 2418 | arrow_style_type ap; | |
| 2419 | + BoundingBox *clip_save = clip_area; | ||
| 2422 | 2420 | ||
| 2423 | 2421 | /* Normally this is only necessary once because all arrows equal */ | |
| 2424 | 2422 | ap = plot->arrow_properties; | |
| 2425 | 2423 | term_apply_lp_properties(&ap.lp_properties); | |
| 2426 | 2424 | apply_head_properties(&ap); | |
| 2427 | 2425 | ||
| 2426 | + /* Clip to plot */ | ||
| 2427 | + clip_area = &plot_bounds; | ||
| 2428 | + | ||
| 2428 | 2429 | for (i = 0; i < plot->p_count; i++) { | |
| 2429 | 2430 | ||
| 2430 | 2431 | points[0] = plot->points[i]; | |
@@ -2445,58 +2446,15 @@ plot_vectors(struct curve_points *plot) | |||
| 2445 | 2446 | /* variable color read from extra data column. */ | |
| 2446 | 2447 | check_for_variable_color(plot, &plot->varcolor[i]); | |
| 2447 | 2448 | ||
| 2448 | - if (inrange(points[1].x, X_AXIS.min, X_AXIS.max) | ||
| 2449 | - && inrange(points[1].y, Y_AXIS.min, Y_AXIS.max)) { | ||
| 2450 | - /* to inrange */ | ||
| 2451 | - points[1].type = INRANGE; | ||
| 2452 | - x2 = map_x(points[1].x); | ||
| 2453 | - y2 = map_y(points[1].y); | ||
| 2454 | - if (points[0].type == INRANGE) { | ||
| 2455 | - x1 = map_x(points[0].x); | ||
| 2456 | - y1 = map_y(points[0].y); | ||
| 2457 | - (*t->arrow) (x1, y1, x2, y2, ap.head); | ||
| 2458 | - } else if (points[0].type == OUTRANGE) { | ||
| 2459 | - /* from outrange to inrange */ | ||
| 2460 | - if (clip_lines1) { | ||
| 2461 | - edge_intersect(points, 1, &ex, &ey); | ||
| 2462 | - x1 = map_x(ex); | ||
| 2463 | - y1 = map_y(ey); | ||
| 2464 | - if (ap.head & END_HEAD) | ||
| 2465 | - (*t->arrow) (x1, y1, x2, y2, END_HEAD); | ||
| 2466 | - else | ||
| 2467 | - (*t->arrow) (x1, y1, x2, y2, NOHEAD); | ||
| 2468 | - } | ||
| 2469 | - } | ||
| 2470 | - } else { | ||
| 2471 | - /* to outrange */ | ||
| 2472 | - points[1].type = OUTRANGE; | ||
| 2473 | - if (points[0].type == INRANGE) { | ||
| 2474 | - /* from inrange to outrange */ | ||
| 2475 | - if (clip_lines1) { | ||
| 2476 | - x1 = map_x(points[0].x); | ||
| 2477 | - y1 = map_y(points[0].y); | ||
| 2478 | - edge_intersect(points, 1, &ex, &ey); | ||
| 2479 | - x2 = map_x(ex); | ||
| 2480 | - y2 = map_y(ey); | ||
| 2481 | - if (ap.head & BACKHEAD) | ||
| 2482 | - (*t->arrow) (x2, y2, x1, y1, BACKHEAD); | ||
| 2483 | - else | ||
| 2484 | - (*t->arrow) (x1, y1, x2, y2, NOHEAD); | ||
| 2485 | - } | ||
| 2486 | - } else if (points[0].type == OUTRANGE) { | ||
| 2487 | - /* from outrange to outrange */ | ||
| 2488 | - if (clip_lines2) { | ||
| 2489 | - if (two_edge_intersect(points, 1, lx, ly)) { | ||
| 2490 | - x1 = map_x(lx[0]); | ||
| 2491 | - y1 = map_y(ly[0]); | ||
| 2492 | - x2 = map_x(lx[1]); | ||
| 2493 | - y2 = map_y(ly[1]); | ||
| 2494 | - (*t->arrow) (x1, y1, x2, y2, NOHEAD); | ||
| 2495 | - } | ||
| 2496 | - } | ||
| 2497 | - } | ||
| 2498 | - } | ||
| 2449 | + /* draw_clip_arrow does the hard work for us */ | ||
| 2450 | + x1 = map_x(points[0].x); | ||
| 2451 | + y1 = map_y(points[0].y); | ||
| 2452 | + x2 = map_x(points[1].x); | ||
| 2453 | + y2 = map_y(points[1].y); | ||
| 2454 | + draw_clip_arrow(x1, y1, x2, y2, ap.head); | ||
| 2499 | 2455 | } | |
| 2456 | + | ||
| 2457 | + clip_area = clip_save; | ||
| 2500 | 2458 | } | |
| 2501 | 2459 | ||
| 2502 | 2460 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments