## DISLIN Examples / Java

#### Demonstration of CURVE / Java

import de.dislin.Dislin;

public class curve {
public static void main (String args []) {
int n = 100, i, ic;
double x, fpi = 3.1415926/180., step = 360. / (n-1);

float xray []  = new float [n];
float y1ray [] = new float [n];
float y2ray [] = new float [n];

for (i = 0; i < n; i++) {
xray[i] = (float) (i * step);
x = xray[i] * fpi;
y1ray[i] = (float) Math.sin (x);
y2ray[i] = (float) Math.cos (x);
}

Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.disini ();
Dislin.pagera ();
Dislin.complx ();

Dislin.axspos (450, 1800);
Dislin.axslen (2200, 1200);

Dislin.name   ("X-axis", "x");
Dislin.name   ("Y-axis",  "y");

Dislin.labdig (-1, "x");
Dislin.ticks  (9,  "x");
Dislin.ticks  (10, "y");

Dislin.titlin ("Demonstration of CURVE", 1);
Dislin.titlin ("SIN(X), COS(X)", 3);

ic = Dislin.intrgb (0.95f, 0.95f, 0.95f);
Dislin.axsbgd (ic);

Dislin.graf   (0.f, 360.f, 0.f, 90.f,
-1.f, 1.f, -1.f, 0.5f);
Dislin.setrgb (0.7f, 0.7f, 0.7f);
Dislin.grid (1, 1);

Dislin.color ("fore");
Dislin.height(50);
Dislin.title  ();

Dislin.color  ("red");
Dislin.curve  (xray, y1ray, n);
Dislin.color  ("green");
Dislin.curve  (xray, y2ray, n);
Dislin.disfin ();
}
}


#### Polar Plots / Java

import de.dislin.Dislin;

public class polar {
public static void main (String args []) {
int n = 300, m = 10, i, ic;
double a, f = 3.1415926/180., step = 360. / (n-1);

float x1 [] = new float [n];
float y1 [] = new float [n];
float x2 [] = new float [m];
float y2 [] = new float [m];

for (i = 0; i < n; i++) {
a = (i * step) * f;
y1[i] = (float) a;
x1[i] = (float) Math.sin (5 * a);
}

for (i = 0; i < m; i++) {
x2[i] = i + 1;
y2[i] = i + 1;
}

Dislin.scrmod ("revers");
Dislin.setpag ("da4p");
Dislin.metafl ("cons");
Dislin.disini ();
Dislin.pagera ();
Dislin.hwfont ();

Dislin.titlin ("Polar Plots", 2);
Dislin.ticks  (3, "Y");
Dislin.axends ("NOENDS", "X");
Dislin.labdig (-1, "Y");
Dislin.axslen (1000, 1000);
Dislin.axsorg (1050, 900);

ic = Dislin.intrgb (0.95f, 0.95f, 0.95f);
Dislin.axsbgd (ic);

Dislin.grafp  (1.f, 0.f, 0.2f, 0.f, 30.f);
Dislin.color  ("blue");
Dislin.curve  (x1, y1, n);
Dislin.color  ("fore");
Dislin.htitle (50);
Dislin.title  ();
Dislin.endgrf ();

Dislin.labdig (-1, "X");
Dislin.axsorg (1050, 2250);
Dislin.labtyp ("VERT", "Y");
Dislin.grafp  (10.f, 0.f, 2.f, 0.f, 30.f);
Dislin.barwth (-5.f);
Dislin.polcrv ("FBARS");
Dislin.color  ("blue");
Dislin.curve  (x2, y2, m);
Dislin.disfin ();
}
}


#### Symbols / Java

import de.dislin.Dislin;

public class symbols {
public static void main (String args []) {
int ny = 150, nxp = 0, nl, i;
String ctit = "Symbols", cstr = "  ";

Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.setpag ("da4p");
Dislin.disini ();
Dislin.pagera ();
Dislin.complx ();

Dislin.height (60);
nl = Dislin.nlmess (ctit);
Dislin.messag (ctit, (2100 - nl) / 2, 200);

Dislin.height (50);
Dislin.hsymbl (120);

for (i = 0; i < 24; i++) {
if ((i % 4) == 0) {
ny  += 400;
nxp  = 550;
}
else {
nxp += 350;
}

cstr = "" + i;
nl = Dislin.nlmess (cstr) / 2;
Dislin.messag (cstr, nxp - nl, ny + 150);
Dislin.symbol (i, nxp, ny);
}
Dislin.disfin ();
}
}


#### Interpolation Methods / Java

import de.dislin.Dislin;

