1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2025-04-21 12:27:27 +03:00

poly2d/: Yet another 2D polygon library (WIP)

This commit is contained in:
Werner Almesberger
2012-05-04 21:40:55 -03:00
parent c2bfbd5a5e
commit dfa85075e8
24 changed files with 1793 additions and 0 deletions

61
poly2d/test/make Executable file
View File

@@ -0,0 +1,61 @@
#!/bin/sh
. ./Common
###############################################################################
tst "make an open polygon" <<EOF
struct p2d *p = p2d_new();
p2d_append(p, v2d_new(0, 0));
p2d_append(p, v2d_new(1, 2));
p2d_write_gnuplot(stdout, p);
EOF
expect <<EOF
0 0
1 2
EOF
#------------------------------------------------------------------------------
tst "make a closed polygon" <<EOF
struct p2d *p = p2d_new();
p2d_append(p, v2d_new(-1, 1));
p2d_append(p, v2d_new(3, 7));
p2d_close(p);
p2d_write_gnuplot(stdout, p);
EOF
expect <<EOF
-1 1
3 7
-1 1
EOF
#------------------------------------------------------------------------------
tst "make two open polygons" <<EOF
struct p2d *p = p2d_new();
struct p2d *q = p2d_new();
p2d_append(p, v2d_new(1, 4));
p2d_append(p, v2d_new(2, 8));
p->next = q;
p2d_append(q, v2d_new(3, 15));
p2d_append(q, v2d_new(4, 16));
p2d_write_gnuplot_all(stdout, p);
EOF
expect <<EOF
1 4
2 8
3 15
4 16
EOF
###############################################################################