diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-09 00:49:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-09 00:49:07 +0000 |
commit | 007f67a693e4d031fd3d792df8e4d5f43e2cb2e7 (patch) | |
tree | 90d17e00e572ecb1e24764b6f29c80e098b08d29 /Master/texmf-dist/doc/latex/metaplot/examples/cpoint.h | |
parent | 950209b26f70aa87ed07c54f82a95b6f03b7c3a0 (diff) |
doc/latex
git-svn-id: svn://tug.org/texlive/trunk@84 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/metaplot/examples/cpoint.h')
-rw-r--r-- | Master/texmf-dist/doc/latex/metaplot/examples/cpoint.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/metaplot/examples/cpoint.h b/Master/texmf-dist/doc/latex/metaplot/examples/cpoint.h new file mode 100644 index 00000000000..ebee071c23f --- /dev/null +++ b/Master/texmf-dist/doc/latex/metaplot/examples/cpoint.h @@ -0,0 +1,57 @@ +/* MetaContour, version 0.1 -------------------------------------- */ +/* Copyright(C) 2004, Brooks Moses */ +/* */ +/* This version of MetaContour is made available under the Gnu */ +/* Public License; see metacontour_main.cc for details. */ +/* */ +/* This is a very pre-release version of MetaContour, distributed */ +/* primarily as an example of a use of MetaPlot. It can be */ +/* compiled with gcc using the line: */ +/* */ +/* g++ metacontour.cc cpoint.cc metacontour_main.cc */ +/* */ +/*-----------------------------------------------------------------*/ + +/* Class for 2D points with one data value each */ + +#include<string> +#include<valarray> +using namespace std; + +struct cpoint { + double x; + double y; + double z; + + cpoint(); + cpoint(double, double, double); + + cpoint interpolateto(cpoint, double); + cpoint partwayto(cpoint, double); + static double saddlepoint(cpoint, cpoint, cpoint, cpoint); + + string metapoint(); +}; + + +class cparray { + valarray<cpoint>* a; + int i; + int j; +public: + cparray(int x, int y); // note: no default constructor + cparray(const cparray&); + cparray& operator=(const cparray&); + ~cparray(); + + int size() const { return i*j; } + int i_dim() const { return i; } + int j_dim() const { return j; } + + cpoint& operator()(int x, int y); // Fortran-style subscripts + cpoint operator()(int x, int y) const; + + valarray<cpoint>& array() { return *a; } +}; + + |