public class intpol {
public static void main (String args []) {
int i, nya = 2700, nx, ny, ic;
String ctit = "Interpolation Methods";
float xray [] = {0.f, 1.f, 3.f, 4.5f, 6.f, 8.f, 9.f, 11.f, 12.f,
12.5f, 13.f, 15.f, 16.f, 17.f, 19.f, 20.f};
float yray [] = {2.f, 4.f, 4.5f, 3.f, 1.f, 7.f, 2.f, 3.f, 5.f,
2.f, 2.5f, 2.f, 4.f, 6.f, 5.5f, 4.f};
String cpol [] = {"SPLINE", "STEM", "BARS", "STAIRS",
"STEP", "LINEAR"};

Dislin.scrmod ("revers");
Dislin.setpag ("da4p");
Dislin.metafl ("cons");

Dislin.disini ();
Dislin.pagera ();
Dislin.complx ();

Dislin.incmrk (1);
Dislin.hsymbl (25);
Dislin.titlin (ctit, 1);
Dislin.axslen (1500, 350);
Dislin.setgrf ("LINE", "LINE", "LINE", "LINE");

ic = Dislin.intrgb (1.0f, 1.0f, 0.0f);
Dislin.axsbgd (ic);

for (i = 0; i < 6; i++) {
Dislin.axspos (350, nya - i * 350);
Dislin.polcrv (cpol[i]);
Dislin.marker (0);
Dislin.graf   (0.f, 20.f, 0.f, 5.f, 0.f, 10.f, 0.f, 5.f);
nx = Dislin.nxposn (1.f);
ny = Dislin.nyposn (8.f);
Dislin.messag (cpol[i], nx, ny);
Dislin.color  ("red");
Dislin.curve  (xray, yray, 16);
Dislin.color  ("fore");

if (i == 5) {
Dislin.height (50);
Dislin.title ();
}
Dislin.endgrf ();
}
Dislin.disfin ();
}
}


#### Bar Graphs / Java

import de.dislin.Dislin;

public class bars {
public static void main (String args []) {
int nya = 2700, i;
String ctit = "Bar Graphs (BARS)";
String cbuf = " ";

float x[]  = {1.f,2.f,3.f,4.f,5.f,6.f,7.f,8.f,9.f};
float y[]  = {0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f};
float y1[] = {1.f,1.5f,2.5f,1.3f,2.0f,1.2f,0.7f,1.4f,1.1f};
float y2[] = {2.f,2.7f,3.5f,2.1f,3.2f,1.9f,2.0f,2.3f,1.8f};
float y3[] = {4.f,3.5f,4.5f,3.7f,4.f,2.9f,3.0f,3.2f,2.6f};

Dislin.scrmod ("revers");
Dislin.setpag ("da4p");
Dislin.metafl ("cons");
Dislin.disini ();
Dislin.pagera ();
Dislin.complx ();
Dislin.ticks  (1,"x");
Dislin.intax  ();
Dislin.axslen (1600,700);
Dislin.titlin (ctit,3);

Dislin.legini (cbuf,3,8);
Dislin.leglin (cbuf,"FIRST",1);
Dislin.leglin (cbuf,"SECOND",2);
Dislin.leglin (cbuf,"THIRD",3);
Dislin.legtit (" ");
Dislin.shdpat (5);

for (i = 1; i <= 3; i++)
{ if (i >  1) Dislin.labels ("none","x");
Dislin.axspos (300,nya-(i-1)*800);
Dislin.graf (0.f,10.f,0.f,1.f,0.f,5.f,0.f,1.f);

if (i == 1)
{ Dislin.bargrp (3,0.15f);
Dislin.color  ("red");
Dislin.bars   (x,y,y1,9);
Dislin.color  ("green");
Dislin.bars   (x,y,y2,9);
Dislin.color  ("blue");
Dislin.bars   (x,y,y3,9);
Dislin.color  ("fore");
Dislin.reset  ("bargrp");
}
else if (i == 2)
{ Dislin.height (30);
Dislin.labels ("delta","bars");
Dislin.labpos ("center","bars");
Dislin.color  ("red");
Dislin.bars   (x,y,y1,9);
Dislin.color  ("green");
Dislin.bars   (x,y1,y2,9);
Dislin.color  ("blue");
Dislin.bars   (x,y2,y3,9);
Dislin.color  ("fore");
Dislin.reset  ("height");
}
else if (i == 3)
{ Dislin.labels ("second","bars");
Dislin.labpos ("outside","bars");
Dislin.color  ("red");
Dislin.bars   (x,y,y1,9);
Dislin.color  ("fore");
}

if (i != 3) Dislin.legend (cbuf,7);

if (i == 3)
{ Dislin.height (50);
Dislin.title  ();
}

Dislin.endgrf ();
}

Dislin.disfin ();
}
}


