home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH9 / SRC / ORTH.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-11-16  |  5.5 KB  |  185 lines

  1. VERSION 4.00
  2. Begin VB.Form OrthForm 
  3.    Appearance      =   0  'Flat
  4.    AutoRedraw      =   -1  'True
  5.    BackColor       =   &H00C0C0C0&
  6.    Caption         =   "Orthographic Projections"
  7.    ClientHeight    =   5895
  8.    ClientLeft      =   2100
  9.    ClientTop       =   810
  10.    ClientWidth     =   4530
  11.    BeginProperty Font 
  12.       name            =   "MS Sans Serif"
  13.       charset         =   1
  14.       weight          =   700
  15.       size            =   8.25
  16.       underline       =   0   'False
  17.       italic          =   0   'False
  18.       strikethrough   =   0   'False
  19.    EndProperty
  20.    ForeColor       =   &H80000008&
  21.    Height          =   6585
  22.    Left            =   2040
  23.    LinkTopic       =   "Form1"
  24.    ScaleHeight     =   5895
  25.    ScaleWidth      =   4530
  26.    Top             =   180
  27.    Width           =   4650
  28.    Begin VB.PictureBox Pict 
  29.       AutoRedraw      =   -1  'True
  30.       Height          =   1935
  31.       Index           =   3
  32.       Left            =   1965
  33.       ScaleHeight     =   -5.639
  34.       ScaleLeft       =   -4
  35.       ScaleMode       =   0  'User
  36.       ScaleTop        =   4
  37.       ScaleWidth      =   5.639
  38.       TabIndex        =   3
  39.       Top             =   1965
  40.       Width           =   1935
  41.    End
  42.    Begin VB.PictureBox Pict 
  43.       AutoRedraw      =   -1  'True
  44.       Height          =   1935
  45.       Index           =   2
  46.       Left            =   0
  47.       ScaleHeight     =   -5.639
  48.       ScaleLeft       =   -2
  49.       ScaleMode       =   0  'User
  50.       ScaleTop        =   4
  51.       ScaleWidth      =   5.639
  52.       TabIndex        =   2
  53.       Top             =   3930
  54.       Width           =   1935
  55.    End
  56.    Begin VB.PictureBox Pict 
  57.       AutoRedraw      =   -1  'True
  58.       Height          =   1935
  59.       Index           =   1
  60.       Left            =   0
  61.       ScaleHeight     =   -5.639
  62.       ScaleLeft       =   -2
  63.       ScaleMode       =   0  'User
  64.       ScaleTop        =   2
  65.       ScaleWidth      =   5.639
  66.       TabIndex        =   1
  67.       Top             =   0
  68.       Width           =   1935
  69.    End
  70.    Begin VB.PictureBox Pict 
  71.       AutoRedraw      =   -1  'True
  72.       Height          =   1935
  73.       Index           =   0
  74.       Left            =   0
  75.       ScaleHeight     =   -4
  76.       ScaleLeft       =   -1.5
  77.       ScaleMode       =   0  'User
  78.       ScaleTop        =   2.5
  79.       ScaleWidth      =   4
  80.       TabIndex        =   0
  81.       Top             =   1965
  82.       Width           =   1935
  83.    End
  84.    Begin VB.Label Label1 
  85.       Caption         =   "Side"
  86.       Height          =   255
  87.       Index           =   3
  88.       Left            =   3960
  89.       TabIndex        =   6
  90.       Top             =   2760
  91.       Width           =   615
  92.    End
  93.    Begin VB.Label Label1 
  94.       Caption         =   "Front"
  95.       Height          =   255
  96.       Index           =   1
  97.       Left            =   2040
  98.       TabIndex        =   5
  99.       Top             =   4800
  100.       Width           =   735
  101.    End
  102.    Begin VB.Label Label1 
  103.       Caption         =   "Top"
  104.       Height          =   255
  105.       Index           =   0
  106.       Left            =   2040
  107.       TabIndex        =   4
  108.       Top             =   720
  109.       Width           =   615
  110.    End
  111.    Begin VB.Menu mnuFile 
  112.       Caption         =   "&File"
  113.       Begin VB.Menu mnuFileExit 
  114.          Caption         =   "E&xit"
  115.       End
  116.    End
  117. Attribute VB_Name = "OrthForm"
  118. Attribute VB_Creatable = False
  119. Attribute VB_Exposed = False
  120. Option Explicit
  121. ' Location of viewing eye.
  122. Dim EyeR As Single
  123. Dim EyeTheta As Single
  124. Dim EyePhi As Single
  125. ' Location of focus point.
  126. Const FocusX = 0#
  127. Const FocusY = 0#
  128. Const FocusZ = 0#
  129. Dim Projector(1 To 4, 1 To 4) As Single
  130. Private Sub Form_Load()
  131. Dim M(1 To 4, 1 To 4) As Single
  132.     ' Initialize the eye position.
  133.     EyeR = 3
  134.     EyeTheta = PI * 0.37
  135.     EyePhi = PI * 0.1
  136.     ' Create the data.
  137.     CreateData
  138.     ' Create the projection matrix.
  139.     m3PProject Projector, m3Perspective, EyeR, EyePhi, EyeTheta, FocusX, FocusY, FocusZ, 0, 1, 0
  140.     ' Draw the data.
  141.     TransformAllData Projector
  142.     DrawAllData Pict(0), ForeColor, True
  143.     m3OrthoTop M
  144.     TransformAllData M
  145.     DrawAllData Pict(1), ForeColor, True
  146.     m3OrthoFront M
  147.     TransformAllData M
  148.     DrawAllData Pict(2), ForeColor, True
  149.     m3OrthoSide M
  150.     TransformAllData M
  151.     DrawAllData Pict(3), ForeColor, True
  152. End Sub
  153. ' ***********************************************
  154. ' Create the object to display.
  155. ' ***********************************************
  156. Sub CreateData()
  157. '   MakeSegment 0, 0, 0, 2, 0, 0    ' Hidden.
  158.     MakeSegment 2, 0, 0, 2, 1, 0
  159.     MakeSegment 2, 1, 0, 1, 1, 0
  160.     MakeSegment 1, 1, 0, 1, 2, 0
  161.     MakeSegment 1, 2, 0, 0, 2, 0
  162. '   MakeSegment 0, 0, 0, 0, 0, 2    ' Hidden.
  163.     MakeSegment 0, 0, 2, 0, 1, 2
  164.     MakeSegment 0, 1, 2, 0, 1, 1
  165.     MakeSegment 0, 1, 1, 0, 2, 1
  166.     MakeSegment 0, 2, 1, 0, 2, 0
  167. '   MakeSegment 0, 0, 0, 2, 0, 0    ' Hidden.
  168.     MakeSegment 2, 0, 0, 2, 0, 1
  169.     MakeSegment 2, 0, 1, 1, 0, 1
  170.     MakeSegment 1, 0, 1, 1, 0, 2
  171.     MakeSegment 1, 0, 2, 0, 0, 2
  172.     MakeSegment 0, 1, 1, 2, 1, 1
  173.     MakeSegment 1, 0, 1, 1, 2, 1
  174.     MakeSegment 1, 1, 0, 1, 1, 2
  175.     MakeSegment 2, 1, 0, 2, 1, 1
  176.     MakeSegment 2, 1, 1, 2, 0, 1
  177.     MakeSegment 0, 2, 1, 1, 2, 1
  178.     MakeSegment 1, 2, 1, 1, 2, 0
  179.     MakeSegment 0, 1, 2, 1, 1, 2
  180.     MakeSegment 1, 1, 2, 1, 0, 2
  181. End Sub
  182. Private Sub mnuFileExit_Click()
  183.     Unload Me
  184. End Sub
  185.