<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net_Tutorial%2F2D_Graphics%2F3D</id>
		<title>VB.Net Tutorial/2D Graphics/3D - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net_Tutorial%2F2D_Graphics%2F3D"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_Tutorial/2D_Graphics/3D&amp;action=history"/>
		<updated>2026-04-05T08:55:07Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net_Tutorial/2D_Graphics/3D&amp;diff=3357&amp;oldid=prev</id>
		<title> в 16:40, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_Tutorial/2D_Graphics/3D&amp;diff=3357&amp;oldid=prev"/>
				<updated>2010-05-26T16:40:30Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:40, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net_Tutorial/2D_Graphics/3D&amp;diff=3358&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_Tutorial/2D_Graphics/3D&amp;diff=3358&amp;oldid=prev"/>
				<updated>2010-05-26T12:55:08Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==3D Ball==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&amp;quot;Visual Basic.Net JingCai Programming 100 Examples&lt;br /&gt;
&amp;quot;Author: Yong Zhang&lt;br /&gt;
&amp;quot;Publisher: Water Publisher China&lt;br /&gt;
&amp;quot;ISBN: 750841156&lt;br /&gt;
&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
public class Draw3DBall&lt;br /&gt;
   public Shared Sub Main&lt;br /&gt;
        Application.Run(New Form1)&lt;br /&gt;
   End Sub&lt;br /&gt;