#### Pie Charts / Java

import de.dislin.Dislin;

public class piegrf {
public static void main (String args []) {
float xray  []  = {1.f, 2.5f, 2.f, 2.7f, 1.8f};
String ctit = "Pie Charts (PIEGRF)";
String cbuf = " ";

Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.setpag ("da4p");
Dislin.disini ();
Dislin.pagera ();
Dislin.complx ();

Dislin.chnpie ("both");

Dislin.axslen (1600, 1000);
Dislin.titlin (ctit, 2);

Dislin.legini (cbuf, 5, 8);
Dislin.leglin (cbuf, "FIRST",  1);
Dislin.leglin (cbuf, "SECOND", 2);
Dislin.leglin (cbuf, "THIRD",  3);
Dislin.leglin (cbuf, "FOURTH", 4);
Dislin.leglin (cbuf, "FIFTH",   5);

Dislin.patcyc (1, 7);
Dislin.patcyc (2, 4);
Dislin.patcyc (3, 13);
Dislin.patcyc (4, 3);
Dislin.patcyc (5, 5);

Dislin.axspos (250, 2800);
Dislin.piegrf (cbuf, 1, xray, 5);
Dislin.endgrf ();

Dislin.axspos (250, 1600);
Dislin.labels ("DATA", "PIE");
Dislin.labpos ("EXTERNAL", "PIE");
Dislin.piegrf (cbuf, 1, xray, 5);

Dislin.height (50);
Dislin.title  ();

Dislin.disfin ();
}
}


#### 3-D Bar Graph / 3-D Pie Chart / Java

import de.dislin.Dislin;

public class bar3d {
public static void main (String args []) {
float xray[]  = {2.f,4.f,6.f,8.f,10.f};
float y1ray[] = {0.f,0.f,0.f,0.f,0.f};
float y2ray[] = {3.2f,1.5f,2.0f,1.0f,3.0f};

int ic1ray[]  = {50,150,100,200,175};
int ic2ray[]  = {50,150,100,200,175};
String cbuf = " ";

Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.setpag ("da4p");
Dislin.disini ();
Dislin.pagera ();
Dislin.hwfont ();

Dislin.titlin ("3-D Bar Graph / 3-D Pie Chart", 2);
Dislin.htitle (40);

Dislin.shdpat (16);
Dislin.axslen (1500,1000);
Dislin.axspos (300,1400);

Dislin.barwth (0.5f);
Dislin.bartyp ("3dvert");
Dislin.labels ("second","bars");
Dislin.labpos ("outside","bars");
Dislin.labclr (255,"bars");
Dislin.graf   (0.f,12.f,0.f,2.f,0.f,5.f,0.f,1.f);
Dislin.title  ();
Dislin.color  ("red");
Dislin.bars   (xray,y1ray,y2ray,5);
Dislin.endgrf ();

Dislin.shdpat (16);
Dislin.labels ("data","pie");
Dislin.labclr (255,"pie");
Dislin.chnpie ("none");
Dislin.pieclr (ic1ray,ic2ray,5);
Dislin.pietyp ("3d");
Dislin.axspos (300,2700);
Dislin.piegrf (cbuf,0,y2ray,5);
Dislin.disfin ();
}
}


#### 3-D Bars / BARS3D / Java

import de.dislin.Dislin;

