Root/
| 1 | #!/bin/sh |
| 2 | . ./Common |
| 3 | |
| 4 | ############################################################################### |
| 5 | |
| 6 | tst "area without holes, constant offset" <<EOF |
| 7 | struct p2d *p = p2d_new(); |
| 8 | struct p2d *q; |
| 9 | |
| 10 | p2d_append(p, v2d_new(0, 0)); |
| 11 | p2d_append(p, v2d_new(5.5, 0)); |
| 12 | p2d_append(p, v2d_new(5.5, 4.5)); |
| 13 | p2d_append(p, v2d_new(0, 4.5)); |
| 14 | p2d_close(p); |
| 15 | q = p2d_area(p, 1, 1); |
| 16 | p2d_write_gnuplot_all(stdout, q); |
| 17 | EOF |
| 18 | |
| 19 | expect <<EOF |
| 20 | 1 1 |
| 21 | 4.5 1 |
| 22 | 4.5 3.5 |
| 23 | 1 3.5 |
| 24 | 1 1 |
| 25 | |
| 26 | 2 2 |
| 27 | 3.5 2 |
| 28 | 3.5 2.5 |
| 29 | 2 2.5 |
| 30 | 2 2 |
| 31 | |
| 32 | EOF |
| 33 | |
| 34 | #------------------------------------------------------------------------------ |
| 35 | |
| 36 | tst "area without holes, offset with overlap" <<EOF |
| 37 | struct p2d *p = p2d_new(); |
| 38 | struct p2d *q; |
| 39 | |
| 40 | p2d_append(p, v2d_new(0, 0)); |
| 41 | p2d_append(p, v2d_new(5.5, 0)); |
| 42 | p2d_append(p, v2d_new(5.5, 4.5)); |
| 43 | p2d_append(p, v2d_new(0, 4.5)); |
| 44 | p2d_close(p); |
| 45 | q = p2d_area(p, 1, 0.7); |
| 46 | p2d_write_gnuplot_all(stdout, q); |
| 47 | EOF |
| 48 | |
| 49 | expect <<EOF |
| 50 | 1 1 |
| 51 | 4.5 1 |
| 52 | 4.5 3.5 |
| 53 | 1 3.5 |
| 54 | 1 1 |
| 55 | |
| 56 | 1.7 1.7 |
| 57 | 3.8 1.7 |
| 58 | 3.8 2.8 |
| 59 | 1.7 2.8 |
| 60 | 1.7 1.7 |
| 61 | |
| 62 | EOF |
| 63 | |
| 64 | #------------------------------------------------------------------------------ |
| 65 | |
| 66 | tst "area with one symmetric hole" <<EOF |
| 67 | struct p2d *pl, *p; |
| 68 | struct p2d *q; |
| 69 | |
| 70 | pl = p = p2d_new(); |
| 71 | p2d_append(p, v2d_new(0, 0)); |
| 72 | p2d_append(p, v2d_new(20, 0)); |
| 73 | p2d_append(p, v2d_new(20, 10)); |
| 74 | p2d_append(p, v2d_new(0, 10)); |
| 75 | p2d_close(p); |
| 76 | |
| 77 | p = p->next = p2d_new(); |
| 78 | p2d_append(p, v2d_new(2, 2)); |
| 79 | p2d_append(p, v2d_new(2, 8)); |
| 80 | p2d_append(p, v2d_new(18, 8)); |
| 81 | p2d_append(p, v2d_new(18, 2)); |
| 82 | p2d_close(p); |
| 83 | |
| 84 | q = p2d_area(pl, 0.7, 0.7); |
| 85 | p2d_write_gnuplot_all(stdout, q); |
| 86 | EOF |
| 87 | |
| 88 | expect <<EOF |
| 89 | 0.7 0.7 |
| 90 | 19.3 0.7 |
| 91 | 19.3 9.3 |
| 92 | 0.7 9.3 |
| 93 | 0.7 0.7 |
| 94 | |
| 95 | 1.3 1.3 |
| 96 | 1.3 8.7 |
| 97 | 18.7 8.7 |
| 98 | 18.7 1.3 |
| 99 | 1.3 1.3 |
| 100 | |
| 101 | EOF |
| 102 | |
| 103 | ############################################################################### |
| 104 |
Branches:
master
