DISLIN Examples / C++
Demonstration of CURVE / C++
#include <iostream> #include <cmath> #include "discpp.h" int main () { int n = 100, i, ic; double fpi = 3.1415926 / 180.0, step, x; double xray[100], y1ray[100], y2ray[100]; Dislin g; step = 360. / (n - 1); for (i = 0; i < n; i++) { xray[i] = i * step; x = xray[i] * fpi; y1ray[i] = sin (x); y2ray[i] = cos (x); } g.metafl ("cons"); g.scrmod ("revers"); g.disini (); g.pagera (); g.complx (); g.axspos (450, 1800); g.axslen (2200, 1200); g.name ("X-axis", "x"); g.name ("Y-axis", "y"); g.labdig (-1, "x"); g.ticks (9, "x"); g.ticks (10, "y"); g.titlin ("Demonstration of CURVE", 1); g.titlin ("SIN(X), COS(X)", 3); ic=g.intrgb (0.95,0.95,0.95); g.axsbgd (ic); g.graf (0.0, 360.0, 0.0, 90.0, -1.0, 1.0, -1.0, 0.5); g.setrgb (0.7, 0.7, 0.7); g.grid (1, 1); g.color ("fore"); g.height (50); g.title (); g.color ("red"); g.curve (xray, y1ray, n); g.color ("green"); g.curve (xray, y2ray, n); g.disfin (); return 0; }
Polar Plots / C++
#include <iostream> #include <cmath> #include "discpp.h" int main () { int n = 300, m = 10, i, ic; double f = 3.1415926 / 180.0, step, a; double xray[300], yray[300], x2[10], y2[10]; Dislin g; step = 360. / (n - 1); for (i = 0; i < n; i++) { a = i * step * f; yray[i] = a; xray[i] = sin (5 * a); } for (i = 0; i < m; i++) { x2[i] = i + 1; y2[i] = i + 1; } g.setpag ("da4p"); g.metafl ("cons"); g.scrmod ("revers"); g.disini (); g.pagera (); g.hwfont (); g.axspos (450,1800); g.titlin ("Polar Plots", 2); g.ticks (3, "Y"); g.axends ("NOENDS", "X"); g.labdig (-1, "Y"); g.axslen (1000, 1000); g.axsorg (1050, 900); ic = g.intrgb (0.95, 0.95, 0.95); g.axsbgd (ic); g.grafp (1.0, 0.0, 0.2, 0.0, 30.0); g.color ("blue"); g.curve (xray, yray, n); g.color ("fore"); g.htitle (50); g.title (); g.endgrf (); g.labdig (-1, "X"); g.axsorg (1050, 2250); g.labtyp ("VERT", "Y"); g.grafp (10.0, 0.0, 2.0, 0.0, 30.0); g.barwth (-5.0); g.polcrv ("FBARS"); g.color ("blue"); g.curve (x2, y2, m); g.disfin (); return 0; }
Symbols / C++
#include <iostream> #include "discpp.h" int main () { int nl, ny, i, nxp; static const char ctit[] = "Symbols"; char cstr[80]; Dislin g; g.scrmod ("revers"); g.setpag ("da4p"); g.metafl ("cons"); g.disini (); g.pagera (); g.complx (); g.height (60); nl = g.nlmess (ctit); g.messag (ctit, (2100 - nl) / 2, 200); g.height (50); g.hsymbl (120); ny = 150; for (i = 0; i < 24; i++) { if ((i % 4) == 0) { ny += 400; nxp = 550; } else { nxp += 350; } nl = g.intcha (i, cstr); nl = g.nlmess (cstr) / 2; g.messag (cstr, nxp - nl, ny + 150); g.symbol (i, nxp, ny); } g.disfin (); return 0; }
Interpolation Methods / C++
#include <iostream> #include "discpp.h" int main () { int nya = 2700, i, nx, ny, ic; double x[] = {0.0, 1.0, 3.0, 4.5, 6.0, 8.0, 9.0, 11.0, 12.0, 12.5, 13.0, 15.0, 16.0, 17.0, 19.0, 20.0}, y[] = {2.0, 4.0, 4.5, 3.0, 1.0, 7.0, 2.0, 3.0, 5.0, 2.0, 2.5, 2.0, 4.0, 6.0, 5.5, 4.0}; const char *cpol[6] = {"SPLINE", "STEM", "BARS", "STAIRS", "STEP", "LINEAR"}; const char *ctit = "Interpolation Methods"; Dislin g; g.setpag ("da4p"); g.metafl ("cons"); g.scrmod ("revers"); g.disini (); g.complx (); g.pagera (); g.incmrk (1); g.hsymbl (25); g.titlin (ctit, 2); g.axslen (1500, 350); g.setgrf ("line", "line", "line", "line"); ic = g.intrgb (1.0, 1.0, 0.0); g.axsbgd (ic); for (i = 0; i < 6; i++) { g.axspos (350, nya - i * 350); g.polcrv (cpol[i]); g.marker(16); g.graf (0.0, 20.0, 0.0, 5.0, 0.0, 10.0, 0.0, 5.0); nx = g.nxposn (1.0); ny = g.nyposn (8.0); g.messag (cpol[i], nx, ny); g.color ("red"); g.curve (x, y, 16); g.color ("fore"); if (i == 5) { g.height (50); g.title (); } g.endgrf (); } g.disfin (); return 0; }
Bar Graphs / C++
#include <iostream> #include "discpp.h" int main () { int nya = 2700, i; const char *ctit = "Bar Graphs (BARS)"; char cbuf[25]; double x[9] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0}, y[9] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, y1[9] = {1.0, 1.5, 2.5, 1.3, 2.0, 1.2, 0.7, 1.4, 1.1}, y2[9] = {2.0, 2.7, 3.5, 2.1, 3.2, 1.9, 2.0, 2.3, 1.8}, y3[9] = {4.0, 3.5, 4.5, 3.7, 4.0, 2.9, 3.0, 3.2, 2.6}; Dislin g; g.scrmod ("revers"); g.setpag ("da4p"); g.metafl ("cons"); g.disini (); g.pagera (); g.complx (); g.ticks (1, "x"); g.intax ();; g.axslen (1600, 700); g.titlin (ctit, 3); g.legini (cbuf, 3, 8); g.leglin (cbuf, "FIRST", 1); g.leglin (cbuf, "SECOND", 2); g.leglin (cbuf, "THIRD", 3); g.legtit (" "); g.shdpat (5); for (i = 1; i <= 3; i++) { if (i > 1) g.labels ("none", "x"); g.axspos (300, nya - (i - 1) * 800); g.graf (0.0, 10.0, 0.0, 1.0, 0.0, 5.0, 0.0, 1.0); if (i == 1) { g.bargrp (3, 0.15); g.color ("red"); g.bars (x, y, y1, 9); g.color ("green"); g.bars (x, y, y2, 9); g.color ("blue"); g.bars (x, y, y3, 9); g.color ("fore"); g.reset ("bargrp"); } else if (i == 2) { g.height (30); g.labels ("delta", "bars"); g.labpos ("center", "bars"); g.color ("red"); g.bars (x, y, y1, 9); g.color ("green"); g.bars (x, y1, y2, 9); g.color ("blue"); g.bars (x, y2, y3, 9); g.color ("fore"); g.reset ("height"); } else if (i == 3) { g.labels ("second", "bars"); g.labpos ("outside", "bars"); g.color ("red"); g.bars (x, y, y1, 9); g.color ("fore"); } if (i != 3) g.legend (cbuf, 7); if (i == 3) { g.height (50); g.title (); } g.endgrf (); } g.disfin (); return 0; }
Pie Charts / C++
#include <iostream> #include "discpp.h" int main () { int nya = 2800, i; const char *ctit = "Pie Charts (PIEGRF)"; char cbuf[41]; double xray[5] = {1.0, 2.5, 2.0, 2.7, 1.8}; Dislin g; g.scrmod ("revers"); g.setpag ("da4p"); g.metafl ("cons"); g.disini (); g.pagera (); g.complx (); g.axslen (1600, 1000); g.titlin (ctit, 2); g.chnpie ("both"); g.legini (cbuf, 5, 8); g.leglin (cbuf, "FIRST", 1); g.leglin (cbuf, "SECOND", 2); g.leglin (cbuf, "THIRD", 3); g.leglin (cbuf, "FOURTH", 4); g.leglin (cbuf, "FIFTH", 5); g.patcyc (1, 7); g.patcyc (2, 4); g.patcyc (3, 13); g.patcyc (4, 3); g.patcyc (5, 5); for (i = 0; i < 2; i++) { g.axspos (250, nya - i * 1200); if (i == 1) { g.labels ("data", "pie"); g.labpos ("external", "pie"); } g.piegrf (cbuf, 1, xray, 5); if (i == 1) { g.height (50); g.title (); } g.endgrf (); } g.disfin (); return 0; }
3-D Bar Graph / 3-D Pie Chart / C++
#include <iostream> #include "discpp.h" int main () { char cbuf[80]; double xray[5] = {2.0, 4.0, 6.0, 8.0, 10.0}, y1ray[5] = {0.0, 0.0, 0.0, 0.0, 0.0}, y2ray[5] = {3.2, 1.5, 2.0, 1.0, 3.0}; int ic1ray[5] = {50, 150, 100, 200, 175}, ic2ray[5] = {50, 150, 100, 200, 175}; Dislin g; g.scrmod ("revers"); g.setpag ("da4p"); g.metafl ("cons"); g.disini (); g.pagera (); g.hwfont (); g.titlin ("3-D Bar Graph / 3-D Pie Chart", 2); g.htitle (40); g.shdpat (16); g.axslen (1500, 1000); g.axspos (300, 1400); g.barwth (0.5); g.bartyp ("3dvert"); g.labels ("second", "bars"); g.labpos ("outside", "bars"); g.labclr (255, "bars"); g.graf (0.0, 12.0, 0.0, 2.0, 0.0, 5.0, 0.0, 1.0); g.title (); g.color ("red"); g.bars (xray, y1ray, y2ray, 5); g.endgrf (); g.shdpat (16); g.labels ("data", "pie"); g.labclr (255, "pie"); g.chnpie ("none"); g.pieclr (ic1ray, ic2ray, 5); g.pietyp ("3d"); g.axspos (300, 2700); g.piegrf (cbuf, 0, y2ray, 5); g.disfin (); return 0; }
3-D Bars / BARS3D / C++
#include <iostream> #include "discpp.h" #define N 18 int main () { double xwray[N],ywray[N]; int i; char cbuf[80]; double xray[N] = {1.0, 3.0, 8.0, 1.5, 9.0, 6.3, 5.8, 2.3, 8.1, 3.5, 2.2, 8.7, 9.2, 4.8, 3.4, 6.9, 7.5, 3.8}; double yray[N] = {5.0, 8.0, 3.5, 2.0, 7.0, 1.0, 4.3, 7.2, 6.0, 8.5, 4.1, 5.0, 7.3, 2.8, 1.6, 8.9, 9.5, 3.2}; double z1ray[N] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; double z2ray[N] = {4.0, 5.0, 3.0, 2.0, 3.5, 4.5, 2.0, 1.6, 3.8, 4.7, 2.1, 3.5, 1.9, 4.2, 4.9, 2.8, 3.6, 4.3}; int icray[N] = {30, 30, 30, 30, 30, 30, 100, 100, 100, 100, 100, 100, 170, 170, 170, 170, 170, 170}; Dislin g; for (i = 0; i < N; i++) { xwray[i] = 0.5; ywray[i] = 0.5; } g.scrmod ("revers"); g.setpag ("da4p"); g.metafl ("cons"); g.disini (); g.pagera (); g.hwfont (); g.axspos (200, 2600); g.axslen (1800, 1800); g.name ("X-axis", "x"); g.name ("Y-axis", "y"); g.name ("Z-axis", "z"); g.titlin ("3-D Bars / BARS3D", 3); g.labl3d ("hori"); g.graf3d (0.0, 10.0, 0.0, 2.0, 0.0, 10.0, 0.0, 2.0, 0.0, 5.0, 0.0, 1.0); g.grid3d (1, 1, "bottom"); g.bars3d (xray, yray, z1ray, z2ray, xwray, ywray, icray, N); g.legini (cbuf, 3, 20); g.legtit (" "); g.legpos (1350, 1150); g.leglin (cbuf, "First", 1); g.leglin (cbuf, "Second", 2); g.leglin (cbuf, "Third", 3); g.legend (cbuf, 3); g.height (50); g.title (); g.disfin (); return 0; }
Shading Patterns / C++
#include <iostream> #include "discpp.h" int main () { int ixp[4], iyp[4], nl, nx, nx0 = 335, ny0 = 350, ny, i, j, ii, k, iclr; int ix[4] = {0, 300, 300, 0}, iy[4] = {0, 0, 400, 400}; const char *ctit = "Shading Patterns (AREAF)"; char cstr[80]; Dislin g; g.scrmod ("revers"); g.metafl ("cons"); g.disini (); g.pagera (); g.complx (); g.setvlt ("small"); g.height (50); nl = g.nlmess (ctit); nx = (2970 - nl) / 2; g.messag (ctit, nx, 200); iclr = 0; for (i = 0; i < 3; i++) { ny = ny0 +i * 600; for (j = 0; j < 6; j++) { nx = nx0 + j * 400; ii = i * 6 + j; nl = g.intcha (ii, cstr); g.shdpat (ii); iclr = iclr % 16; iclr++; g.setclr (iclr); for (k = 0; k < 4; k++) { ixp[k] = ix[k] + nx; iyp[k] = iy[k] + ny; } g.areaf (ixp, iyp, 4); nl = g.nlmess (cstr); nx += (300 - nl) / 2; g.messag (cstr, nx, ny + 460); } } g.disfin (); return 0; }
3-D Colour Plot / C++
#include <iostream> #include <cmath> #include "discpp.h" double zmat[100][100]; int main () { int n = 100, i, j; double fpi = 3.1415927 / 180.0, step, x, y; Dislin g; step = 360.0/ (n - 1); for (i = 0; i < n; i++) { x = i * step; for (j = 0; j < n; j++) { y = j * step; zmat[i][j] = 2 * sin (x * fpi) *sin (y * fpi); } } g.scrmod ("revers"); g.metafl ("cons"); g.disini (); g.pagera (); g.hwfont (); g.titlin ("3-D Colour Plot of the Function", 2); g.titlin ("F(X,Y) = 2 * SIN(X) * SIN(Y)", 4); g.name ("X-axis", "x"); g.name ("Y-axis", "y"); g.name ("Z-axis", "z"); g.intax (); g.autres (n, n); g.axspos (300, 1850); g.ax3len (2200, 1400, 1400); g.graf3 (0.0, 360.0, 0.0, 90.0, 0.0, 360.0, 0.0, 90.0, -2.0, 2.0, -2.0, 1.0); g.crvmat ((double *) zmat, n, n, 1, 1); g.height (50); g.title (); g.disfin (); return 0; }
Surface Plot / C++
#include <iostream> #include <cmath> #include "discpp.h" double zmat[50][50]; int main () { int n = 50 ,i, j; double fpi = 3.1415927 / 180.0, step, x, y; const char *ctit1 = "Surface Plot (SURMAT)", *ctit2 = "F(X,Y) = 2*SIN(X)*SIN(Y)"; Dislin g; step = 360.0 / (n - 1); for (i = 0; i < n; i++) { x = i * step; for (j = 0; j < n; j++) { y = j * step; zmat[i][j] = 2 * sin (x * fpi) *sin(y * fpi); } } g.scrmod ("revers"); g.setpag ("da4p"); g.metafl ("cons"); g.disini (); g.pagera (); g.complx (); g.axspos (200, 2600); g.axslen (1800, 1800); g.name ("X-axis", "x"); g.name ("Y-axis", "y"); g.name ("Z-axis", "z"); g.titlin (ctit1, 2); g.titlin (ctit2, 4); g.view3d (-5.0, -5.0, 4.0, "abs"); g.graf3d (0.0, 360.0, 0.0, 90.0, 0.0, 360.0, 0.0, 90.0, -3.0, 3.0, -3.0, 1.0); g.height (50); g.title (); g.color ("green"); g.surmat ((double *) zmat, 50, 50, 1, 1); g.disfin (); return 0; }
Shaded Surface Plot / C++
#include <iostream> #include <cmath> #include "discpp.h" double zmat[50][50], xray[50], yray[50]; int main () { int n = 50 ,i, j; double fpi = 3.1415927 / 180.0, step, x, y; const char *ctit1 = "Shaded Surface Plot", *ctit2 = "F(X,Y) = 2*SIN(X)*SIN(Y)"; Dislin g; step = 360.0/ (n - 1); for (i = 0; i < n; i++) { x = i * step; xray[i] = x; for (j = 0; j < n; j++) { y = j * step; yray[j] = y; zmat[i][j] = 2 * sin (x * fpi) * sin (y * fpi); } } g.scrmod ("revers"); g.setpag ("da4p"); g.metafl ("cons"); g.disini (); g.pagera (); g.complx (); g.axspos (200, 2600); g.axslen (1800, 1800); g.name ("X-axis", "x"); g.name ("Y-axis", "y"); g.name ("Z-axis", "z"); g.titlin (ctit1, 2); g.titlin (ctit2, 4); g.view3d (-5.0, -5.0, 4.0, "abs"); g.graf3d (0.0, 360.0, 0.0, 90.0, 0.0, 360.0, 0.0, 90.0, -3.0, 3.0, -3.0, 1.0); g.height (50); g.title (); g.shdmod ("smooth", "surface"); g.surshd (xray, n, yray, n, (double *) zmat); g.disfin (); return 0; }
Contour Plot / C++
#include <iostream> #include <cmath> #include "discpp.h" double xray[50], yray[50], zmat[50][50]; int main () { int n = 50, i, j; double fpi = 3.14159 / 180.0, step, x, y; double zlev; Dislin g; step = 360.0/ (n - 1); for (i = 0; i < n; i++) { xray[i] = i * step; yray[i] = i * step; } for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { x = xray[i] * fpi; y = yray[j] * fpi; zmat[i][j] = 2 * sin (x) * sin (y); } } g.scrmod ("revers"); g.setpag ("da4p"); g.metafl ("cons"); g.disini (); g.complx (); g.pagera (); g.titlin ("Contour Plot", 1); g.titlin ("F(X,Y) = 2 * SIN(X) * SIN(Y)", 3); g.name ("X-axis", "x"); g.name ("Y-axis", "y"); g.intax (); g.axspos (450, 2670); g.graf (0.0, 360.0, 0.0, 90.0, 0.0, 360.0, 0.0, 90.0); g.height (30); for (i = 0; i < 9; i++) { zlev = -2.0 + i * 0.5; g.setclr ((i + 1) * 25); if (i == 4) g.labels ("none", "contur"); else g.labels ("float", "contur"); g.contur (xray, n, yray, n,(double *) zmat, zlev); } g.height (50); g.color ("fore"); g.title (); g.disfin (); return 0; }
Shaded Contour Plot / C++
#include <iostream> #include <cmath> #include "discpp.h" double xray[50], yray[50], zmat[50][50]; int main () { int n = 50, i, j; double step, x, y; double zlev[12]; Dislin g; step = 1.6 / (n - 1); for (i = 0; i < n; i++) { x = 0.0 + i * step; xray[i] = x; for (j = 0; j < n; j++) { y = 0.0 + j * step; yray[j] = y; zmat[i][j] = (x * x - 1.0) * (x * x - 1.0) + (y * y - 1.0) * (y * y - 1.0); } } g.scrmod ("revers"); g.setpag ("da4p"); g.metafl ("cons"); g.disini (); g.pagera (); g.complx (); g.mixalf (); g.titlin ("Shaded Contour Plot", 1); g.titlin ("F(X,Y) = (X[2$ - 1)[2$ + (Y[2$ - 1)[2$", 3); g.name ("X-axis", "x"); g.name ("Y-axis", "y"); g.shdmod ("poly", "contur"); g.axspos (450, 2670); g.graf (0.0, 1.6, 0.0, 0.2, 0.0, 1.6, 0.0, 0.2); for (i = 1; i <= 12; i++) zlev[12-i] = 0.1 + (i - 1) * 0.1; g.conshd (xray, n, yray, n, (double *) zmat, zlev, 12); g.height (50); g.title (); g.disfin (); return 0; }
Shaded Surface / Contour Plot / C++
#include <iostream> #include <cmath> #include "discpp.h" double zmat[50][50], xray[50], yray[50], zlev[20]; int main () { int n = 50 ,i, j, nlev = 20; double fpi = 3.1415927 / 180.0, step, x, y; const char *ctit1 = "Shaded Surface / Contour Plot", *ctit2 = "F(X,Y) = 2*SIN(X)*SIN(Y)"; Dislin g; step = 360.0 / (n - 1); for (i = 0; i < n; i++) { x = i * step; xray[i] = x; for (j = 0; j < n; j++) { y = j * step; yray[j] = y; zmat[i][j] = 2 * sin (x * fpi) * sin (y * fpi); } } g.scrmod ("revers"); g.setpag ("da4p"); g.metafl ("cons"); g.disini (); g.pagera (); g.hwfont (); g.axspos (200, 2600); g.axslen (1800, 1800); g.name ("X-axis", "x"); g.name ("Y-axis", "y"); g.name ("Z-axis", "z"); g.titlin (ctit1, 2); g.titlin (ctit2, 4); g.graf3d (0.0, 360.0, 0.0, 90.0, 0.0, 360.0, 0.0, 90.0, -2.0, 2.0, -2.0, 1.0); g.height (50); g.title (); g.grfini (-1.0, -1.0, -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, -1.0); g.nograf (); g.graf (0.0, 360.0, 0.0, 90.0, 0.0, 360.0, 0.0, 90.0); step = 4.0 / nlev; for (i = 0; i < nlev; i++) zlev[i] = -2.0 + i * step; g.conshd (xray, n, yray, n, (double *) zmat, zlev, nlev); g.box2d (); g.reset ("nograf"); g.grffin (); g.shdmod ("smooth", "surface"); g.surshd (xray, n, yray, n, (double *) zmat); g.disfin (); return 0; }
Spheres and Tubes / C++
#include <iostream> #include "discpp.h" int main () { int i, j1, j2, iret; double x[17] = {10.0, 20.0, 10.0, 20.0, 5.0, 15.0, 25.0, 5.0, 15.0, 25.0, 5.0, 15.0, 25.0, 10.0, 20.0, 10.0, 20.0}; double y[17] = {10.0, 10.0, 20.0, 20.0, 5.0, 5.0, 5.0, 15.0, 15.0, 15.0, 25.0, 25.0, 25.0, 10.0, 10.0, 20.0, 20.0}; double z[17] = {5.0, 5.0, 5.0, 5.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 25.0, 25.0, 25.0, 25.0}; 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 g; g.setpag ("da4p"); g.scrmod ("revers"); g.metafl ("cons"); g.disini (); g.pagera (); g.hwfont (); g.light ("on"); g.matop3 (0.02, 0.02, 0.02, "specular"); g.clip3d ("none"); g.axspos (0, 2500); g.axslen (2100, 2100); g.htitle (50); g.titlin ("Spheres and Tubes", 4); g.name ("X-axis", "x"); g.name ("Y-axis", "y"); g.name ("Z-axis", "z"); g.labdig (-1, "xyz"); g.labl3d ("hori"); g.graf3d (0.0, 30.0, 0.0, 5.0, 0.0, 30.0, 0.0, 5.0, 0.0, 30.0, 0.0, 5.0); g.title (); g.shdmod ("smooth", "surface"); iret = g.zbfini (); g.matop3 (1.0, 0.0, 0.0, "diffuse"); for (i = 0; i < 17; i++) g.sphe3d (x[i], y[i], z[i], 2.0, 50, 25); g.matop3 (0.0, 1.0, 0.0, "diffuse"); for (i = 0; i < 56; i += 2) { j1 = idx[i] - 1; j2 = idx[i+1] - 1; g.tube3d (x[j1], y[j1], z[j1], x[j2], y[j2], z[j2], 0.5, 5, 5); } g.zbffin (); g.disfin (); return 0; }
Some Solids / C++
#include <iostream> #include "discpp.h" int main () { int iret; Dislin g; g.setpag ("da4p"); g.scrmod ("revers"); g.metafl ("cons"); g.disini (); g.pagera (); g.hwfont (); g.light ("on"); g.litop3 (1, 0.5, 0.5, 0.5, "ambient"); g.clip3d ("none"); g.axspos (0, 2500); g.axslen (2100, 2100); g.htitle (60); g.titlin ("Some Solids", 4); g.nograf (); g.graf3d (-5.0, 5.0, -5.0, 2.0, -5.0, 5.0, -5.0, 2.0, -5.0, 5.0, -5.0, 2.0); g.title (); g.shdmod ("smooth", "surface"); iret = g.zbfini (); g.matop3 (1.0, 0.5, 0.0, "diffuse"); g.tube3d (-3.0, -3.0, 8.0, 2.0, 3.0, 5.5, 1.0, 40, 20); g.rot3d (-60.0, 0.0, 0.0); g.matop3 (1.0, 0.0, 1.0, "diffuse"); g.setfce ("bottom"); g.matop3 (1.0, 0.0, 0.0, "diffuse"); g.cone3d (-3.0, -3.0, 3.5, 2.0, 3.0, 3.0, 40, 20); g.setfce ("top"); g.rot3d (0.0, 0.0, 0.0); g.matop3 (0.0, 1.0, 1.0, "diffuse"); g.plat3d (4.0, 4.0, 3.0, 3.0, "icos"); g.rot3d (0.0, 0.0, 0.0); g.matop3 (1.0, 1.0, 0.0, "diffuse"); g.sphe3d (0.0, 0.0, 0.0, 3.0, 40, 20); g.rot3d (0.0, 0.0, -20.0); g.matop3 (0.0, 0.0, 1.0, "diffuse"); g.quad3d (-4.0, -4.0, -3.0, 3.0, 3.0, 3.0); g.rot3d (0.0, 0.0, 30.0); g.matop3 (1.0, 0.3, 0.3, "diffuse"); g.pyra3d (-2.0, -5.0, -10.0, 3.0, 5.0, 5.0, 4); g.rot3d (0.0, 0.0, 0.0); g.matop3 (1.0, 0.0, 0.0, "diffuse"); g.torus3d (7.0, -3.0, -2.0, 1.5, 3.5, 1.5, 0.0, 360.0, 40, 20); g.rot3d (0.0, 90.0, 0.0); g.matop3 (0.0, 1.0, 0.0, "diffuse"); g.torus3d (7.0, -5.0, -2.0, 1.5, 3.5, 1.5, 0.0, 360.0, 40, 20); g.zbffin (); g.disfin (); return 0; }
Map Plot / C++
#include <iostream> #include "discpp.h" int main () { Dislin g; g.scrmod ("revers"); g.metafl ("cons"); g.disini (); g.pagera (); g.complx (); g.frame (3); g.axspos (400, 1850); g.axslen (2400, 1400); g.name ("Longitude", "x"); g.name ("Latitude", "y"); g.titlin ("World Coastlines and Lakes", 3); g.labels ("map", "xy"); g.grafmp (-180.0, 180.0, -180.0, 90.0, -90.0, 90.0, -90.0, 30.0); g.gridmp (1, 1); g.color ("green"); g.world (); g.color ("fore"); g.height (50); g.title (); g.disfin (); return 0; }
TeX Instructions for Mathematical Formulas / C++
#include <iostream> #include "discpp.h" int main () { const char *cstr = "TeX Instructions for Mathematical Formulas"; int nl; Dislin g; g.scrmod ("revers"); g.setpag ("da4p"); g.metafl ("cons"); g.disini (); g.pagera (); g.complx (); g.height (40); nl = g.nlmess (cstr); g.messag (cstr, (2100 - nl)/2, 100); g.texmod ("on"); g.messag ("$\\frac{1}{x+y}$", 150, 400); g.messag ("$\\frac{a^2 - b^2}{a+b} = a - b$", 1200, 400); g.messag ("$r = \\sqrt{x^2 + y^2}", 150, 700); g.messag ("$\\cos \\phi = \\frac{x}{\\sqrt{x^2 + y^2}}$", 1200, 700); g.messag ("$\\Gamma(x) = \\int_0^\\infty e^{-t}t^{x-1}dt$", 150, 1000); g.messag ("$\\lim_{x \\to \\infty} (1 + \\frac{1}{x})^x = e$", 1200, 1000); g.messag ("$\\mu = \\sum_{i=1}^n x_i p_i$", 150, 1300); g.messag ("$\\mu = \\int_{-\\infty}^ \\infty x f(x) dx$", 1200, 1300); g.messag ("$\\overline{x} = \\frac{1}{n} \\sum_{i=1}^n x_i$", 150, 1600); g.messag ("$s^2 = \\frac{1}{n-1} \\sum_{i=1}^n (x_i - \\overline{x})^2$", 1200, 1600); g.messag ("$\\sqrt[n]{\\frac{x^n - y^n}{1 + u^{2n}}}$", 150, 1900); g.messag ("$\\sqrt[3]{-q + \\sqrt{q^2 + p^3}}$", 1200, 1900); g.messag ("$\\int \\frac{dx}{1+x^2} = \\arctan x + C$", 150, 2200); g.messag ("$\\int \\frac{dx}{\\sqrt{1+x^2}} = {\\rm arsinh} x + C$", 1200, 2200); g.messag ("$\\overline{P_1P_2} = \\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}$", 150,2500); g.messag ("$x = \\frac{x_1 + \\lambda x_2}{1 + \\lambda}$", 1200, 2500); g.disfin (); return 0; }

News
Support for Python 3.11 and Windows
28. July 2023
Bug fix for the X11 distributions
22. July 2023
Upgrade 11.5.1
25. April 2023
Support for Linux 64-bit on IBM z series
30. October 2022
Support for MingW 64-bit UCRT runtime environment
28. September 2022
Release 11.5
15. March 2022
Release 11.4
15. March 2021
Support for Free Pascal 64-bit on Windows
22. July 2020
Upgrade 11.3.3
28. June 2020
Upgrade 11.3.2
19. May 2020
DISLIN Book Version 11 is available
8. March 2017
28. July 2023
Bug fix for the X11 distributions
22. July 2023
Upgrade 11.5.1
25. April 2023
Support for Linux 64-bit on IBM z series
30. October 2022
Support for MingW 64-bit UCRT runtime environment
28. September 2022
Release 11.5
15. March 2022
Release 11.4
15. March 2021
Support for Free Pascal 64-bit on Windows
22. July 2020
Upgrade 11.3.3
28. June 2020
Upgrade 11.3.2
19. May 2020
DISLIN Book Version 11 is available
8. March 2017