public class bars3d {
public static void main (String args []) {

float xray []  = {1.0f, 3.0f, 8.0f, 1.5f, 9.0f, 6.3f,
5.8f, 2.3f, 8.1f, 3.5f, 2.2f, 8.7f,
9.2f, 4.8f, 3.4f, 6.9f, 7.5f, 3.8f};
float  yray [] = {5.0f, 8.0f, 3.5f, 2.0f, 7.0f, 1.0f,
4.3f, 7.2f, 6.0f, 8.5f, 4.1f, 5.0f,
7.3f, 2.8f, 1.6f, 8.9f, 9.5f, 3.2f};
float z1ray [] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
float z2ray [] = {4.0f, 5.0f, 3.0f, 2.0f, 3.5f, 4.5f,
2.0f, 1.6f, 3.8f, 4.7f, 2.1f, 3.5f,
1.9f, 4.2f, 4.9f, 2.8f, 3.6f, 4.3f};
int icray [] = {30, 30, 30, 30, 30, 30, 100, 100, 100, 100,
100, 100, 170, 170, 170, 170, 170, 170};
int n = 18, i;
String cbuf = "";

float xwray [] = new float [n];

float ywray [] = new float [n];

for (i = 0; i < n; i++)
{ xwray[i] = 0.5f;
ywray[i] = 0.5f;
}

Dislin.scrmod ("revers");
Dislin.metafl ("xwin");
Dislin.setpag ("da4p");
Dislin.disini ();
Dislin.hwfont ();
Dislin.pagera ();

Dislin.axspos (200, 2600);
Dislin.axslen (1800, 1800);

Dislin.name   ("X-axis", "X");
Dislin.name   ("Y-axis", "Y");
Dislin.name   ("Z-axis", "Z");

Dislin.titlin ("3-D Bars / BARS3D",3);
Dislin.labl3d ("hori");

Dislin.graf3d (0.f, 10.f, 0.f, 2.f, 0.f, 10.f, 0.f, 2.f,
0.f, 5.f, 0.f, 1.f);
Dislin.grid3d (1,1, "bottom");

Dislin.bars3d (xray, yray, z1ray, z2ray, xwray,
ywray, icray, n);

Dislin.legini (cbuf, 3, 20);
Dislin.legtit (" ");
Dislin.legpos (1350, 1150);
Dislin.leglin (cbuf, "First", 1);
Dislin.leglin (cbuf, "Second", 2);
Dislin.leglin (cbuf, "Third", 3);
Dislin.legend (cbuf, 3);

Dislin.height (50);
Dislin.title ();
Dislin.disfin ();
}
}


import de.dislin.Dislin;

public class areaf {
public static void main (String args []) {
int i, j, k, ii, nl, nx, ny, nx0 = 335, ny0 = 350, iclr = 0;
int ix  [] = {0, 300, 300,   0};
int iy  [] = {0,   0, 400, 400};
int ixp [] = {0, 0, 0, 0};
int iyp [] = {0, 0, 0, 0};
String ctit = "Shading Patterns (AREAF)";

Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.disini ();
Dislin.setvlt ("small");
Dislin.pagera ();
Dislin.complx ();

Dislin.height (50);
nl = Dislin.nlmess (ctit);
Dislin.messag (ctit, (2970 - nl)/2, 200);

for (i = 0; i < 3; i++) {
ny = ny0 + i * 600;
for (j = 0; j < 6; j++) {
nx = nx0 + j * 400;
ii = i * 6 + j;
Dislin.shdpat (ii);
iclr++;
Dislin.setclr (iclr);
for (k = 0; k < 4; k++) {
ixp[k] = ix[k] + nx;
iyp[k] = iy[k] + ny;
}

Dislin.areaf (ixp, iyp, 4);
nl = Dislin.nlnumb (ii, -1);
nx = nx + (300 - nl) / 2;
Dislin.color ("foreground");
Dislin.number (ii, -1, nx, ny + 460);
}
}
Dislin.disfin ();
}
}


#### 3-D Colour Plot / Java

import de.dislin.Dislin;

public class color3d {
public static void main (String args []) {
int n = 50, m = 50, i, j;
float zmat []  = new float [n*m];

String ctit1 = "3-D Colour Plot of the Function";
String ctit2 = "F(X,Y) = 2*SIN(X)*SIN(Y)";

double x, y;
double fpi = 3.1415926/180.;
double stepx = 360. / (n-1);
double stepy = 360. / (m-1);
for (i = 0; i < n; i++) {
x = i * stepx;
for (j = 0; j < m; j++) {
y = j * stepy;
zmat[i*m+j] = (float) (2 * Math.sin(x*fpi)* Math.sin(y*fpi));
}
}

Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.disini ();
Dislin.pagera ();
Dislin.hwfont ();

Dislin.titlin (ctit1, 1);
Dislin.titlin (ctit2, 3);

Dislin.name   ("X-axis", "x");
Dislin.name   ("Y-axis", "y");
Dislin.name   ("Z-axis", "z");

Dislin.intax  ();
Dislin.autres (n, m);
Dislin.axspos (300, 1850);
Dislin.ax3len (2200, 1400, 1400);

Dislin.graf3  (0.f, 360.f, 0.f, 90.f,
0.f, 360.f, 0.f, 90.f,
-2.f, 2.f, -2.f, 1.f);
Dislin.crvmat (zmat, n, m, 1, 1);
Dislin.height (50);
Dislin.title  ();
Dislin.disfin ();
}
}


#### Surface Plot / Java

import de.dislin.Dislin;

