## DISLIN Beispiele / Visual Basic

#### Demonstration of CURVE / Visual Basic

Imports System

Public Class App
Public Shared Sub Main ()

Const [N] As Integer = 300
Dim xray([N]), y1ray([N]), y2ray([N]) As Single
Dim x, stp, fpi As Single
Dim i, ic As Integer

fpi = 3.1415926f / 180
stp = 360.0f / ([N])

For i = 0 To [N]
xray(i) = i * stp
x = xray(i) * fpi
y1ray(i) =  Math.Sin (x)
y2ray(i) =  Math.Cos (x)
Next i

dislin.scrmod ("revers")
dislin.metafl ("xwin")
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 (10, "Y")
dislin.ticks (9, "X")

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

ic = dislin.intrgb  (0.95, 0.95, 0.95)
dislin.axsbgd (ic)

dislin.graf   (0.0f, 360.0f, 0.0f, 90.0f, -1.0f, 1.0f, -1.0f, 0.5f)
dislin.setrgb (0.7, 0.7, 0.7)
dislin.grid (1, 1)

dislin.color ("fore")
dislin.title  ()

dislin.color  ("red")
dislin.curve  (xray, y1ray, [N] + 1)
dislin.color  ("green")
dislin.curve  (xray, y2ray, [N] + 1)

dislin.color  ("fore")
dislin.disfin ()

End Sub
End Class



#### Polar Plots / Visual Basic

Imports System

Public Class App
Public Shared Sub Main ()

Dim n As Integer = 300 - 1
Dim m As Integer = 10 - 1
Dim pi As Single = 3.1415926
Dim xray (n), x1(n), y1 (n) As Single
Dim x2 (m), y2 (m) As Single
Dim a, x, f, stp As Single
Dim i, ic As Integer

f = pi / 180.0
stp = 360.0 / n
For i = 0 To n
a = i * stp * f
xray(i) = i * stp
x = xray(i) * f
y1(i) = a
x1(i) = Math.Sin (5 * a)
Next i

For i = 0 To m
x2(i) = i + 1
y2(i) = i + 1
Next i

dislin.setpag ("da4p")
dislin.metafl ("cons")
dislin.scrmod ("revers")
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.95, 0.95, 0.95)
dislin.axsbgd (ic)

dislin.grafp  (1.0, 0.0, 0.2, 0.0, 30.0)
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.0, 0.0, 2.0, 0.0, 30.0)
dislin.barwth (-5.0)
dislin.polcrv ("FBARS")
dislin.color  ("blue")
dislin.curve  (x2, y2, m)
dislin.disfin ()

End Sub
End Class



#### Symbols / Visual Basic

Imports System
Imports System.Text

Public Class App
Public Shared Sub Main ()

Dim ctit As String = "Symbols"
Dim i, nl, ny, nxp As Integer
Dim v As Single

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

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

dislin.height (50)
dislin.hsymbl (120)

ny = 150
For i = 0 To 23
If (i Mod 4) = 0 Then
ny += 400
nxp = 550
Else
nxp += 350
End If
v = i
nl = dislin.nlnumb (v, -1)
dislin.number (v, -1, nxp - nl/2, ny + 150)
dislin.symbol (i, nxp, ny)
Next i
dislin.disfin ()

End Sub
End Class


#### Interpolation Methods / Visual Basic

Imports System

Public Class App
Public Shared Sub Main ()

Dim xray () As Single = {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}
Dim yray () As Single = {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}
Dim ctit As String = "Interpolation Methods"
Dim cpol () As String = {"SPLINE", "STEM", "BARS", "STAIRS", "STEP", _
"LINEAR"}
Dim ic, i, nya, nx, ny As Integer

dislin.setpag ("da4p")
dislin.scrmod ("reverse")
dislin.metafl ("xwin")

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.0, 1.0, 0.0)
dislin.axsbgd (ic)

nya = 2700
For i = 0 To 5
dislin.axspos (350, nya - i * 350)
dislin.polcrv (cpol(i))
dislin.marker (0)
dislin.graf   (0.0, 20.0, 0.0, 5.0, 0.0, 10.0, 0.0, 5.0)
nx = dislin.nxposn (1.0)
ny = dislin.nyposn (8.0)
dislin.messag (cpol(i), nx, ny)
dislin.color  ("red")
dislin.curve  (xray, yray, 16)
dislin.color  ("fore")