End class&lt;br /&gt;
Public Class Form1&lt;br /&gt;
    Inherits System.Windows.Forms.Form&lt;br /&gt;
    Public Sub New()&lt;br /&gt;
        MyBase.New()&lt;br /&gt;
        InitializeComponent()&lt;br /&gt;
    End Sub&lt;br /&gt;
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
        If disposing Then&lt;br /&gt;
            If Not (components Is Nothing) Then&lt;br /&gt;
                components.Dispose()&lt;br /&gt;
            End If&lt;br /&gt;
        End If&lt;br /&gt;
        MyBase.Dispose(disposing)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private components As System.ruponentModel.IContainer&lt;br /&gt;
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox&lt;br /&gt;
    Friend WithEvents Button1 As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents Button2 As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents Button3 As System.Windows.Forms.Button&lt;br /&gt;
    &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; Private Sub InitializeComponent()&lt;br /&gt;
        Me.PictureBox1 = New System.Windows.Forms.PictureBox&lt;br /&gt;
        Me.Button1 = New System.Windows.Forms.Button&lt;br /&gt;
        Me.Button2 = New System.Windows.Forms.Button&lt;br /&gt;
        Me.Button3 = New System.Windows.Forms.Button&lt;br /&gt;
        Me.SuspendLayout()&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;PictureBox1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.PictureBox1.BackColor = System.Drawing.SystemColors.Window&lt;br /&gt;
        Me.PictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D&lt;br /&gt;
        Me.PictureBox1.Dock = System.Windows.Forms.DockStyle.Top&lt;br /&gt;
        Me.PictureBox1.Location = New System.Drawing.Point(0, 0)&lt;br /&gt;
        Me.PictureBox1.Name = &amp;quot;PictureBox1&amp;quot;&lt;br /&gt;
        Me.PictureBox1.Size = New System.Drawing.Size(528, 312)&lt;br /&gt;
        Me.PictureBox1.TabIndex = 0&lt;br /&gt;
        Me.PictureBox1.TabStop = False&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button1.Location = New System.Drawing.Point(24, 336)&lt;br /&gt;
        Me.Button1.Name = &amp;quot;Button1&amp;quot;&lt;br /&gt;
        Me.Button1.Size = New System.Drawing.Size(64, 32)&lt;br /&gt;
        Me.Button1.TabIndex = 1&lt;br /&gt;
        Me.Button1.Text = &amp;quot;Shape 1&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button2&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button2.Location = New System.Drawing.Point(120, 336)&lt;br /&gt;
        Me.Button2.Name = &amp;quot;Button2&amp;quot;&lt;br /&gt;
        Me.Button2.Size = New System.Drawing.Size(64, 32)&lt;br /&gt;
        Me.Button2.TabIndex = 2&lt;br /&gt;
        Me.Button2.Text = &amp;quot;3D Curve&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button3&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button3.Location = New System.Drawing.Point(232, 336)&lt;br /&gt;
        Me.Button3.Name = &amp;quot;Button3&amp;quot;&lt;br /&gt;
        Me.Button3.Size = New System.Drawing.Size(72, 32)&lt;br /&gt;
        Me.Button3.TabIndex = 3&lt;br /&gt;
        Me.Button3.Text = &amp;quot;Ball&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Form1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)&lt;br /&gt;
        Me.ClientSize = New System.Drawing.Size(528, 382)&lt;br /&gt;
        Me.Controls.Add(Me.Button3)&lt;br /&gt;
        Me.Controls.Add(Me.Button2)&lt;br /&gt;
        Me.Controls.Add(Me.Button1)&lt;br /&gt;
        Me.Controls.Add(Me.PictureBox1)&lt;br /&gt;
        Me.ResumeLayout(False)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Dim g As System.Drawing.Graphics&lt;br /&gt;
    Dim pen1 As New System.Drawing.Pen(Color.Green, 0.5)&lt;br /&gt;
    Const PI = 3.14159&lt;br /&gt;
    Dim flag, col, r, h, hl, n, n1 As Short&lt;br /&gt;
    Dim x, y, z, cx, cy, cz, thx, thy, thz As Single&lt;br /&gt;
    Dim ed, od, eh As Short&lt;br /&gt;
    Dim point1, point2, point3, point4, point5 As System.Drawing.Point&lt;br /&gt;
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;
        Dim th As Single&lt;br /&gt;
        Static ax(9), ay(9), az(9)&lt;br /&gt;
        Static bx(9), by(9), bz(9)&lt;br /&gt;
        h = 160 : thy = 0.2&lt;br /&gt;
        col = 0 : n1 = 1&lt;br /&gt;
        r = 100&lt;br /&gt;
        n = 8&lt;br /&gt;
        thx = 0.2&lt;br /&gt;
        PictureBox1.Refresh()&lt;br /&gt;
        ax(0) = h : ay(0) = h : az(0) = h&lt;br /&gt;
        n1 = 1&lt;br /&gt;
        For th = 0 To 2 * PI + 0.1 Step 2 * PI / n&lt;br /&gt;
            x = r * Math.Cos(th) : y = -h : z = r * Math.Sin(th)&lt;br /&gt;
            Call roty() : Call rotx()&lt;br /&gt;
            bx(n1) = x : by(n1) = y : bz(n1) = z&lt;br /&gt;
            n1 = n1 + 1&lt;br /&gt;
        Next th&lt;br /&gt;
        For n1 = 1 To n&lt;br /&gt;
            x = ax(n1) : y = ay(n1)&lt;br /&gt;
            Call linzuiti()&lt;br /&gt;
            x = ax(n1 + 1) : y = ay(n1 + 1)&lt;br /&gt;
            Call linzuiti()&lt;br /&gt;
            x = bx(n1 + 1) : y = by(n1 + 1)&lt;br /&gt;
            Call linzuiti()&lt;br /&gt;
            x = bx(n1) : y = by(n1)&lt;br /&gt;
            Call linzuiti()&lt;br /&gt;
        Next n1&lt;br /&gt;
    End Sub&lt;br /&gt;
    Public Sub linzuiti()&lt;br /&gt;
        Dim gx, gy As Single&lt;br /&gt;
        gx = 250 + x&lt;br /&gt;
        gy = 180 + y&lt;br /&gt;
        If flag = 0 Then point1.X = gx : point1.Y = gy&lt;br /&gt;
        flag = 1&lt;br /&gt;
        point2.X = gx : point2.Y = gy&lt;br /&gt;
        g = PictureBox1.CreateGraphics&lt;br /&gt;
        g.DrawLine(pen1, point1, point2)&lt;br /&gt;
        point1 = point2&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub rotx()&lt;br /&gt;
        Dim yw, zw As Single&lt;br /&gt;
        yw = y : zw = z&lt;br /&gt;
        y = yw * Math.Cos(thx) - zw * Math.Sin(thx)&lt;br /&gt;
        z = yw * Math.Sin(thx) + zw * Math.Cos(thx)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub roty()&lt;br /&gt;
        Dim zw, xw As Single&lt;br /&gt;
        zw = z : xw = x&lt;br /&gt;
        x = zw * Math.Cos(thy) - xw * Math.Sin(thy)&lt;br /&gt;
        z = zw * Math.Sin(thy) + xw * Math.Cos(thy)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click&lt;br /&gt;
        PictureBox1.Refresh()&lt;br /&gt;
        g = PictureBox1.CreateGraphics&lt;br /&gt;
        Dim x, y, s, cx, cy, zz, xx, yy As Single&lt;br /&gt;
        Dim h, a, b, sx, sx1, sx2, sy, sy1, sy2 As Integer&lt;br /&gt;
        Dim x1, x2, y1, y2, xw, yw As Integer&lt;br /&gt;
        s = pi / 16&lt;br /&gt;
        x1 = -3&lt;br /&gt;
        x2 = 3&lt;br /&gt;
        xw = x2 - x1&lt;br /&gt;
        y1 = -9 : y2 = 9 : yw = y2 - y1&lt;br /&gt;
        sx1 = 140 : sx2 = 600&lt;br /&gt;
        sy1 = 360 : sy2 = 100&lt;br /&gt;
        cx = (sx2 - sx1) / xw&lt;br /&gt;
        cy = (sy1 - sy2) / yw&lt;br /&gt;
        h = 170 : a = 6 : b = 6&lt;br /&gt;
        For y = y1 + 6 To y2 - 6 Step 1 / cy&lt;br /&gt;
            For x = x1 To x2 Step 1 / cx * 2&lt;br /&gt;
                zz = h * Math.Exp(-x * x / a * a - y * y / b * b)&lt;br /&gt;
                xx = x * cx + sx1 + 160&lt;br /&gt;
                yy = sy1 - y * cy&lt;br /&gt;
                sx = Int(xx + y * cy * Math.Cos(s))&lt;br /&gt;
                sy = yy - zz&lt;br /&gt;
                sy = sy - 100&lt;br /&gt;
                If x = -3 Then&lt;br /&gt;
                    point1.X = sx - 60 : point1.Y = sy - 20&lt;br /&gt;
                Else : point2.X = sx - 60 : point2.Y = sy - 20&lt;br /&gt;
                    g.DrawLine(pen1, point1, point2)&lt;br /&gt;
                    point1 = point2&lt;br /&gt;
                End If&lt;br /&gt;
            Next x&lt;br /&gt;
        Next y&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click&lt;br /&gt;
        PictureBox1.Refresh()&lt;br /&gt;
        g = PictureBox1.CreateGraphics&lt;br /&gt;
        Dim i, r As Integer&lt;br /&gt;
        Dim x, y, z, s, q, p, px, py As Single&lt;br /&gt;
        Dim mx(600), my(600) As Integer&lt;br /&gt;
        s = pi / 4&lt;br /&gt;
        r = 100&lt;br /&gt;
        i = 1&lt;br /&gt;
        q = -pi / 2 + 0.1&lt;br /&gt;
        For p = 0 To 2 * pi Step 0.2&lt;br /&gt;
            x = r * Math.Cos(q) * Math.Sin(p)&lt;br /&gt;
            y = r * Math.Sin(q)&lt;br /&gt;
            z = r * Math.Cos(q) * Math.Cos(p)&lt;br /&gt;
            px = x * 1.2&lt;br /&gt;
            py = y - z * Math.Sin(s)&lt;br /&gt;
            mx(i) = px + 200&lt;br /&gt;
            my(i) = 150 - py&lt;br /&gt;
            i = i + 1&lt;br /&gt;
        Next p&lt;br /&gt;
        point1.X = mx(1) : point1.Y = my(1)&lt;br /&gt;
        For q = -pi / 2 + 0.2 To pi / 2 Step 0.2&lt;br /&gt;
            i = 1&lt;br /&gt;
            For p = 0 To 2 * pi Step 0.2&lt;br /&gt;
                x = r * Math.Cos(q) * Math.Sin(p)&lt;br /&gt;
                y = r * Math.Sin(q)&lt;br /&gt;
                z = r * Math.Cos(q) * Math.Cos(p)&lt;br /&gt;
                px = x * 1.2&lt;br /&gt;
                py = y - z * Math.Sin(s)&lt;br /&gt;
                point2.X = px + 200 : point2.Y = 150 - py&lt;br /&gt;
                g.DrawLine(pen1, point1, point2)&lt;br /&gt;
                point1 = point2&lt;br /&gt;
                point3.X = mx(i) : point3.Y = my(i)&lt;br /&gt;
                point4.X = px + 200 : point4.Y = 150 - py&lt;br /&gt;
                g.DrawLine(pen1, point3, point4)&lt;br /&gt;
                point3 = point4&lt;br /&gt;
                mx(i) = px + 200&lt;br /&gt;
                my(i) = 150 - py&lt;br /&gt;
                i = i + 1&lt;br /&gt;
            Next p&lt;br /&gt;
            p = 0&lt;br /&gt;
            x = r * Math.Cos(q) * Math.Sin(p)&lt;br /&gt;
            y = r * Math.Sin(q)&lt;br /&gt;
            z = r * Math.Cos(q) * Math.Cos(p)&lt;br /&gt;
            px = x * 1.2&lt;br /&gt;
            py = y - z * Math.Sin(s)&lt;br /&gt;
            point5.X = px + 200 : point5.Y = 150 - py&lt;br /&gt;
            g.DrawLine(pen1, point4, point5)&lt;br /&gt;
            point4 = point5&lt;br /&gt;
        Next q&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==3D Curve==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&amp;quot;Visual Basic.Net JingCai Programming 100 Examples&lt;br /&gt;