public class surface {
public static void main (String args []) {
int n = 50, m = 50, i, j;
float zmat []  = new float [n*m];

double x, y;
double fpi = 3.1415926/180.;
double stepx = 360. / (n-1);
double stepy = 360. / (m-1);
for (i = 0; i < n; i++) {
x = i * stepx;
for (j = 0; j < m; j++) {
y = j * stepy;
zmat[i*m+j] = (float) (2 * Math.sin(x*fpi)* Math.sin(y*fpi));
}
}

Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.setpag ("da4p");
Dislin.disini ();
Dislin.pagera ();
Dislin.complx ();

Dislin.axspos (200, 2600);
Dislin.axslen (1800, 1800);

Dislin.name   ("X-axis", "x");
Dislin.name   ("Y-axis",  "y");
Dislin.name   ("Z-axis",  "z");

Dislin.titlin ("Surface Plot (SURMAT)", 1);
Dislin.titlin ("F(X,Y) = 2*SIN(X)*SIN(Y)", 3);

Dislin.view3d (-5.f, -5.f, 4.f, "abs");
Dislin.graf3d (0.f, 360.f, 0.f, 90.f,
0.f, 360.f, 0.f, 90.f,
-3.f, 3.f, -3.f, 1.f);
Dislin.height (50);
Dislin.title  ();

Dislin.color  ("green");
Dislin.surmat (zmat, n, m, 1, 1);
Dislin.disfin ();
}
}


#### Shaded Surface Plot / Java

import de.dislin.Dislin;

public class surface {
public static void main (String args []) {
int n = 50, m = 50, i, j;
float zmat []  = new float [n*m];
float xray []  = new float [n];
float yray []  = new float [m];

double x, y;
double fpi = 3.1415926/180.;
double stepx = 360. / (n-1);
double stepy = 360. / (m-1);
for (i = 0; i < n; i++) {
x = i * stepx;
xray[i] = x;
for (j = 0; j < m; j++) {
y = j * stepy;
yray[j] = y;
zmat[i*m+j] = (float) (2 * Math.sin(x*fpi)* Math.sin(y*fpi));
}
}

Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.setpag ("da4p");
Dislin.disini ();
Dislin.pagera ();
Dislin.complx ();

Dislin.axspos (200, 2600);
Dislin.axslen (1800, 1800);

Dislin.name   ("X-axis", "x");
Dislin.name   ("Y-axis",  "y");
Dislin.name   ("Z-axis",  "z");

Dislin.titlin ("F(X,Y) = 2*SIN(X)*SIN(Y)", 3);

Dislin.view3d (-5.f, -5.f, 4.f, "abs");
Dislin.graf3d (0.f, 360.f, 0.f, 90.f,
0.f, 360.f, 0.f, 90.f,
-3.f, 3.f, -3.f, 1.f);
Dislin.height (50);
Dislin.title  ();

Dislin.shdmod  ("smooth", "surface");
Dislin.surshd (xray, n, yray, m, zmat);
Dislin.disfin ();
}
}


#### Contour Plot / Java

import de.dislin.Dislin;

public class contour {
public static void main (String args []) {
int n = 50, m = 50, i, j;
float zlev;
float zmat []  = new float [n*m];
float xray []  = new float [n];
float yray []  = new float [m];

String ctit1 = "Contour Plot";
String ctit2 = "F(X,Y) = 2*SIN(X)*SIN(Y)";

double x, y;
double fpi = 3.1415926/180.;
double stepx = 360. / (n-1);
double stepy = 360. / (m-1);

for (i = 0; i < n; i++) {
xray[i] = (float) (i * stepx);
}

for (j = 0; j < m; j++) {
yray[j] = (float) (j * stepy);
}

for (i = 0; i < n; i++) {
x = xray[i] * fpi;
for (j = 0; j < m; j++) {
y = yray[j] * fpi;
zmat[i*m+j] = (float) (2 * Math.sin(x)* Math.sin(y));
}
}

Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.setpag ("da4p");
Dislin.disini ();
Dislin.pagera ();
Dislin.complx ();

Dislin.titlin (ctit1, 1);
Dislin.titlin (ctit2, 3);
Dislin.intax  ();
Dislin.axspos (450, 2650);

Dislin.name   ("X-axis", "x");
Dislin.name   ("Y-axis", "y");

Dislin.graf   (0.f, 360.f, 0.f, 90.f,
0.f, 360.f, 0.f, 90.f);
Dislin.height (50);
Dislin.title  ();

Dislin.height (30);
for (i = 0; i < 9; i++) {
zlev = -2.f + i * 0.5f;
if (i == 4) {
Dislin.labels ("none", "contur");
}
else {
Dislin.labels ("float", "contur");
}
Dislin.setclr ((i+1) * 28);
Dislin.contur (xray, n, yray, m, zmat, zlev);
}
Dislin.disfin ();
}
}


