home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH10 / SRC / TRANS.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-05-02  |  21.1 KB  |  682 lines

  1. VERSION 4.00
  2. Begin VB.Form TransformedForm 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H00C0C0C0&
  5.    Caption         =   "Surfaces of Transformation"
  6.    ClientHeight    =   5700
  7.    ClientLeft      =   690
  8.    ClientTop       =   900
  9.    ClientWidth     =   7830
  10.    BeginProperty Font 
  11.       name            =   "MS Sans Serif"
  12.       charset         =   1
  13.       weight          =   700
  14.       size            =   8.25
  15.       underline       =   0   'False
  16.       italic          =   0   'False
  17.       strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H80000008&
  20.    Height          =   6390
  21.    KeyPreview      =   -1  'True
  22.    Left            =   630
  23.    LinkTopic       =   "Form1"
  24.    ScaleHeight     =   380
  25.    ScaleMode       =   3  'Pixel
  26.    ScaleWidth      =   522
  27.    Top             =   270
  28.    Width           =   7950
  29.    Begin VB.CommandButton CmdCreate 
  30.       Caption         =   "Transform"
  31.       Height          =   495
  32.       Left            =   600
  33.       TabIndex        =   19
  34.       Top             =   5040
  35.       Width           =   1095
  36.    End
  37.    Begin VB.Frame Frame1 
  38.       Caption         =   "Transformations"
  39.       Height          =   2055
  40.       Left            =   0
  41.       TabIndex        =   14
  42.       Top             =   2880
  43.       Width           =   2295
  44.       Begin VB.OptionButton TransChoice 
  45.          Caption         =   "Wierd"
  46.          Height          =   255
  47.          Index           =   4
  48.          Left            =   120
  49.          TabIndex        =   22
  50.          Top             =   1680
  51.          Width           =   2055
  52.       End
  53.       Begin VB.OptionButton TransChoice 
  54.          Caption         =   "Up, Shrink/Grow"
  55.          Height          =   255
  56.          Index           =   3
  57.          Left            =   120
  58.          TabIndex        =   18
  59.          Top             =   1320
  60.          Width           =   2055
  61.       End
  62.       Begin VB.OptionButton TransChoice 
  63.          Caption         =   "Up, Shrink, Twist"
  64.          Height          =   255
  65.          Index           =   2
  66.          Left            =   120
  67.          TabIndex        =   17
  68.          Top             =   960
  69.          Width           =   2055
  70.       End
  71.       Begin VB.OptionButton TransChoice 
  72.          Caption         =   "Up, Shrink"
  73.          Height          =   255
  74.          Index           =   1
  75.          Left            =   120
  76.          TabIndex        =   16
  77.          Top             =   600
  78.          Width           =   2055
  79.       End
  80.       Begin VB.OptionButton TransChoice 
  81.          Caption         =   "Up, Twist"
  82.          Height          =   255
  83.          Index           =   0
  84.          Left            =   120
  85.          TabIndex        =   15
  86.          Top             =   240
  87.          Value           =   -1  'True
  88.          Width           =   2055
  89.       End
  90.    End
  91.    Begin VB.Frame Frame2 
  92.       Caption         =   "Curve"
  93.       Height          =   2775
  94.       Left            =   0
  95.       TabIndex        =   8
  96.       Top             =   0
  97.       Width           =   2295
  98.       Begin VB.OptionButton CurveChoice 
  99.          Caption         =   "Semicircle"
  100.          Height          =   255
  101.          Index           =   6
  102.          Left            =   120
  103.          TabIndex        =   21
  104.          Top             =   2400
  105.          Width           =   2055
  106.       End
  107.       Begin VB.OptionButton CurveChoice 
  108.          Caption         =   "Line Segment"
  109.          Height          =   255
  110.          Index           =   0
  111.          Left            =   120
  112.          TabIndex        =   20
  113.          Top             =   240
  114.          Value           =   -1  'True
  115.          Width           =   2055
  116.       End
  117.       Begin VB.OptionButton CurveChoice 
  118.          Caption         =   "Star"
  119.          Height          =   255
  120.          Index           =   5
  121.          Left            =   120
  122.          TabIndex        =   13
  123.          Top             =   2040
  124.          Width           =   2055
  125.       End
  126.       Begin VB.OptionButton CurveChoice 
  127.          Caption         =   "Off Center Circle"
  128.          Height          =   255
  129.          Index           =   4
  130.          Left            =   120
  131.          TabIndex        =   12
  132.          Top             =   1680
  133.          Width           =   2055
  134.       End
  135.       Begin VB.OptionButton CurveChoice 
  136.          Caption         =   "Circle"
  137.          Height          =   255
  138.          Index           =   3
  139.          Left            =   120
  140.          TabIndex        =   11
  141.          Top             =   1320
  142.          Width           =   2055
  143.       End
  144.       Begin VB.OptionButton CurveChoice 
  145.          Caption         =   "Off Center Square"
  146.          Height          =   255
  147.          Index           =   2
  148.          Left            =   120
  149.          TabIndex        =   10
  150.          Top             =   960
  151.          Width           =   2055
  152.       End
  153.       Begin VB.OptionButton CurveChoice 
  154.          Caption         =   "Square"
  155.          Height          =   255
  156.          Index           =   1
  157.          Left            =   120
  158.          TabIndex        =   9
  159.          Top             =   600
  160.          Width           =   2055
  161.       End
  162.    End
  163.    Begin VB.CheckBox ShowAxesCheck 
  164.       Caption         =   "Show Axes"
  165.       Height          =   255
  166.       Left            =   2400
  167.       TabIndex        =   7
  168.       Top             =   5400
  169.       Width           =   1335
  170.    End
  171.    Begin VB.TextBox PhiText 
  172.       Height          =   285
  173.       Left            =   6960
  174.       TabIndex        =   6
  175.       Text            =   "0.1570"
  176.       Top             =   5400
  177.       Width           =   855
  178.    End
  179.    Begin VB.TextBox ThetaText 
  180.       Height          =   285
  181.       Left            =   5640
  182.       TabIndex        =   4
  183.       Text            =   "0.6283"
  184.       Top             =   5400
  185.       Width           =   855
  186.    End
  187.    Begin VB.TextBox RText 
  188.       Height          =   285
  189.       Left            =   4080
  190.       TabIndex        =   2
  191.       Text            =   "10"
  192.       Top             =   5400
  193.       Width           =   855
  194.    End
  195.    Begin VB.PictureBox Pict 
  196.       AutoRedraw      =   -1  'True
  197.       Height          =   5295
  198.       Left            =   2400
  199.       ScaleHeight     =   349
  200.       ScaleMode       =   3  'Pixel
  201.       ScaleWidth      =   357
  202.       TabIndex        =   0
  203.       Top             =   0
  204.       Width           =   5415
  205.    End
  206.    Begin MSComDlg.CommonDialog LoadDialog 
  207.       Left            =   1800
  208.       Top             =   5280
  209.       _version        =   65536
  210.       _extentx        =   847
  211.       _extenty        =   847
  212.       _stockprops     =   0
  213.       cancelerror     =   -1  'True
  214.    End
  215.    Begin VB.Label Label1 
  216.       Caption         =   "Phi"
  217.       Height          =   255
  218.       Index           =   2
  219.       Left            =   6600
  220.       TabIndex        =   5
  221.       Top             =   5415
  222.       Width           =   375
  223.    End
  224.    Begin VB.Label Label1 
  225.       Caption         =   "Theta"
  226.       Height          =   255
  227.       Index           =   1
  228.       Left            =   5040
  229.       TabIndex        =   3
  230.       Top             =   5415
  231.       Width           =   495
  232.    End
  233.    Begin VB.Label Label1 
  234.       Caption         =   "R"
  235.       Height          =   255
  236.       Index           =   0
  237.       Left            =   3840
  238.       TabIndex        =   1
  239.       Top             =   5415
  240.       Width           =   255
  241.    End
  242.    Begin VB.Menu mnuFile 
  243.       Caption         =   "&File"
  244.       Begin VB.Menu mnuFileLoad 
  245.          Caption         =   "&Load..."
  246.          Shortcut        =   ^L
  247.       End
  248.       Begin VB.Menu mnuFileSaveAs 
  249.          Caption         =   "&Save As..."
  250.          Shortcut        =   ^A
  251.       End
  252.       Begin VB.Menu mnuFileSep 
  253.          Caption         =   "-"
  254.       End
  255.       Begin VB.Menu mnuFileExit 
  256.          Caption         =   "E&xit"
  257.       End
  258.    End
  259. Attribute VB_Name = "TransformedForm"
  260. Attribute VB_Creatable = False
  261. Attribute VB_Exposed = False
  262. Option Explicit
  263. ' Location of viewing eye.
  264. Dim EyeR As Single
  265. Dim EyeTheta As Single
  266. Dim EyePhi As Single
  267. Const dtheta = PI / 20
  268. Const Dphi = PI / 20
  269. Const dR = 1
  270. ' Location of focus point.
  271. Const FocusX = 0#
  272. Const FocusY = 0#
  273. Const FocusZ = 0#
  274. Dim Projector(1 To 4, 1 To 4) As Single
  275. Dim CurveNum As Integer
  276. Dim TransNum As Integer
  277. Dim NumTrans As Integer
  278. Dim Trans() As Transformation
  279. Dim ThePicture As ObjPicture
  280. Dim TheSurface As ObjTransformed
  281. Dim ShowingParameters As Boolean
  282. ' ************************************************
  283. ' Create the selected curve.
  284. ' ************************************************
  285. Sub CreateCurve()
  286. Dim R As Single
  287. Dim R2 As Single
  288. Dim dtheta As Single
  289. Dim theta As Single
  290. Dim y As Single
  291. Dim i As Integer
  292.     Select Case CurveNum
  293.         Case 0  ' Line segment.
  294.             TheSurface.AddCurvePoint -2, 0, 0
  295.             TheSurface.AddCurvePoint 2, 0, 0
  296.         
  297.         Case 1  ' Square.
  298.             TheSurface.AddCurvePoint -2, 0, -2
  299.             TheSurface.AddCurvePoint -2, 0, 2
  300.             TheSurface.AddCurvePoint 2, 0, 2
  301.             TheSurface.AddCurvePoint 2, 0, -2
  302.             TheSurface.AddCurvePoint -2, 0, -2
  303.         Case 2  ' Off Center Square.
  304.             TheSurface.AddCurvePoint 1, 0, 1
  305.             TheSurface.AddCurvePoint 1, 0, 3
  306.             TheSurface.AddCurvePoint 3, 0, 3
  307.             TheSurface.AddCurvePoint 3, 0, 1
  308.             TheSurface.AddCurvePoint 1, 0, 1
  309.         Case 3  ' Circle.
  310.             R = 2
  311.             dtheta = PI / 8
  312.             For theta = 0 To 2 * PI - dtheta + 0.01 Step dtheta
  313.                 TheSurface.AddCurvePoint R * Cos(theta), 0, R * Sin(theta)
  314.             Next theta
  315.             TheSurface.AddCurvePoint R, 0, 0
  316.             
  317.         Case 4  ' Off Center Circle.
  318.             R = 1
  319.             dtheta = PI / 8
  320.             For theta = 0 To 2 * PI - dtheta + 0.01 Step dtheta
  321.                 TheSurface.AddCurvePoint 2 + R * Cos(theta), 0, 2 + R * Sin(theta)
  322.             Next theta
  323.             TheSurface.AddCurvePoint 2 + R, 0, 2
  324.             
  325.         Case 5  ' Star.
  326.             R = 2
  327.             R2 = 1
  328.             dtheta = 2 * PI / 5 / 2
  329.             theta = PI
  330.             For i = 1 To 5
  331.                 TheSurface.AddCurvePoint _
  332.                     R * Cos(theta), 0, R * Sin(theta)
  333.                 theta = theta + dtheta
  334.                 TheSurface.AddCurvePoint _
  335.                     R2 * Cos(theta), 0, R2 * Sin(theta)
  336.                 theta = theta + dtheta
  337.             Next i
  338.             TheSurface.AddCurvePoint _
  339.                 R * Cos(PI), 0, R * Sin(PI)
  340.             
  341.         Case 6  ' Semicircle.
  342.             R = 2
  343.             dtheta = PI / 8
  344.             For theta = 0 To PI - dtheta + 0.01 Step dtheta
  345.                 TheSurface.AddCurvePoint R * Cos(theta), 0, R * Sin(theta)
  346.             Next theta
  347.             TheSurface.AddCurvePoint -R, 0, 0
  348.         
  349.         Case Else
  350.             Beep
  351.     End Select
  352. End Sub
  353. ' ************************************************
  354. ' Create the array of transformations.
  355. ' ************************************************
  356. Sub CreateTransformations()
  357. Dim A(1 To 4, 1 To 4) As Single
  358. Dim B(1 To 4, 1 To 4) As Single
  359. Dim C(1 To 4, 1 To 4) As Single
  360. Dim theta As Single
  361. Dim dtheta As Single
  362. Dim R As Single
  363. Dim y As Single
  364. Dim i As Integer
  365.     Select Case TransNum
  366.         Case 0  ' Up, twist.
  367.             NumTrans = 9
  368.             ReDim Trans(1 To NumTrans)
  369.             dtheta = PI / 12
  370.             For i = 1 To NumTrans
  371.                 y = i / 2
  372.                 theta = i * dtheta
  373.                 m3Translate A, 0, y, 0  ' Translate.
  374.                 m3YRotate B, theta      ' Rotate.
  375.                 m3MatMultiply Trans(i).M, A, B  ' Combine.
  376.             Next i
  377.             
  378.         Case 1  ' Up, shrink.
  379.             NumTrans = 9
  380.             ReDim Trans(1 To NumTrans)
  381.             For i = 1 To NumTrans
  382.                 y = i / 2
  383.                 R = (NumTrans - i) / NumTrans
  384.                 m3Scale A, R, 1, R      ' Scale.
  385.                 m3Translate B, 0, y, 0  ' Translate.
  386.                 m3MatMultiply Trans(i).M, A, B  ' Combine.
  387.             Next i
  388.             
  389.         Case 2  ' Up, shrink, twist.
  390.             NumTrans = 9
  391.             ReDim Trans(1 To NumTrans)
  392.             dtheta = PI / 12
  393.             For i = 1 To NumTrans
  394.                 y = i / 2
  395.                 R = (NumTrans - i) / NumTrans
  396.                 theta = i * dtheta
  397.                 m3Scale A, R, 1, R      ' Scale.
  398.                 m3Translate B, 0, y, 0  ' Translate.
  399.                 m3MatMultiply C, A, B   ' Combine A and B.
  400.                 m3YRotate A, theta      ' Rotate.
  401.                 m3MatMultiply Trans(i).M, C, A  ' Combine all.
  402.             Next i
  403.             
  404.         Case 3  ' Up, shrink/grow.
  405.             NumTrans = 18
  406.             ReDim Trans(1 To NumTrans)
  407.             dtheta = PI / 12
  408.             For i = 1 To NumTrans
  409.                 y = i / 4
  410.                 theta = i * dtheta
  411.                 R = 1 + Sin(2 * theta) / 2
  412.                 m3Scale A, R, 1, R      ' Scale.
  413.                 m3Translate B, 0, y, 0  ' Translate.
  414.                 m3MatMultiply Trans(i).M, A, B  ' Combine.
  415.             Next i
  416.         
  417.         Case 4  ' Waver.
  418.             ' Make the curve move upwards with
  419.             ' varying rotation around the Z axis.
  420.             NumTrans = 18
  421.             ReDim Trans(1 To NumTrans)
  422.             dtheta = PI / 12
  423.             R = PI / 2
  424.             For i = 1 To NumTrans
  425.                 y = i / 4
  426.                 theta = i * dtheta
  427.                 m3ZRotate A, R * Sin(theta)  ' Rotate.
  428.                 m3Translate B, 0, y, 0  ' Translate.
  429.                 m3MatMultiply Trans(i).M, A, B  ' Combine.
  430.             Next i
  431.         
  432.         Case Else
  433.             Beep
  434.             
  435.     End Select
  436. End Sub
  437. Sub WaitEnd()
  438.     MousePointer = vbDefault
  439. End Sub
  440. Sub WaitStart()
  441.     MousePointer = vbHourglass
  442.     DoEvents
  443. End Sub
  444. ' ************************************************
  445. ' Create the surface.
  446. ' ************************************************
  447. Private Sub CmdCreate_Click()
  448. Dim pline As ObjPolyline
  449. Dim i As Integer
  450.     WaitStart
  451.     Set ThePicture = New ObjPicture
  452.     Set TheSurface = New ObjTransformed
  453.     ThePicture.objects.Add TheSurface
  454.     CreateCurve
  455.     CreateTransformations
  456.     For i = 1 To NumTrans
  457.         TheSurface.SetTrans Trans(i).M
  458.     Next i
  459.     TheSurface.Transform
  460.     If ShowAxesCheck.value = vbChecked Then
  461.         Set pline = New ObjPolyline
  462.         ThePicture.objects.Add pline
  463.         pline.AddSegment 0, 0, 0, 5, 0, 0
  464.         pline.AddSegment 0, 0, 0, 0, 5, 0
  465.         pline.AddSegment 0, 0, 0, 0, 0, 5
  466.     End If
  467.     DrawData Pict
  468.     Pict.SetFocus
  469. End Sub
  470. ' ************************************************
  471. ' Save the current curve choice.
  472. ' ************************************************
  473. Private Sub CurveChoice_Click(Index As Integer)
  474.     CurveNum = Index
  475. End Sub
  476. ' *******************************************************
  477. ' Rotate the points in the cube and draw the cube.
  478. ' *******************************************************
  479. Private Sub DrawData(pic As Object)
  480. Dim x As Single
  481. Dim y As Single
  482. Dim z As Single
  483. Dim S(1 To 4, 1 To 4) As Single
  484. Dim t(1 To 4, 1 To 4) As Single
  485. Dim ST(1 To 4, 1 To 4) As Single
  486. Dim PST(1 To 4, 1 To 4) As Single
  487.     MousePointer = vbHourglass
  488.     Refresh
  489.     ' Prevent overflow errors when drawing lines
  490.     ' too far out of bounds.
  491.     On Error Resume Next
  492.     ' Scale and translate so it looks OK in pixels.
  493.     m3Scale S, 35, -35, 1
  494.     m3Translate t, 180, 250, 0
  495.     m3MatMultiplyFull ST, S, t
  496.     m3MatMultiplyFull PST, Projector, ST
  497.     ' Transform the points.
  498.     ThePicture.ApplyFull PST
  499.     ' Display the data.
  500.     pic.Cls
  501.     ThePicture.Draw pic, EyeR
  502.     pic.Refresh
  503.     ' Display the viewnig parameters.
  504.     ShowViewingParameters
  505.     MousePointer = vbDefault
  506. End Sub
  507. Sub ShowViewingParameters()
  508.     ShowingParameters = True
  509.     RText.Text = Format$(EyeR, "0.0000")
  510.     ThetaText.Text = Format$(EyeTheta, "0.0000")
  511.     PhiText.Text = Format$(EyePhi, "0.0000")
  512.     RText.Refresh
  513.     ThetaText.Refresh
  514.     PhiText.Refresh
  515.     ShowingParameters = False
  516. End Sub
  517. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  518.     Select Case KeyCode
  519.         Case vbKeyLeft
  520.             EyeTheta = EyeTheta - dtheta
  521.         
  522.         Case vbKeyRight
  523.             EyeTheta = EyeTheta + dtheta
  524.         
  525.         Case vbKeyUp
  526.             EyePhi = EyePhi - Dphi
  527.         
  528.         Case vbKeyDown
  529.             EyePhi = EyePhi + Dphi
  530.                 
  531.         Case Else
  532.             Exit Sub
  533.     End Select
  534.     m3PProject Projector, m3Perspective, EyeR, EyePhi, EyeTheta, FocusX, FocusY, FocusZ, 0, 1, 0
  535.     DrawData Pict
  536. End Sub
  537. Private Sub Form_KeyPress(KeyAscii As Integer)
  538.     Select Case KeyAscii
  539.         Case Asc("+")
  540.             EyeR = EyeR + dR
  541.         
  542.         Case Asc("-")
  543.             EyeR = EyeR - dR
  544.         
  545.         Case Else
  546.             Exit Sub
  547.     End Select
  548.     m3PProject Projector, m3Perspective, EyeR, EyePhi, EyeTheta, FocusX, FocusY, FocusZ, 0, 1, 0
  549.     DrawData Pict
  550. End Sub
  551. Private Sub Form_Load()
  552.     ' Initialize the eye position.
  553.     EyeR = 10
  554.     EyeTheta = PI * 0.2
  555.     EyePhi = PI * 0.1
  556.     ' Initialize the projection transformation.
  557.     m3PProject Projector, m3Perspective, EyeR, EyePhi, EyeTheta, FocusX, FocusY, FocusZ, 0, 1, 0
  558.     Me.Show
  559.     CurveChoice_Click 0
  560. End Sub
  561. Private Sub mnuFileExit_Click()
  562.     Unload Me
  563. End Sub
  564. Private Sub mnuFileLoad_Click()
  565. Dim fname As String
  566. Dim filenum As Integer
  567. Dim txt As String
  568. Dim Xmin As Single
  569. Dim ymin As Single
  570. Dim xmax As Single
  571. Dim ymax As Single
  572. Dim i As Integer
  573.     ' Allow the user to pick a file.
  574.     On Error Resume Next
  575.     LoadDialog.filename = "*.APF"
  576.     LoadDialog.ShowOpen
  577.     If Err.Number = cdlCancel Then
  578.         Unload LoadDialog
  579.         Exit Sub
  580.     ElseIf Err.Number <> 0 Then
  581.         Unload LoadDialog
  582.         Beep
  583.         MsgBox "Error selecting file.", , vbExclamation
  584.         Exit Sub
  585.     End If
  586.     On Error GoTo 0
  587.     fname = LoadDialog.filename
  588.     LoadDialog.InitDir = Left$(fname, Len(fname) _
  589.         - Len(LoadDialog.FileTitle) - 1)
  590.     ' Clear the picture.
  591.     Set ThePicture = Nothing
  592.     ' Open the file.
  593.     filenum = FreeFile
  594.     Open fname For Input As #filenum
  595.     ' Make sure it's an Object Picture File.
  596.     Input #filenum, txt
  597.     If txt <> "3D APF PICTURE" Then
  598.         Close filenum
  599.         Beep
  600.         MsgBox "Error reading file """ & fname & """.", , vbExclamation
  601.         Exit Sub
  602.     End If
  603.     ' Read the picture.
  604.     MousePointer = vbHourglass
  605.     DoEvents
  606.     Set ThePicture = New ObjPicture
  607.     ThePicture.FileInput filenum
  608.     ' Close the file.
  609.     Close filenum
  610.     ' Refresh the display.
  611.     DrawData Pict
  612.     ' Deselect all the option buttons.
  613.     For i = 0 To 6
  614.         If CurveChoice(i).value Then _
  615.             CurveChoice(i).value = False
  616.     Next i
  617.     For i = 0 To 4
  618.         If TransChoice(i).value Then _
  619.             TransChoice(i).value = False
  620.     Next i
  621.     MousePointer = vbDefault
  622. End Sub
  623. Private Sub mnuFileSaveAs_Click()
  624. Dim fname As String
  625. Dim filenum As Integer
  626.     ' Allow the user to pick a file.
  627.     On Error Resume Next
  628.     LoadDialog.filename = "*.APF"
  629.     LoadDialog.Flags = cdlOFNOverwritePrompt + cdlOFNHideReadOnly
  630.     LoadDialog.ShowSave
  631.     If Err.Number = cdlCancel Then
  632.         Unload LoadDialog
  633.         Exit Sub
  634.     ElseIf Err.Number <> 0 Then
  635.         Unload LoadDialog
  636.         Beep
  637.         MsgBox "Error selecting file.", , vbExclamation
  638.         Exit Sub
  639.     End If
  640.     On Error GoTo 0
  641.     fname = LoadDialog.filename
  642.     LoadDialog.InitDir = Left$(fname, Len(fname) _
  643.         - Len(LoadDialog.FileTitle) - 1)
  644.     ' Open the file.
  645.     filenum = FreeFile
  646.     Open fname For Output As #filenum
  647.     ' Write the picture.
  648.     ThePicture.FileWrite filenum
  649.     ' Close the file.
  650.     Close filenum
  651. End Sub
  652. Private Sub PhiText_Change()
  653.     If ShowingParameters Then Exit Sub
  654.     EyePhi = CSng(PhiText.Text)
  655.     m3PProject Projector, m3Perspective, EyeR, EyePhi, EyeTheta, FocusX, FocusY, FocusZ, 0, 1, 0
  656.     DrawData Pict
  657. End Sub
  658. Private Sub RText_Change()
  659.     If ShowingParameters Then Exit Sub
  660.     EyeR = CSng(RText.Text)
  661.     m3PProject Projector, m3Perspective, EyeR, EyePhi, EyeTheta, FocusX, FocusY, FocusZ, 0, 1, 0
  662.     DrawData Pict
  663. End Sub
  664. ' ************************************************
  665. ' Redraw with the axes on or off as appropriate.
  666. ' ************************************************
  667. Private Sub ShowAxesCheck_Click()
  668.     CmdCreate_Click
  669. End Sub
  670. Private Sub ThetaText_Change()
  671.     If ShowingParameters Then Exit Sub
  672.     EyeTheta = CSng(ThetaText.Text)
  673.     m3PProject Projector, m3Perspective, EyeR, EyePhi, EyeTheta, FocusX, FocusY, FocusZ, 0, 1, 0
  674.     DrawData Pict
  675. End Sub
  676. ' ************************************************
  677. ' Save the current transformation choice.
  678. ' ************************************************
  679. Private Sub TransChoice_Click(Index As Integer)
  680.     TransNum = Index
  681. End Sub
  682.