From: <and...@us...> - 2004-02-10 14:48:59
|
Update of /cvsroot/plplot/plplot/examples/c In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30158/examples/c Modified Files: Makefile.am Makefile.examples.in Added Files: x22c.c Log Message: Change plarrows to use an user supplied arrow style via the new API call plsarrow. The default is the old style if none is supplied. Add C++ bindings. Add example x22c to demonstrate the routines. --- NEW FILE: x22c.c --- /* $Id: Simple arrow plot example Copyright (C) 2004 Andrew Ross <and...@us...> This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU General Library Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "plcdemos.h" #include "plevent.h" /* Variables and data arrays used by plot generators */ static PLFLT x[100], y[100], u[100], v[100], r[100]; static PLFLT arrow_x[6] = {0.5, -0.5, 0.5, 0.3, 0.5, 0.3}; static PLFLT arrow_y[6] = {0.0, 0.0, 0.0, 0.2, 0.0, -0.2}; /*--------------------------------------------------------------------------*\ * main * * Generates several simple vector plots. \*--------------------------------------------------------------------------*/ int main(int argc, char *argv[]) { int i,j,k, nx, ny, npts; PLFLT dx, dy; PLFLT xmin, xmax, ymin, ymax; /* Parse and process command line arguments */ plParseOpts(&argc, argv, PL_PARSE_FULL); /* Initialize plplot */ plinit(); dx = 1.0; dy = 1.0; nx = 10; ny = 10; npts = nx*ny; xmin = -nx/2*dx; xmax = nx/2*dx; ymin = -ny/2*dy; ymax = ny/2*dy; k = 0; for (i = 0; i<nx; i++) { for (j = 0; j<ny; j++) { x[k] = (i-nx/2+0.5)*dx; y[k] = (j-ny/2+0.5)*dy; u[k] = y[k]; v[k] = -x[k]; k++; } } plenv(xmin, xmax, ymin, ymax, 0, 0); pllab("(x)", "(y)", "#frPLplot Example 22 - vector plot"); plarrows(u,v,x,y,npts,-0.5,dx,dy); plsarrow(arrow_x, arrow_y, 6); plenv(xmin, xmax, ymin, ymax, 0, 0); pllab("(x)", "(y)", "#frPLplot Example 22 - vector plot"); plarrows(u,v,x,y,npts,-0.5,dx,dy); plend(); exit(0); } Index: Makefile.am =================================================================== RCS file: /cvsroot/plplot/plplot/examples/c/Makefile.am,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- Makefile.am 28 Jan 2004 19:38:52 -0000 1.17 +++ Makefile.am 10 Feb 2004 14:45:18 -0000 1.18 @@ -46,7 +46,8 @@ x18c.c \ x19c.c \ x20c.c \ - x21c.c + x21c.c \ + x22c.c examples_c_DATA = \ $(sources) \ Makefile.examples @@ -77,7 +78,8 @@ x18c \ x19c \ x20c \ - x21c + x21c \ + x22c LDADD = $(libplplot) Index: Makefile.examples.in =================================================================== RCS file: /cvsroot/plplot/plplot/examples/c/Makefile.examples.in,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- Makefile.examples.in 17 Jan 2004 16:41:38 -0000 1.19 +++ Makefile.examples.in 10 Feb 2004 14:45:18 -0000 1.20 @@ -48,7 +48,8 @@ x18c$(EXEEXT) \ x19c$(EXEEXT) \ x20c$(EXEEXT) \ - x21c$(EXEEXT) + x21c$(EXEEXT) \ + x22c$(EXEEXT) all: $(EXECUTABLES_list) |