#### Shaded Contour Plot / Java

import de.dislin.Dislin;

public class conshd {
public static void main (String args []) {
int n = 50, m = 50, i, j;
float zmat []  = new float [n*m];
float xray []  = new float [n];
float yray []  = new float [m];
float zlev []  = new float [12];

String ctit1 = "Shaded Contour Plot";
String ctit2 = "F(X,Y) = (X[2$- 1)[2$ + (Y[2$- 1)[2$";

double x, y;
double stepx = 1.6 / (n-1);
double stepy = 1.6 / (m-1);

for (i = 0; i < n; i++) {
xray[i] = (float) (i * stepx);
}

for (j = 0; j < m; j++) {
yray[j] = (float) (j * stepy);
}

for (i = 0; i < n; i++) {
x = xray[i] * xray[i] - 1.;
x *= x;
for (j = 0; j < m; j++) {
y = yray[j] * yray[j] - 1;
zmat[i*m+j] = (float) (x + y * y);
}
}

Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.setpag ("da4p");
Dislin.disini ();
Dislin.pagera ();
Dislin.complx ();
Dislin.mixalf ();

Dislin.titlin (ctit1, 1);
Dislin.titlin (ctit2, 3);
Dislin.name   ("X-axis", "x");
Dislin.name   ("Y-axis", "y");
Dislin.axspos (450, 2670);
Dislin.shdmod ("poly", "contur");

Dislin.graf   (0.f, 1.6f, 0.f, 0.2f,
0.f, 1.6f, 0.f, 0.2f);
for (i = 0; i < 12; i++) {
zlev[11-i] = 0.1f + i * 0.1f;
}

Dislin.conshd (xray, n, yray, m, zmat, zlev, 12);

Dislin.height (50);
Dislin.title  ();
Dislin.disfin ();
}
}


#### Shaded Surface / Contour Plot / Java

import de.dislin.Dislin;

public class surf3 {
public static void main (String args []) {
int n = 50, m = 50, i, j, nlev = 20;
float zmat []  = new float [n*m];
float xray []  = new float [n];
float yray []  = new float [m];
float zlev []  = new float [nlev];

double x, y, step;
double fpi = 3.1415926/180.;
double stepx = 360. / (n-1);
double stepy = 360. / (m-1);
for (i = 0; i < n; i++) {
x = i * stepx;
xray[i] = (float) x;
for (j = 0; j < m; j++) {
y = j * stepy;
yray[j] = (float) y;
zmat[i*m+j] = (float) (2 * Math.sin(x*fpi)* Math.sin(y*fpi));
}
}

Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.setpag ("da4p");
Dislin.disini ();
Dislin.pagera ();
Dislin.hwfont ();

Dislin.axspos (200, 2600);
Dislin.axslen (1800, 1800);

Dislin.name   ("X-axis", "x");
Dislin.name   ("Y-axis",  "y");
Dislin.name   ("Z-axis",  "z");

Dislin.titlin ("Shaded Surface / Contour Plot", 1);
Dislin.titlin ("F(X,Y) = 2*SIN(X)*SIN(Y)", 3);

Dislin.graf3d (0.f, 360.f, 0.f, 90.f,
0.f, 360.f, 0.f, 90.f,
-2.f, 2.f, -2.f, 1.f);
Dislin.height (50);
Dislin.title  ();

Dislin.grfini (-1.f, -1.f, -1.f, 1.f, -1.f, -1.f, 1.f, 1.f, -1.f);
Dislin.nograf ();
Dislin.graf (0.f, 360.f, 0.f, 90.f, 0.f, 360.f, 0.f, 90.f);
step = 4. / nlev;
for (i = 0; i < nlev; i++)
zlev[i] = (float) (-2.0 + i * step);

Dislin.conshd (xray, n, yray, n, zmat, zlev, nlev);
Dislin.box2d ();
Dislin.reset ("nograf");
Dislin.grffin ();

Dislin.shdmod  ("smooth", "surface");
Dislin.surshd (xray, n, yray, m, zmat);
Dislin.disfin ();
}
}


#### Spheres and Tubes / Java

import de.dislin.Dislin;

