~ubuntu-branches/ubuntu/intrepid/plplot/intrepid

« back to all changes in this revision

Viewing changes to examples/java/x18.java

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-11-04 10:19:34 UTC
  • mfrom: (2.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061104101934-mlirvdg4gpwi6i5q
Tags: 5.6.1-10
* Orphaning the package
* debian/control: Changed the maintainer to the Debian QA Group

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//---------------------------------------------------------------------------//
2
 
// $Id: x18.java,v 1.7 2004/01/17 16:41:39 rlaboiss Exp $
 
2
// $Id: x18.java,v 1.15 2006/05/13 05:22:43 airwin Exp $
3
3
//---------------------------------------------------------------------------//
4
4
 
5
5
//---------------------------------------------------------------------------//
6
6
// Copyright (C) 2001  Geoffrey Furnish
7
7
// Copyright (C) 2002  Alan W. Irwin
 
8
// Copyright (C) 2004  Andrew Ross
8
9
//
9
10
// This file is part of PLplot.
10
11
//
19
20
//
20
21
// You should have received a copy of the GNU Library General Public License
21
22
// along with PLplot; if not, write to the Free Software
22
 
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
23
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
23
24
//---------------------------------------------------------------------------//
24
25
 
25
26
//---------------------------------------------------------------------------//
35
36
class x18 {
36
37
 
37
38
 
38
 
   final int NPTS = 1000;
 
39
   static final int NPTS = 1000;
39
40
   static int opt[] = { 1, 0, 1, 0 };
40
41
   static double alt[] = {20.0, 35.0, 50.0, 65.0};
41
42
   static double az[] = {30.0, 40.0, 50.0, 60.0};
42
 
   PLStreamc plsdummy = new PLStreamc();
43
 
   plplotjavac pls = new plplotjavac();
 
43
   PLStream pls = new PLStream();
44
44
 
45
45
   double THETA(int a)
46
46
     {
53
53
   void test_poly(int k)
54
54
     {
55
55
        int i, j;
56
 
        int [][] draw = { 
57
 
             { 1, 1, 1, 1 },
58
 
             { 1, 0, 1, 0 },
59
 
             { 0, 1, 0, 1 },
60
 
             { 1, 1, 0, 0 }
 
56
        boolean [][] draw = { 
 
57
             { true, true, true, true },
 
58
             { true, false, true, false },
 
59
             { false, true, false, true },
 
60
             { true, true, false, false }
61
61
        };
62
62
 
63
63
        double [] x = new double [5];
64
64
        double [] y = new double [5];
65
65
        double [] z = new double [5];
66
66
 
67
 
        pls.pladv(0);
68
 
        pls.plvpor(0.0, 1.0, 0.0, 0.9);
69
 
        pls.plwind(-1.0, 1.0, -0.9, 1.1);
70
 
        pls.plcol0(1);
71
 
        pls.plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]);
72
 
        pls.plbox3("bnstu", "x axis", 0.0, 0,
 
67
        pls.adv(0);
 
68
        pls.vpor(0.0, 1.0, 0.0, 0.9);
 
69
        pls.wind(-1.0, 1.0, -0.9, 1.1);
 
70
        pls.col0(1);
 
71
        pls.w3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]);
 
72
        pls.box3("bnstu", "x axis", 0.0, 0,
73
73
                 "bnstu", "y axis", 0.0, 0,
74
74
                 "bcdmnstuv", "z axis", 0.0, 0);
75
75
        
76
 
        pls.plcol0(2);
 
76
        pls.col0(2);
77
77
 
78
78
        // x = r sin(phi) cos(theta)
79
79
        // y = r sin(phi) sin(theta)
102
102
              y[4] = Math.sin( PHI(j) ) * Math.sin( THETA(i) );
103
103
              z[4] = Math.cos( PHI(j) );
104
104
 
105
 
              pls.plpoly3(x, y, z, draw[k], 1 );
 
105
              pls.poly3(x, y, z, draw[k], true );
106
106
           }
107
107
        }
108
108
 
109
 
        pls.plcol0(3);
110
 
        pls.plmtex("t", 1.0, 0.5, 0.5, "unit radius sphere" );
 
109
        pls.col0(3);
 
110
        pls.mtex("t", 1.0, 0.5, 0.5, "unit radius sphere" );
111
111
     }
112
112
   // Does a series of 3-d plots for a given data set, with different
113
113
   // viewing options in each plot.
124
124
        double r;
125
125
 
126
126
        // Parse and process command line arguments.
127
 
        pls.plParseOpts( args, pls.PL_PARSE_FULL | pls.PL_PARSE_NOPROGRAM );
 
127
        pls.parseopts( args, PLStream.PL_PARSE_FULL | PLStream.PL_PARSE_NOPROGRAM );
128
128
 
129
129
        // Initialize plplot.
130
 
        pls.plinit();
 
130
        pls.init();
131
131
 
132
132
        for( k=0; k < 4; k++ )
133
133
          test_poly(k);
151
151
        }
152
152
 
153
153
        for (k = 0; k < 4; k++) {
154
 
           pls.pladv(0);
155
 
           pls.plvpor(0.0, 1.0, 0.0, 0.9);
156
 
           pls.plwind(-1.0, 1.0, -0.9, 1.1);
157
 
           pls.plcol0(1);
158
 
           pls.plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]);
159
 
           pls.plbox3("bnstu", "x axis", 0.0, 0,
 
154
           pls.adv(0);
 
155
           pls.vpor(0.0, 1.0, 0.0, 0.9);
 
156
           pls.wind(-1.0, 1.0, -0.9, 1.1);
 
157
           pls.col0(1);
 
158
           pls.w3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]);
 
159
           pls.box3("bnstu", "x axis", 0.0, 0,
160
160
                    "bnstu", "y axis", 0.0, 0,
161
161
                    "bcdmnstuv", "z axis", 0.0, 0);
162
162
           
163
 
           pls.plcol0(2);
 
163
           pls.col0(2);
164
164
           
165
165
           if (opt[k]>0)
166
 
             pls.plline3( x, y, z );
 
166
             pls.line3( x, y, z );
167
167
           else
168
 
             pls.plpoin3( x, y, z, 1 );
 
168
             pls.poin3( x, y, z, 1 );
169
169
           
170
 
           pls.plcol0(3);
 
170
           pls.col0(3);
171
171
           String title =  "#frPLplot Example 18 - Alt=" + 
172
172
             nf.format((int) alt[k]) +
173
173
             ", Az=" + 
174
174
             nf.format((int) az[k]);
175
 
           pls.plmtex("t", 1.0, 0.5, 0.5, title);
 
175
           pls.mtex("t", 1.0, 0.5, 0.5, title);
176
176
        }
177
177
        
178
 
        pls.plend();
 
178
        pls.end();
179
179
     }
180
180
   
181
181
}