&amp;quot;Author: Yong Zhang&lt;br /&gt;
&amp;quot;Publisher: Water Publisher China&lt;br /&gt;
&amp;quot;ISBN: 750841156&lt;br /&gt;
&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
public class Draw3DCurve&lt;br /&gt;
   public Shared Sub Main&lt;br /&gt;
        Application.Run(New Form1)&lt;br /&gt;
   End Sub&lt;br /&gt;
End class&lt;br /&gt;
Public Class Form1&lt;br /&gt;
    Inherits System.Windows.Forms.Form&lt;br /&gt;
    Public Sub New()&lt;br /&gt;
        MyBase.New()&lt;br /&gt;
        InitializeComponent()&lt;br /&gt;
    End Sub&lt;br /&gt;
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
        If disposing Then&lt;br /&gt;
            If Not (components Is Nothing) Then&lt;br /&gt;
                components.Dispose()&lt;br /&gt;
            End If&lt;br /&gt;
        End If&lt;br /&gt;
        MyBase.Dispose(disposing)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private components As System.ruponentModel.IContainer&lt;br /&gt;
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox&lt;br /&gt;
    Friend WithEvents Button1 As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents Button2 As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents Button3 As System.Windows.Forms.Button&lt;br /&gt;
    &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; Private Sub InitializeComponent()&lt;br /&gt;
        Me.PictureBox1 = New System.Windows.Forms.PictureBox&lt;br /&gt;
        Me.Button1 = New System.Windows.Forms.Button&lt;br /&gt;
        Me.Button2 = New System.Windows.Forms.Button&lt;br /&gt;
        Me.Button3 = New System.Windows.Forms.Button&lt;br /&gt;
        Me.SuspendLayout()&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;PictureBox1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.PictureBox1.BackColor = System.Drawing.SystemColors.Window&lt;br /&gt;
        Me.PictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D&lt;br /&gt;
        Me.PictureBox1.Dock = System.Windows.Forms.DockStyle.Top&lt;br /&gt;
        Me.PictureBox1.Location = New System.Drawing.Point(0, 0)&lt;br /&gt;
        Me.PictureBox1.Name = &amp;quot;PictureBox1&amp;quot;&lt;br /&gt;
        Me.PictureBox1.Size = New System.Drawing.Size(528, 312)&lt;br /&gt;
        Me.PictureBox1.TabIndex = 0&lt;br /&gt;
        Me.PictureBox1.TabStop = False&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button1.Location = New System.Drawing.Point(24, 336)&lt;br /&gt;
        Me.Button1.Name = &amp;quot;Button1&amp;quot;&lt;br /&gt;
        Me.Button1.Size = New System.Drawing.Size(64, 32)&lt;br /&gt;
        Me.Button1.TabIndex = 1&lt;br /&gt;
        Me.Button1.Text = &amp;quot;Shape 1&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button2&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button2.Location = New System.Drawing.Point(120, 336)&lt;br /&gt;
        Me.Button2.Name = &amp;quot;Button2&amp;quot;&lt;br /&gt;
        Me.Button2.Size = New System.Drawing.Size(64, 32)&lt;br /&gt;
        Me.Button2.TabIndex = 2&lt;br /&gt;
        Me.Button2.Text = &amp;quot;3D Curve&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button3&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button3.Location = New System.Drawing.Point(232, 336)&lt;br /&gt;
        Me.Button3.Name = &amp;quot;Button3&amp;quot;&lt;br /&gt;
        Me.Button3.Size = New System.Drawing.Size(72, 32)&lt;br /&gt;
        Me.Button3.TabIndex = 3&lt;br /&gt;
        Me.Button3.Text = &amp;quot;Ball&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Form1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)&lt;br /&gt;
        Me.ClientSize = New System.Drawing.Size(528, 382)&lt;br /&gt;
        Me.Controls.Add(Me.Button3)&lt;br /&gt;
        Me.Controls.Add(Me.Button2)&lt;br /&gt;
        Me.Controls.Add(Me.Button1)&lt;br /&gt;
        Me.Controls.Add(Me.PictureBox1)&lt;br /&gt;
        Me.ResumeLayout(False)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Dim g As System.Drawing.Graphics&lt;br /&gt;
    Dim pen1 As New System.Drawing.Pen(Color.Green, 0.5)&lt;br /&gt;
    Const PI = 3.14159&lt;br /&gt;
    Dim flag, col, r, h, hl, n, n1 As Short&lt;br /&gt;
    Dim x, y, z, cx, cy, cz, thx, thy, thz As Single&lt;br /&gt;
    Dim ed, od, eh As Short&lt;br /&gt;
    Dim point1, point2, point3, point4, point5 As System.Drawing.Point&lt;br /&gt;
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;
        Dim th As Single&lt;br /&gt;
        Static ax(9), ay(9), az(9)&lt;br /&gt;
        Static bx(9), by(9), bz(9)&lt;br /&gt;
        h = 160 : thy = 0.2&lt;br /&gt;
        col = 0 : n1 = 1&lt;br /&gt;
        r = 100&lt;br /&gt;
        n = 8&lt;br /&gt;
        thx = 0.2&lt;br /&gt;
        PictureBox1.Refresh()&lt;br /&gt;
        ax(0) = h : ay(0) = h : az(0) = h&lt;br /&gt;
        n1 = 1&lt;br /&gt;
        For th = 0 To 2 * PI + 0.1 Step 2 * PI / n&lt;br /&gt;
            x = r * Math.Cos(th) : y = -h : z = r * Math.Sin(th)&lt;br /&gt;
            Call roty() : Call rotx()&lt;br /&gt;
            bx(n1) = x : by(n1) = y : bz(n1) = z&lt;br /&gt;
            n1 = n1 + 1&lt;br /&gt;
        Next th&lt;br /&gt;
        For n1 = 1 To n&lt;br /&gt;
            x = ax(n1) : y = ay(n1)&lt;br /&gt;
            Call linzuiti()&lt;br /&gt;
            x = ax(n1 + 1) : y = ay(n1 + 1)&lt;br /&gt;
            Call linzuiti()&lt;br /&gt;
            x = bx(n1 + 1) : y = by(n1 + 1)&lt;br /&gt;
            Call linzuiti()&lt;br /&gt;
            x = bx(n1) : y = by(n1)&lt;br /&gt;
            Call linzuiti()&lt;br /&gt;
        Next n1&lt;br /&gt;
    End Sub&lt;br /&gt;
    Public Sub linzuiti()&lt;br /&gt;
        Dim gx, gy As Single&lt;br /&gt;
        gx = 250 + x&lt;br /&gt;
        gy = 180 + y&lt;br /&gt;
        If flag = 0 Then point1.X = gx : point1.Y = gy&lt;br /&gt;
        flag = 1&lt;br /&gt;
        point2.X = gx : point2.Y = gy&lt;br /&gt;
        g = PictureBox1.CreateGraphics&lt;br /&gt;
        g.DrawLine(pen1, point1, point2)&lt;br /&gt;
        point1 = point2&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub rotx()&lt;br /&gt;
        Dim yw, zw As Single&lt;br /&gt;
        yw = y : zw = z&lt;br /&gt;
        y = yw * Math.Cos(thx) - zw * Math.Sin(thx)&lt;br /&gt;
        z = yw * Math.Sin(thx) + zw * Math.Cos(thx)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub roty()&lt;br /&gt;
        Dim zw, xw As Single&lt;br /&gt;
        zw = z : xw = x&lt;br /&gt;
        x = zw * Math.Cos(thy) - xw * Math.Sin(thy)&lt;br /&gt;
        z = zw * Math.Sin(thy) + xw * Math.Cos(thy)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click&lt;br /&gt;
        PictureBox1.Refresh()&lt;br /&gt;
        g = PictureBox1.CreateGraphics&lt;br /&gt;
        Dim x, y, s, cx, cy, zz, xx, yy As Single&lt;br /&gt;
        Dim h, a, b, sx, sx1, sx2, sy, sy1, sy2 As Integer&lt;br /&gt;
        Dim x1, x2, y1, y2, xw, yw As Integer&lt;br /&gt;
        s = pi / 16&lt;br /&gt;
        x1 = -3&lt;br /&gt;
        x2 = 3&lt;br /&gt;
        xw = x2 - x1&lt;br /&gt;
        y1 = -9 : y2 = 9 : yw = y2 - y1&lt;br /&gt;
        sx1 = 140 : sx2 = 600&lt;br /&gt;
        sy1 = 360 : sy2 = 100&lt;br /&gt;
        cx = (sx2 - sx1) / xw&lt;br /&gt;
        cy = (sy1 - sy2) / yw&lt;br /&gt;
        h = 170 : a = 6 : b = 6&lt;br /&gt;
        For y = y1 + 6 To y2 - 6 Step 1 / cy&lt;br /&gt;
            For x = x1 To x2 Step 1 / cx * 2&lt;br /&gt;
                zz = h * Math.Exp(-x * x / a * a - y * y / b * b)&lt;br /&gt;
                xx = x * cx + sx1 + 160&lt;br /&gt;
                yy = sy1 - y * cy&lt;br /&gt;
                sx = Int(xx + y * cy * Math.Cos(s))&lt;br /&gt;
                sy = yy - zz&lt;br /&gt;
                sy = sy - 100&lt;br /&gt;
                If x = -3 Then&lt;br /&gt;
                    point1.X = sx - 60 : point1.Y = sy - 20&lt;br /&gt;
                Else : point2.X = sx - 60 : point2.Y = sy - 20&lt;br /&gt;
                    g.DrawLine(pen1, point1, point2)&lt;br /&gt;
                    point1 = point2&lt;br /&gt;
                End If&lt;br /&gt;
            Next x&lt;br /&gt;
        Next y&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click&lt;br /&gt;
        PictureBox1.Refresh()&lt;br /&gt;
        g = PictureBox1.CreateGraphics&lt;br /&gt;
        Dim i, r As Integer&lt;br /&gt;
        Dim x, y, z, s, q, p, px, py As Single&lt;br /&gt;
        Dim mx(600), my(600) As Integer&lt;br /&gt;
        s = pi / 4&lt;br /&gt;
        r = 100&lt;br /&gt;
        i = 1&lt;br /&gt;
        q = -pi / 2 + 0.1&lt;br /&gt;
        For p = 0 To 2 * pi Step 0.2&lt;br /&gt;
            x = r * Math.Cos(q) * Math.Sin(p)&lt;br /&gt;
            y = r * Math.Sin(q)&lt;br /&gt;
            z = r * Math.Cos(q) * Math.Cos(p)&lt;br /&gt;
            px = x * 1.2&lt;br /&gt;
            py = y - z * Math.Sin(s)&lt;br /&gt;
            mx(i) = px + 200&lt;br /&gt;
            my(i) = 150 - py&lt;br /&gt;
            i = i + 1&lt;br /&gt;
        Next p&lt;br /&gt;
        point1.X = mx(1) : point1.Y = my(1)&lt;br /&gt;
        For q = -pi / 2 + 0.2 To pi / 2 Step 0.2&lt;br /&gt;
            i = 1&lt;br /&gt;
            For p = 0 To 2 * pi Step 0.2&lt;br /&gt;
                x = r * Math.Cos(q) * Math.Sin(p)&lt;br /&gt;
                y = r * Math.Sin(q)&lt;br /&gt;
                z = r * Math.Cos(q) * Math.Cos(p)&lt;br /&gt;
                px = x * 1.2&lt;br /&gt;
                py = y - z * Math.Sin(s)&lt;br /&gt;
                point2.X = px + 200 : point2.Y = 150 - py&lt;br /&gt;
                g.DrawLine(pen1, point1, point2)&lt;br /&gt;
                point1 = point2&lt;br /&gt;
                point3.X = mx(i) : point3.Y = my(i)&lt;br /&gt;
                point4.X = px + 200 : point4.Y = 150 - py&lt;br /&gt;
                g.DrawLine(pen1, point3, point4)&lt;br /&gt;
                point3 = point4&lt;br /&gt;
                mx(i) = px + 200&lt;br /&gt;
                my(i) = 150 - py&lt;br /&gt;
                i = i + 1&lt;br /&gt;
            Next p&lt;br /&gt;
            p = 0&lt;br /&gt;
            x = r * Math.Cos(q) * Math.Sin(p)&lt;br /&gt;
            y = r * Math.Sin(q)&lt;br /&gt;
            z = r * Math.Cos(q) * Math.Cos(p)&lt;br /&gt;
            px = x * 1.2&lt;br /&gt;
            py = y - z * Math.Sin(s)&lt;br /&gt;
            point5.X = px + 200 : point5.Y = 150 - py&lt;br /&gt;
            g.DrawLine(pen1, point4, point5)&lt;br /&gt;
            point4 = point5&lt;br /&gt;
        Next q&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==3D shape==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&amp;quot;Visual Basic.Net JingCai Programming 100 Examples&lt;br /&gt;