public class spheres {
public static void main (String args []) {

int i, j1, j2, iret;
float x[] = {10.f, 20.f, 10.f, 20.f, 5.f, 15.f, 25.f, 5.f, 15.f, 25.f,
5.f, 15.f, 25.f, 10.f, 20.f, 10.f, 20.f};
float y[] = {10.f, 10.f, 20.f, 20.f, 5.f, 5.f, 5.f, 15.f, 15.f, 15.f,
25.f, 25.f, 25.f, 10.f, 10.f, 20.f, 20.f};
float z[] = {5.f, 5.f, 5.f, 5.f, 15.f, 15.f, 15.f, 15.f, 15.f, 15.f,
15.f, 15.f, 15.f, 25.f, 25.f, 25.f, 25.f};

int idx[] = {1, 2, 1, 3, 3, 4, 2, 4, 5, 6, 6, 7, 8, 9, 9, 10,
11, 12, 12, 13,  5, 8, 8, 11, 6, 9, 9, 12, 7, 10,
10, 13,  14, 15, 16, 17, 14, 16, 15, 17,
1, 5, 2, 7, 3, 11, 4, 13, 5, 14, 7, 15, 11, 16, 13, 17};

Dislin.setpag ("da4p");
Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.disini ();
Dislin.pagera ();
Dislin.hwfont ();
Dislin.light  ("on");
Dislin.matop3 (0.02f, 0.02f, 0.02f, "specular");

Dislin.clip3d ("none");
Dislin.axspos (0, 2500);
Dislin.axslen (2100, 2100);

Dislin.htitle (50);
Dislin.titlin ("Spheres and Tubes", 4);

Dislin.name   ("X-axis", "x");
Dislin.name   ("Y-axis", "y");
Dislin.name   ("Z-axis", "z");

Dislin.labdig (-1, "xyz");
Dislin.labl3d ("hori");
Dislin.graf3d (0.f, 30.f, 0.f, 5.f, 0.f, 30.f, 0.f, 5.f,
0.f, 30.f, 0.f, 5.f);
Dislin.title ();

Dislin.shdmod ("smooth", "surface");
iret = Dislin.zbfini();
Dislin.matop3 (1.0f, 0.0f, 0.0f, "diffuse");
for (i = 0; i < 17; i++)
Dislin.sphe3d (x[i], y[i], z[i], 2.0f, 50, 25);

Dislin.matop3 (0.0f, 1.0f, 0.0f, "diffuse");
for (i = 0; i < 56; i += 2)
{ j1 = idx[i] - 1;
j2 = idx[i+1] - 1;
Dislin.tube3d (x[j1], y[j1], z[j1], x[j2], y[j2], z[j2], 0.5f, 5, 5);
}

Dislin.zbffin ();
Dislin.disfin ();
}
}


#### Solids / Java

import de.dislin.Dislin;

public class solids {
public static void main (String args []) {
int iret;

Dislin.setpag ("da4p");
Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.disini ();
Dislin.pagera ();
Dislin.hwfont ();
Dislin.light  ("on");
Dislin.litop3 (1,0.5f, 0.5f, 0.5f, "ambient");

Dislin.clip3d ("none");
Dislin.axspos (0, 2500);
Dislin.axslen (2100, 2100);

Dislin.htitle (60);
Dislin.titlin ("Some Solids", 4);

Dislin.nograf ();
Dislin.graf3d (-5.f, 5.f, -5.f, 2.f, -5.f, 5.f, -5.f, 2.f,
-5.f, 5.f, -5.f, 2.f);
Dislin.title ();

Dislin.shdmod ("smooth", "surface");
iret = Dislin.zbfini();

Dislin.matop3 (1.0f, 0.5f, 0.0f, "diffuse");
Dislin.tube3d (-3.f, -3.f, 8.0f, 2.f, 3.f, 5.5f, 1.f, 40, 20);

Dislin.rot3d  (-60.f, 0.f, 0.f);
Dislin.matop3 (1.0f, 0.0f, 1.0f, "diffuse");
Dislin.setfce ("bottom");
Dislin.matop3 (1.0f, 0.0f, 0.0f, "diffuse");
Dislin.cone3d (-3.f, -3.f, 3.5f, 2.f, 3.f, 3.f, 40, 20);
Dislin.setfce ("top");

Dislin.rot3d  (0.f, 0.f, 0.f);
Dislin.matop3 (0.0f, 1.0f, 1.0f, "diffuse");
Dislin.plat3d (4.f, 4.f, 3.f, 3.f, "icos");

Dislin.rot3d  (0.f, 0.f, 0.f);
Dislin.matop3 (1.0f, 1.0f, 0.0f, "diffuse");
Dislin.sphe3d (0.f, 0.f, 0.f, 3.f, 40, 20);

Dislin.rot3d  (0.f, 0.f, -20.f);
Dislin.matop3 (0.0f, 0.0f, 1.0f, "diffuse");
Dislin.quad3d (-4.f, -4.f, -3.f, 3.f, 3.f, 3.f);

Dislin.rot3d  (0.f, 0.f, 30.f);
Dislin.matop3 (1.0f, 0.3f, 0.3f, "diffuse");
Dislin.pyra3d (-2.f, -5.f, -10.f, 3.f, 5.f, 5.f, 4);

Dislin.rot3d  (0.f, 0.f, 0.f);
Dislin.matop3 (1.0f, 0.0f, 0.0f, "diffuse");
Dislin.torus3d (7.f, -3.f, -2.f, 1.5f, 3.5f, 1.5f, 0.f, 360.f, 40, 20);
Dislin.rot3d  (0.f, 90.f, 0.f);

Dislin.matop3 (0.0f, 1.0f, 0.0f, "diffuse");
Dislin.torus3d (7.f, -5.f, -2.f, 1.5f, 3.5f, 1.5f, 0.f, 360.f, 40, 20);
Dislin.zbffin ();
Dislin.disfin ();
}
}