If i = 5 Then
dislin.height (50)
dislin.title ()
End If
dislin.endgrf ()
Next i
dislin.disfin ()

End Sub
End Class


#### Bar Graphs / Visual Basic

Imports System
Imports System.Text

Public Class App
Public Shared Sub Main ()

Dim cbuf As New StringBuilder (80)
Dim x () As Single = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0}
Dim y () As Single = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}
Dim y1 () As Single = {1.0, 1.5, 2.5, 1.3, 2.0, 1.2, 0.7, 1.4, 1.1}
Dim y2 () As Single = {2.0, 2.7, 3.5, 2.1, 3.2, 1.9, 2.0, 2.3, 1.8}
Dim y3 () As Single = {4.0, 3.5, 4.5, 3.7, 4.0, 2.9, 3.0, 3.2, 2.6}
Dim nya As Integer = 2700
Dim i As Integer
Dim ctit As String = "Bar Graphs (BARS)"

dislin.setpag ("da4p")
dislin.scrmod ("revers")
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 To 3
If i > 1 Then
dislin.labels ("none","x")
End If

dislin.axspos (300, nya-(i-1)*800)
dislin.graf (0.0, 10.0, 0.0, 1.0, 0.0, 5.0, 0.0, 1.0)

If i = 1 Then
dislin.bargrp (3, 0.15)
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")
ElseIf i = 2 Then
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")
ElseIf i = 3 Then
dislin.labels ("second", "bars")
dislin.labpos ("outside", "bars")
dislin.color  ("red")
dislin.bars   (x, y, y1, 9)
dislin.color  ("fore")
End If

If i <> 3 Then
dislin.legend (cbuf, 7)
End If

If i = 3 Then
dislin.height (50)
dislin.title  ()
End If

dislin.endgrf ()
Next i

dislin.disfin ()
End Sub
End Class


#### Pie Charts / Visual Basic

Imports System
Imports System.Text

Public Class App
Public Shared Sub Main ()

Dim xray () As Single = {1.0, 2.5, 2.0, 2.7, 1.8}
Dim ctit As String = "Pie Charts (PIEGRF)"
Dim cbuf As New StringBuilder (80)

dislin.setpag ("da4p")
dislin.scrmod ("revers")
dislin.metafl ("cons")
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.ToString (), 1, xray, 5)
dislin.endgrf ()

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

dislin.height (50)
dislin.title  ()
dislin.disfin ()

End Sub
End Class


#### 3-D Bar Graph / 3-D Pie Chart / Visual Basic

Imports System
Imports System.Text

Public Class App
Public Shared Sub Main ()

Dim xray () As Single = {2.0, 4.0, 6.0, 8.0, 10.0}
Dim y1ray () As Single = {0.0, 0.0, 0.0, 0.0, 0.0}
Dim y2ray () As Single = {3.2, 1.5, 2.0, 1.0, 3.0}
Dim ic1ray () As Integer = {50, 150, 100, 200, 175}
Dim ic2ray () As Integer = {50, 150, 100, 200, 175}
Dim cbuf As New StringBuilder (80)

dislin.metafl ("cons")
dislin.setpag ("da4p")
dislin.scrmod ("revers")
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.5)
dislin.bartyp ("3dvert")
dislin.labels ("second", "bars")
dislin.labpos ("outside", "bars")
dislin.labclr (255, "bars")
dislin.graf   (0.0, 12.0, 0.0, 2.0, 0.0, 5.0, 0.0, 1.0)
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.ToString (), 0, y2ray, 5)
dislin.disfin ()

End Sub
End Class


#### 3-D Bars / BARS3D / Visual Basic

Imports System
Imports System.Text

Public Class App
Public Shared Sub Main ()

Dim n As Integer = 17
Dim xray () As Single = {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}
Dim yray () As Single = {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}
Dim z1ray () As Single = {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}
Dim z2ray () As Single = {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}
Dim icray () As Integer = {30, 30, 30, 30, 30, 30, 100, 100, 100, 100,     _
100, 100, 170, 170, 170, 170, 170, 170}
Dim xwray (17), ywray (17) As Single
Dim cbuf As New StringBuilder (80)
Dim i As Integer