&amp;quot;Author: Yong Zhang&lt;br /&gt;
&amp;quot;Publisher: Water Publisher China&lt;br /&gt;
&amp;quot;ISBN: 750841156&lt;br /&gt;
&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
public class Draw3D&lt;br /&gt;
   public Shared Sub Main&lt;br /&gt;
        Application.Run(New Form1)&lt;br /&gt;
   End Sub&lt;br /&gt;
End class&lt;br /&gt;
Public Class Form1&lt;br /&gt;
    Inherits System.Windows.Forms.Form&lt;br /&gt;
    Public Sub New()&lt;br /&gt;
        MyBase.New()&lt;br /&gt;
        InitializeComponent()&lt;br /&gt;
    End Sub&lt;br /&gt;
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
        If disposing Then&lt;br /&gt;
            If Not (components Is Nothing) Then&lt;br /&gt;
                components.Dispose()&lt;br /&gt;
            End If&lt;br /&gt;
        End If&lt;br /&gt;
        MyBase.Dispose(disposing)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private components As System.ruponentModel.IContainer&lt;br /&gt;
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox&lt;br /&gt;
    Friend WithEvents Button1 As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents Button2 As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents Button3 As System.Windows.Forms.Button&lt;br /&gt;
    &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; Private Sub InitializeComponent()&lt;br /&gt;
        Me.PictureBox1 = New System.Windows.Forms.PictureBox&lt;br /&gt;
        Me.Button1 = New System.Windows.Forms.Button&lt;br /&gt;
        Me.Button2 = New System.Windows.Forms.Button&lt;br /&gt;
        Me.Button3 = New System.Windows.Forms.Button&lt;br /&gt;
        Me.SuspendLayout()&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;PictureBox1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.PictureBox1.BackColor = System.Drawing.SystemColors.Window&lt;br /&gt;
        Me.PictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D&lt;br /&gt;
        Me.PictureBox1.Dock = System.Windows.Forms.DockStyle.Top&lt;br /&gt;
        Me.PictureBox1.Location = New System.Drawing.Point(0, 0)&lt;br /&gt;
        Me.PictureBox1.Name = &amp;quot;PictureBox1&amp;quot;&lt;br /&gt;
        Me.PictureBox1.Size = New System.Drawing.Size(528, 312)&lt;br /&gt;
        Me.PictureBox1.TabIndex = 0&lt;br /&gt;
        Me.PictureBox1.TabStop = False&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button1.Location = New System.Drawing.Point(24, 336)&lt;br /&gt;
        Me.Button1.Name = &amp;quot;Button1&amp;quot;&lt;br /&gt;
        Me.Button1.Size = New System.Drawing.Size(64, 32)&lt;br /&gt;
        Me.Button1.TabIndex = 1&lt;br /&gt;
        Me.Button1.Text = &amp;quot;Shape 1&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button2&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button2.Location = New System.Drawing.Point(120, 336)&lt;br /&gt;
        Me.Button2.Name = &amp;quot;Button2&amp;quot;&lt;br /&gt;
        Me.Button2.Size = New System.Drawing.Size(64, 32)&lt;br /&gt;
        Me.Button2.TabIndex = 2&lt;br /&gt;
        Me.Button2.Text = &amp;quot;3D Curve&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button3&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button3.Location = New System.Drawing.Point(232, 336)&lt;br /&gt;
        Me.Button3.Name = &amp;quot;Button3&amp;quot;&lt;br /&gt;
        Me.Button3.Size = New System.Drawing.Size(72, 32)&lt;br /&gt;
        Me.Button3.TabIndex = 3&lt;br /&gt;
        Me.Button3.Text = &amp;quot;Ball&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Form1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)&lt;br /&gt;
        Me.ClientSize = New System.Drawing.Size(528, 382)&lt;br /&gt;
        Me.Controls.Add(Me.Button3)&lt;br /&gt;
        Me.Controls.Add(Me.Button2)&lt;br /&gt;
        Me.Controls.Add(Me.Button1)&lt;br /&gt;
        Me.Controls.Add(Me.PictureBox1)&lt;br /&gt;
        Me.ResumeLayout(False)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Dim g As System.Drawing.Graphics&lt;br /&gt;
    Dim pen1 As New System.Drawing.Pen(Color.Green, 0.5)&lt;br /&gt;
    Const PI = 3.14159&lt;br /&gt;
    Dim flag, col, r, h, hl, n, n1 As Short&lt;br /&gt;
    Dim x, y, z, cx, cy, cz, thx, thy, thz As Single&lt;br /&gt;
    Dim ed, od, eh As Short&lt;br /&gt;
    Dim point1, point2, point3, point4, point5 As System.Drawing.Point&lt;br /&gt;
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;
        Dim th As Single&lt;br /&gt;
        Static ax(9), ay(9), az(9)&lt;br /&gt;
        Static bx(9), by(9), bz(9)&lt;br /&gt;
        h = 160 : thy = 0.2&lt;br /&gt;
        col = 0 : n1 = 1&lt;br /&gt;
        r = 100&lt;br /&gt;
        n = 8&lt;br /&gt;
        thx = 0.2&lt;br /&gt;
        PictureBox1.Refresh()&lt;br /&gt;
        ax(0) = h : ay(0) = h : az(0) = h&lt;br /&gt;
        n1 = 1&lt;br /&gt;
        For th = 0 To 2 * PI + 0.1 Step 2 * PI / n&lt;br /&gt;
            x = r * Math.Cos(th) : y = -h : z = r * Math.Sin(th)&lt;br /&gt;
            Call roty() : Call rotx()&lt;br /&gt;
            bx(n1) = x : by(n1) = y : bz(n1) = z&lt;br /&gt;
            n1 = n1 + 1&lt;br /&gt;
        Next th&lt;br /&gt;
        For n1 = 1 To n&lt;br /&gt;
            x = ax(n1) : y = ay(n1)&lt;br /&gt;
            Call linzuiti()&lt;br /&gt;
            x = ax(n1 + 1) : y = ay(n1 + 1)&lt;br /&gt;
            Call linzuiti()&lt;br /&gt;
            x = bx(n1 + 1) : y = by(n1 + 1)&lt;br /&gt;
            Call linzuiti()&lt;br /&gt;
            x = bx(n1) : y = by(n1)&lt;br /&gt;
            Call linzuiti()&lt;br /&gt;
        Next n1&lt;br /&gt;
    End Sub&lt;br /&gt;
    Public Sub linzuiti()&lt;br /&gt;
        Dim gx, gy As Single&lt;br /&gt;
        gx = 250 + x&lt;br /&gt;
        gy = 180 + y&lt;br /&gt;
        If flag = 0 Then point1.X = gx : point1.Y = gy&lt;br /&gt;
        flag = 1&lt;br /&gt;
        point2.X = gx : point2.Y = gy&lt;br /&gt;
        g = PictureBox1.CreateGraphics&lt;br /&gt;
        g.DrawLine(pen1, point1, point2)&lt;br /&gt;
        point1 = point2&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub rotx()&lt;br /&gt;
        Dim yw, zw As Single&lt;br /&gt;
        yw = y : zw = z&lt;br /&gt;
        y = yw * Math.Cos(thx) - zw * Math.Sin(thx)&lt;br /&gt;
        z = yw * Math.Sin(thx) + zw * Math.Cos(thx)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub roty()&lt;br /&gt;
        Dim zw, xw As Single&lt;br /&gt;
        zw = z : xw = x&lt;br /&gt;
        x = zw * Math.Cos(thy) - xw * Math.Sin(thy)&lt;br /&gt;
        z = zw * Math.Sin(thy) + xw * Math.Cos(thy)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click&lt;br /&gt;
        PictureBox1.Refresh()&lt;br /&gt;
        g = PictureBox1.CreateGraphics&lt;br /&gt;
        Dim x, y, s, cx, cy, zz, xx, yy As Single&lt;br /&gt;
        Dim h, a, b, sx, sx1, sx2, sy, sy1, sy2 As Integer&lt;br /&gt;
        Dim x1, x2, y1, y2, xw, yw As Integer&lt;br /&gt;
        s = pi / 16&lt;br /&gt;
        x1 = -3&lt;br /&gt;
        x2 = 3&lt;br /&gt;
        xw = x2 - x1&lt;br /&gt;
        y1 = -9 : y2 = 9 : yw = y2 - y1&lt;br /&gt;
        sx1 = 140 : sx2 = 600&lt;br /&gt;
        sy1 = 360 : sy2 = 100&lt;br /&gt;
        cx = (sx2 - sx1) / xw&lt;br /&gt;
        cy = (sy1 - sy2) / yw&lt;br /&gt;
        h = 170 : a = 6 : b = 6&lt;br /&gt;
        For y = y1 + 6 To y2 - 6 Step 1 / cy&lt;br /&gt;
            For x = x1 To x2 Step 1 / cx * 2&lt;br /&gt;
                zz = h * Math.Exp(-x * x / a * a - y * y / b * b)&lt;br /&gt;
                xx = x * cx + sx1 + 160&lt;br /&gt;
                yy = sy1 - y * cy&lt;br /&gt;
                sx = Int(xx + y * cy * Math.Cos(s))&lt;br /&gt;
                sy = yy - zz&lt;br /&gt;
                sy = sy - 100&lt;br /&gt;
                If x = -3 Then&lt;br /&gt;
                    point1.X = sx - 60 : point1.Y = sy - 20&lt;br /&gt;
                Else : point2.X = sx - 60 : point2.Y = sy - 20&lt;br /&gt;
                    g.DrawLine(pen1, point1, point2)&lt;br /&gt;
                    point1 = point2&lt;br /&gt;
                End If&lt;br /&gt;
            Next x&lt;br /&gt;
        Next y&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click&lt;br /&gt;
        PictureBox1.Refresh()&lt;br /&gt;
        g = PictureBox1.CreateGraphics&lt;br /&gt;
        Dim i, r As Integer&lt;br /&gt;
        Dim x, y, z, s, q, p, px, py As Single&lt;br /&gt;
        Dim mx(600), my(600) As Integer&lt;br /&gt;
        s = pi / 4&lt;br /&gt;
        r = 100&lt;br /&gt;
        i = 1&lt;br /&gt;
        q = -pi / 2 + 0.1&lt;br /&gt;
        For p = 0 To 2 * pi Step 0.2&lt;br /&gt;
            x = r * Math.Cos(q) * Math.Sin(p)&lt;br /&gt;
            y = r * Math.Sin(q)&lt;br /&gt;
            z = r * Math.Cos(q) * Math.Cos(p)&lt;br /&gt;
            px = x * 1.2&lt;br /&gt;
            py = y - z * Math.Sin(s)&lt;br /&gt;
            mx(i) = px + 200&lt;br /&gt;
            my(i) = 150 - py&lt;br /&gt;
            i = i + 1&lt;br /&gt;
        Next p&lt;br /&gt;
        point1.X = mx(1) : point1.Y = my(1)&lt;br /&gt;
        For q = -pi / 2 + 0.2 To pi / 2 Step 0.2&lt;br /&gt;
            i = 1&lt;br /&gt;
            For p = 0 To 2 * pi Step 0.2&lt;br /&gt;
                x = r * Math.Cos(q) * Math.Sin(p)&lt;br /&gt;
                y = r * Math.Sin(q)&lt;br /&gt;
                z = r * Math.Cos(q) * Math.Cos(p)&lt;br /&gt;
                px = x * 1.2&lt;br /&gt;
                py = y - z * Math.Sin(s)&lt;br /&gt;
                point2.X = px + 200 : point2.Y = 150 - py&lt;br /&gt;
                g.DrawLine(pen1, point1, point2)&lt;br /&gt;
                point1 = point2&lt;br /&gt;
                point3.X = mx(i) : point3.Y = my(i)&lt;br /&gt;
                point4.X = px + 200 : point4.Y = 150 - py&lt;br /&gt;
                g.DrawLine(pen1, point3, point4)&lt;br /&gt;
                point3 = point4&lt;br /&gt;
                mx(i) = px + 200&lt;br /&gt;
                my(i) = 150 - py&lt;br /&gt;
                i = i + 1&lt;br /&gt;
            Next p&lt;br /&gt;
            p = 0&lt;br /&gt;
            x = r * Math.Cos(q) * Math.Sin(p)&lt;br /&gt;
            y = r * Math.Sin(q)&lt;br /&gt;
            z = r * Math.Cos(q) * Math.Cos(p)&lt;br /&gt;
            px = x * 1.2&lt;br /&gt;
            py = y - z * Math.Sin(s)&lt;br /&gt;
            point5.X = px + 200 : point5.Y = 150 - py&lt;br /&gt;
            g.DrawLine(pen1, point4, point5)&lt;br /&gt;
            point4 = point5&lt;br /&gt;
        Next q&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>