#### Map Plot / Java

import de.dislin.Dislin;

public class world {
public static void main (String args []) {

Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.disini ();
Dislin.pagera ();
Dislin.complx ();

Dislin.frame  (3);
Dislin.axspos (400, 1850);
Dislin.axslen (2400, 1400);

Dislin.name   ("Longitude", "x");
Dislin.name   ("Latitude",  "y");
Dislin.titlin ("World Coastlines and Lakes",3);

Dislin.labels ("map","xy");
Dislin.grafmp (-180.f, 180.f, -180.f, 90.f,
-90.f,  90.f,  -90.f, 30.f);

Dislin.gridmp (1, 1);
Dislin.color  ("green");
Dislin.world  ();

Dislin.color  ("fore");
Dislin.height (50);
Dislin.title  ();
Dislin.disfin ();
}
}


#### TeX Instructions for Mathematical Formulas / Java

import de.dislin.Dislin;

public class tex {
public static void main (String args []) {
int nl;
String cstr = "TeX Instructions for Mathematical Formulas";

Dislin.scrmod ("revers");
Dislin.metafl ("cons");
Dislin.setpag ("da4p");
Dislin.disini ();
Dislin.pagera ();
Dislin.complx ();
Dislin.height (40);

nl = Dislin.nlmess (cstr);
Dislin.messag (cstr, (2100 - nl)/2, 100);

Dislin.texmod ("on");
Dislin.messag ("$\\frac{1}{x+y}$", 150, 400);
Dislin.messag ("$\\frac{a^2 - b^2}{a+b} = a - b$", 1200, 400);

Dislin.messag ("$r = \\sqrt{x^2 + y^2}", 150, 700); Dislin.messag ("$\\cos \\phi = \\frac{x}{\\sqrt{x^2 + y^2}}$", 1200, 700); Dislin.messag ("$\\Gamma(x) = \\int_0^\\infty e^{-t}t^{x-1}dt$", 150, 1000); Dislin.messag ("$\\lim_{x \\to \\infty} (1 + \\frac{1}{x})^x = e$", 1200, 1000); Dislin.messag ("$\\mu = \\sum_{i=1}^n x_i p_i$", 150, 1300); Dislin.messag ("$\\mu = \\int_{-\\infty}^ \\infty x f(x) dx$", 1200, 1300); Dislin.messag ("$\\overline{x} = \\frac{1}{n} \\sum_{i=1}^n x_i$", 150, 1600); Dislin.messag ("$s^2 = \\frac{1}{n-1} \\sum_{i=1}^n (x_i - \\overline{x})^2$", 1200, 1600); Dislin.messag ("$\\sqrt[n]{\\frac{x^n - y^n}{1 + u^{2n}}}$", 150, 1900); Dislin.messag ("$\\sqrt[3]{-q + \\sqrt{q^2 + p^3}}$", 1200, 1900); Dislin.messag ("$\\int \\frac{dx}{1+x^2} = \\arctan x + C$", 150, 2200); Dislin.messag ("$\\int \\frac{dx}{\\sqrt{1+x^2}} = {\\rm arsinh} x + C$", 1200, 2200); Dislin.messag ("$\\overline{P_1P_2} = \\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}$", 150,2500); Dislin.messag ("$x = \\frac{x_1 + \\lambda x_2}{1 + \\lambda}\$",
1200, 2500);
Dislin.disfin ();
}
}