For i = 0 To n
xwray(i) = 0.5
ywray(i) = 0.5
Next i

dislin.metafl ("xwin")
dislin.scrmod ("revers")
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.0,10.0,0.0,2.0,0.0,10.0,0.0,2.0,0.0,5.0,0.0,1.0)
dislin.grid3d (1,1, "bottom")

dislin.bars3d (xray, yray, z1ray, z2ray, xwray, ywray, icray, n + 1)

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 ()

End Sub
End Class


#### Shading Patterns / Visual Basic

Imports System
Imports System.Text

Public Class App
Public Shared Sub Main ()

Dim ix ()  As Integer = {0, 300, 300,   0}
Dim iy ()  As Integer = {0,   0, 400, 400}
Dim ixp () As Integer = {0, 0, 0, 0}
Dim iyp () As Integer = {0, 0, 0, 0}
Dim ctit As String = "Shading patterns (AREAF)"
Dim i, j, k, ii, nl, nx0, ny0, iclr, nx, ny As Integer
Dim v As Single

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

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

nx0 = 335
ny0 = 350

iclr = 0
For  i = 0 To 2
ny = ny0 + i * 600
For j = 0 To 5
nx = nx0 + j * 400
ii = i * 6 + j
dislin.shdpat (ii)
iclr = iclr Mod 8
iclr = iclr + 1
dislin.setclr (iclr)
For k = 0 To 3
ixp(k) = ix(k) + nx
iyp(k) = iy(k) + ny
Next k

dislin.areaf (ixp, iyp, 4)
nl = dislin.nlnumb (ii, -1)
nx += (300 - nl) / 2
dislin.color ("foreground")
v = ii
dislin.number (v, -1, nx, ny + 460)
Next j
Next i
dislin.disfin ()

End Sub
End Class


#### 3-D Colour Plot / Visual Basic

Imports System
Imports System.Text

Public Class App
Public Shared Sub Main ()

Const [N] As Integer = 100
Dim zmat(100,100) As Single
Dim x, y, stp, fpi As Single
Dim i, j As Integer

fpi = 3.1415926f / 180
stp = 360.0f / [N]

For i = 0 To [N]
x = i * stp
For j = 0 To [N]
y = j * stp
zmat (i,j) = 2 * Math.Sin (x * fpi) * Math.Sin (y * fpi)
Next j
Next i

dislin.scrmod ("revers")
dislin.metafl ("xwin")
dislin.disini ()
dislin.pagera ()
dislin.hwfont ()

dislin.titlin ("3-D Colour Plot of the Function", 1)
dislin.titlin ("F(X,Y) = 2 * SIN(X) * SIN(Y)", 3)
dislin.name ("X-axis", "X")
dislin.name ("Y-axis", "Y")
dislin.name ("Z-axis", "Z")

dislin.axspos (300, 1850)
dislin.ax3len (2200, 1400, 1400)

dislin.intax ()
dislin.autres (n, n)
dislin.graf3 (0.0f, 360.0f, 0.0f, 90.0f, 0.0f, 360.0f, 0.0f, 90.0f, _
-2.0f, 2.0f, -2.0f, 1.0f)
dislin.crvmat (zmat, [N] + 1, [N] + 1, 1, 1)

dislin.height (50)
dislin.title ()
dislin.disfin ()

End Sub
End Class


#### Surface Plot / Visual Basic

Imports System
Imports System.Text

Public Class App
Public Shared Sub Main ()

Const [N] As Integer = 50
Dim zmat([N],[N]) As Single
Dim x, y, stp, fpi As Single
Dim i, j As Integer

fpi = 3.1415926f / 180
stp = 360.0f / [N]

For i = 0 To [N]
x = i * stp
For j = 0 To [N]
y = j * stp
zmat (i,j) = 2 * Math.Sin (x * fpi) * Math.Sin (y * fpi)
Next j
Next i

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

dislin.titlin ("Surface Plot of the Function", 2)
dislin.titlin ("F(X,Y) = 2 * SIN(X) * SIN(Y)", 4)

dislin.axspos (200, 2600)
dislin.axslen (1800, 1800)

dislin.name ("X-axis", "X")
dislin.name ("Y-axis", "Y")
dislin.name ("Z-axis", "Z")

dislin.view3d (-5.0f, -5.0f, 4.0f, "ABS")
dislin.graf3d (0.0f, 360.0f, 0.0f, 90.0f, 0.0f, 360.0f, 0.0f, 90.0f, _
-3.0f, 3.0f, -3.0f, 1.0f)
dislin.height (50)
dislin.title ()

dislin.color ("green")
dislin.surmat (zmat, [N] + 1, [N] + 1, 1, 1)
dislin.disfin ()

End Sub
End Class


#### Shaded Surface Plot / Visual Basic

Imports System
Imports System.Text

Public Class App
Public Shared Sub Main ()

Const [N] As Integer = 50
Const [M] As Integer = 50
Dim xray([N]) As Single
Dim yray([M]) As Single
Dim zmat([N],[M]) As Single
Dim stpx, stpy, fpi As Single
Dim i, j As Integer

fpi = 3.1415926f / 180
stpx = 360.0f / [N]
stpy = 360.0f / [M]

For i = 0 To [N]
xray (i) = i * stpx
For j = 0 To [M]
yray (j) = j * stpy
zmat (i,j) = 2 * Math.Sin (xray(i) * fpi) * Math.Sin (yray(j) * fpi)
Next j
Next i

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

dislin.titlin ("Surface Plot of the Function", 2)
dislin.titlin ("F(X,Y) = 2 * SIN(X) * SIN(Y)", 4)

dislin.axspos (200, 2600)
dislin.axslen (1800, 1800)

dislin.name ("X-axis", "X")
dislin.name ("Y-axis", "Y")
dislin.name ("Z-axis", "Z")

dislin.view3d (-5.0f, -5.0f, 4.0f, "ABS")
dislin.graf3d (0.0f, 360.0f, 0.0f, 90.0f, 0.0f, 360.0f, 0.0f, 90.0f, _
-3.0f, 3.0f, -3.0f, 1.0f)
dislin.height (50)
dislin.title ()

dislin.shdmod ("smooth", "surface")
dislin.surshd (xray, [N] + 1, yray, [M] + 1, zmat)
dislin.disfin ()

End Sub
End Class


#### Contour Plot / Visual Basic

Imports System
Imports System.Text

Public Class App
Public Shared Sub Main ()

Const [N] As Integer = 60
Const [M] As Integer = 50
Dim xray([N]) As Single
Dim yray([M]) As Single
Dim zmat([N],[M]) As Single
Dim stpx, stpy, fpi As Single
Dim ctit1 As String = "Contour Plot"
Dim ctit2 As String = "F(X,Y) = 2 * SIN(X) * SIN (Y)"
Dim zlev As Single
Dim i, j As Integer

fpi = 3.1415926f / 180
stpx = 360.0f / [N]
stpy = 360.0f / [M]

For i = 0 To [N]
xray (i) = i * stpx
For j = 0 To [M]
yray (j) = j * stpy
zmat (i,j) = 2 * Math.Sin (xray(i) * fpi) * Math.Sin (yray(j) * fpi)
Next j
Next i

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

dislin.titlin (ctit1, 2)
dislin.titlin (ctit2, 4)

dislin.axspos (450, 2670)

dislin.intax  ()
dislin.name   ("X-axis", "X")
dislin.name   ("Y-axis", "Y")
dislin.graf  (0.0, 360.0, 0.0, 90.0, 0.0, 360.0, 0.0, 90.0)

dislin.height (30)
For i = 0 To 8
zlev = -2.0 + i * 0.5
If i = 4 then
dislin.labels ("NONE", "CONTUR")
Else
dislin.labels ("FLOAT", "CONTUR")
End If
dislin.setclr ((i+1) * 28)
dislin.contur (xray, n + 1, yray, m + 1, zmat, zlev)
Next i

dislin.color  ("FORE")
dislin.height (50)
dislin.title  ()
dislin.disfin ()

End Sub
End Class


#### Shaded Contour Plot / Visual Basic

Imports System
Imports System.Text

Public Class App
Public Shared Sub Main ()

Const [N] As Integer = 50
Const [M] As Integer = 80
Dim xray([N]) As Single
Dim yray([M]) As Single
Dim zmat([N],[M]) As Single
Dim zlev(11) As Single
Dim stpx, stpy, x, x2, y, y2 As Single
Dim ctit1 As String = "Shaded Contour Plot"
Dim ctit2 As String = "F(X,Y) = (X[2$- 1)[2$ + (Y[2$- 1)[2$"
Dim i, j As Integer

stpx = 1.6 / n
stpy = 1.6 / n

For i = 0 To [N]
xray (i) = i * stpx
x = xray (i) * xray (i) - 1.0
x2 = x * x
For j = 0 To [M]
yray (j) = j * stpy
y = yray (j) * yray (j) - 1.0
y2 = y * y
zmat (i,j) = x2 + y2
Next j
Next i

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

dislin.titlin (ctit1, 2)
dislin.titlin (ctit2, 4)

dislin.axspos (450, 2670)

dislin.name   ("X-axis", "X")
dislin.name   ("Y-axis", "Y")
dislin.shdmod ("poly", "contur")
dislin.graf   (0.0, 1.6, 0.0, 0.2, 0.0, 1.6, 0.0, 0.2)

For i = 0 To 11
zlev(11-i) = 0.1 + i * 0.1
Next i

dislin.conshd (xray, n + 1, yray, m + 1, zmat, zlev, 12)

dislin.height (50)
dislin.title  ()
dislin.disfin ()

End Sub
End Class


#### Shaded Surface / Contour Plot / Visual Basic

Imports System

Public Class App
Public Shared Sub Main ()

Dim n As INTEGER = 50
Dim m As INTEGER = 50
Dim nlev As INTEGER = 19
Dim x(n), y(m), zmat (n,m), zlev (nlev) As Single
Dim ctit1 As String = "Shaded Surface / Contour Plot"
Dim ctit2 As String = "F(X,Y) = 2 * SIN(X) * SIN (Y)"
Dim fpi, stpx, stpy, stp As Single
Dim i, j As Integer

fpi  = 3.1415927 / 180.0
stpx = 360.0 / n
stpy = 360.0 / m

For i = 0 To n
x(i) = i * stpx
For j = 0 To m
y(j) = j * stpy
zmat(i,j) = 2 * Math.Sin(x(i) * fpi) * Math.Sin(y(j) * fpi)
Next j
Next i

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

dislin.titlin (ctit1, 2)
dislin.titlin (ctit2, 4)

dislin.axspos (200, 2600)
dislin.axslen (1800, 1800)

dislin.name   ("X-axis", "X")
dislin.name   ("Y-axis", "Y")
dislin.name   ("Z-axis", "Z")

dislin.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)
dislin.height (50)
dislin.title  ()

dislin.grfini (-1.0, -1.0, -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, -1.0)
dislin.nograf ()
dislin.graf (0.0, 360.0, 0.0, 90.0, 0.0, 360.0, 0.0, 90.0)

stp = 4.0 / nlev
For i = 0 To nlev
zlev(i) = -2.0 + i * stp
Next i
dislin.conshd (x, n + 1, y, m + 1, zmat, zlev, nlev + 1)

dislin.box2d ()
dislin.reset ("nograf")
dislin.grffin ()

dislin.shdmod ("smooth", "surface")
dislin.surshd (x, n + 1, y, m + 1, zmat)
dislin.disfin ()

End Sub
End Class


#### Spheres and Tubes / Visual Basic

Imports System

Public Class App
Public Shared Sub Main ()

Dim x () As Single = {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}
Dim y () As Single = {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}
Dim z () As Single = {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}
Dim idx () As Integer = {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}
Dim iret, i, j1, j2 As Integer

dislin.setpag ("da4p")
dislin.scrmod ("revers")
dislin.metafl ("cons")
dislin.disini ()
dislin.pagera ()
dislin.hwfont ()
dislin.light ("on")
dislin.matop3 (0.02, 0.02, 0.02, "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.0, 30.0, 0.0, 5.0, 0.0, 30.0, 0.0, 5.0, _
0.0, 30.0, 0.0, 5.0)
dislin.title ()

dislin.shdmod ("smooth", "surface")

iret = dislin.zbfini ()
dislin.matop3 (1.0, 0.0, 0.0, "diffuse")
For i = 0 To 16
dislin.sphe3d (x(i), y(i), z(i), 2.0, 50, 25)
Next i

dislin.matop3 (0.0, 1.0, 0.0, "diffuse")
For i = 0 To 55 Step 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.5, 5, 5)
Next i

dislin.zbffin ()
dislin.disfin ()

End Sub
End Class


#### Some Solids / Visual Basic

Imports System

Public Class App
Public Shared Sub Main ()
Dim iret As Integer

dislin.setpag ("da4p")
dislin.scrmod ("revers")
dislin.metafl ("cons")
dislin.disini ()
dislin.pagera ()
dislin.hwfont ()
dislin.light ("on")
dislin.litop3(1,0.5,0.5,0.5,"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.0, 5.0, -5.0, 2.0, -5.0, 5.0, -5.0, 2.0, _
-5.0, 5.0, -5.0, 2.0)
dislin.title ()

dislin.shdmod ("smooth", "surface")
iret = dislin.zbfini()
dislin.matop3 (1.0, 0.5, 0.0, "diffuse")
dislin.tube3d (-3.0, -3.0, 8.0, 2.0, 3.0, 5.5, 1.0, 40, 20)

dislin.rot3d (-60.0, 0.0, 0.0)
dislin.matop3 (1.0, 0.0, 1.0, "diffuse")
dislin.setfce ("bottom")
dislin.matop3 (1.0, 0.0, 0.0, "diffuse")
dislin.cone3d (-3.0, -3.0, 3.5, 2.0, 3.0, 3.0, 40, 20)
dislin.setfce ("top")

dislin.rot3d (0.0, 0.0, 0.0)
dislin.matop3 (0.0, 1.0, 1.0, "diffuse")
dislin.plat3d (4.0, 4.0, 3.0, 3.0, "icos")

dislin.rot3d (0.0, 0.0, 0.0)
dislin.matop3 (1.0, 1.0, 0.0, "diffuse")
dislin.sphe3d (0.0, 0.0, 0.0, 3.0, 40, 20)

dislin.rot3d (0.0, 0.0, -20.0)
dislin.matop3 (0.0, 0.0, 1.0, "diffuse")
dislin.quad3d (-4.0, -4.0, -3.0, 3.0, 3.0, 3.0)

dislin.rot3d (0.0, 0.0, 30.0)
dislin.matop3 (1.0, 0.3, 0.3, "diffuse")
dislin.pyra3d (-2.0, -5.0, -10.0, 3.0, 5.0, 5.0, 4)

dislin.rot3d (0.0, 0.0, 0.0)
dislin.matop3 (1.0, 0.0, 0.0, "diffuse")
dislin.torus3d (7.0, -3.0, -2.0, 1.5, 3.5, 1.5, 0.0, 360.0, 40, 20)
dislin.rot3d (0.0, 90.0, 0.0)

dislin.matop3 (0.0, 1.0, 0.0, "diffuse")
dislin.torus3d (7.0, -5.0, -2.0, 1.5, 3.5, 1.5, 0.0, 360.0, 40, 20)
dislin.zbffin ()
dislin.disfin ()

End Sub
End Class


#### Map Plot / Visual Basic

Imports System

Public Class App
Public Shared Sub Main ()

dislin.scrmod ("revers")
dislin.metafl ("cons")
dislin.disini ()
dislin.pagera ()
dislin.complx ()

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.labdig (-1, "XY")
dislin.grafmp (-180.0f, 180.0f, -180.0f, 90.0f, _
-90.0f, 90.0f, -90.0f, 30.0f)
dislin.gridmp (1,1)
dislin.color  ("green")
dislin.world ()

dislin.color  ("fore")
dislin.height (50)
dislin.title ()
dislin.disfin ()

End Sub
End Class


#### TeX Instructions for Mathematical Formulas / Visual Basic

Imports System

Public Class App
Public Shared Sub Main ()

Dim ctit As String = "TeX Instructions for Mathematical Formulas"
Dim nl As Integer

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

nl =   dislin.nlmess (ctit)
dislin.messag (ctit, (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 ()

End Sub
End Class