codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  This code would not compile  acwendy60 at 08:02 on Sunday, September 28, 2003
 

Could someone please take a look, this code gives me errors at the code where I put ** . Thanks.

'Program written to display 3 methods
'of scan converting, 1 of which includes anti aliasing.
'The user must enter the coordinates of the 2 endpoints
'and choos either dda method to see the results. Or,
'enter the point of a circle and its radius.

'This program was written in Visual Basic

Dim X, Y, g, h, slope, Err, ip As Double
Dim dx, dy, L, Max, n As Integer
Dim a, b, c, d, a1, b1 As Integer
Dim X1, X2, Y1, Y2, R As Integer

Sub Simple_DDA(a, b, c, d)
dx = c - a
dy = d - b
X = a
Y = b
slope = dy / dx
If dx > dy Then
g = 1
h = slope
Max = dx
Else
g = 1 / slope
h = 1
Max = dy
End If

For L = 1 To Max + 1
Picture1.PSet (Round(X), -Round(Y)), QBColor(2)
X = X + g
Y = Y + h
Next L
End Sub

Sub first_octant_dda(a, b, c, d) 'with anti aliasing
n = 2
dx = c - a
dy = d - b
Err = -(dx / 2)
a1 = a
b1 = b
Picture1.PSet (a1, -b1), QBColor(n)
Do While a1 < c
Err = Err + dy
If Err >= 0 Then
b1 = b1 + 1
Err = Err - dx
End If
a1 = a1 + 1
If Err > 0 Then
ip = n * (Err / dy)
End If
If Err = 0 Then
ip = 0
End If
If Err < 0 Then
ip = -n * (Err / dx)
End If

Picture1.PSet (a1, -b1), QBColor(Abs(Round(n - ip)))
Picture1.PSet (a1, -b1 + 1), QBColor(Abs(Round(ip)))
Loop
End Sub


Sub Plot8(a, b) 'Plotting points for circle method
Picture1.PSet (a, b), QBColor(1)
Picture1.PSet (-a, -b), QBColor(1)
Picture1.PSet (-a, b), QBColor(1)
Picture1.PSet (a, -b), QBColor(1)
Picture1.PSet (b, a), QBColor(1)
Picture1.PSet (-b, -a), QBColor(1)
Picture1.PSet (-b, a), QBColor(1)
Picture1.PSet (b, -a), QBColor(1)
End Sub

Sub Circle_method(X1, Y1, R)
d = 3 - (2 * R)
Do
Plot8 X1, Y1
If d > 0 Then
d = d + 4 * (X1 - Y1) + 10
Y1 = Y1 - 1
Else
d = d + 4 * X1 + 6
End If
X1 = X1 + 1
Loop While X1 < Y1
If X1 = Y1 Then
Plot8 X1, Y1
End If
End Sub

Private Sub Command1_Click() 'This is when the pixel button is clicked.
Picture1.ScaleHeight = 150
Picture1.ScaleWidth = 400
Picture1.ScaleTop = -75
Picture1.ScaleLeft = -200

X1 = Val(Text1.Text)
Y1 = Val(Text2.Text)
X2 = Val(Text3.Text)
Y2 = Val(Text4.Text)

Label6.Caption = X1
Label8.Caption = X2

Label11.Caption = Y1
Label12.Caption = Y2

If Option1.Value = True Then
Label6.Caption = X1
Label8.Caption = X2
Label11.Caption = Y1
Label12.Caption = Y2
first_octant_dda X1, Y1, X2, Y2
ElseIf Option2.Value = True Then
Label6.Caption = X1
Label8.Caption = X2
Label11.Caption = Y1
Label12.Caption = Y2
Simple_DDA X1, Y1, X2, Y2
ElseIf Option3.Value = True Then
R = Val(Text5.Text)
Circle_method X1, Y1, R
End If

End Sub

'The following is only for the input:

Private Sub Command2_Click() 'Clear screen
Picture1.Cls
End Sub

Private Sub Command3_Click() 'End program
End
End Sub

Private Sub Form_Load() 'Makes circle method results invisible
**Label14.Visible = False
**Text5.Visible = False
End Sub

Private Sub Option1_Click() 'First octant dda
Label3.Visible = True
Label4.Visible = True
Label14.Visible = False
Text3.Visible = True
Text4.Visible = True
Text5.Visible = False
Label5.Visible = True
Label7.Visible = True
Label9.Visible = True
Label10.Visible = True
Label11.Visible = True
Label12.Visible = True
End Sub

Private Sub Option2_Click() 'Simple dda
Label3.Visible = True
Label4.Visible = True
Label14.Visible = False
Text3.Visible = True
Text4.Visible = True
Text5.Visible = False
Label5.Visible = True
Label7.Visible = True
Label9.Visible = True
Label10.Visible = True
Label11.Visible = True
Label12.Visible = True
End Sub

Private Sub Option3_Click() 'Circle method
Label3.Visible = False
Label4.Visible = False
Text3.Visible = False
Text4.Visible = False
Text5.Visible = True
Label14.Visible = True
Label5.Visible = False
Label6.Visible = False
Label7.Visible = False
Label8.Visible = False
Label9.Visible = False
Label10.Visible = False
Label11.Visible = False
Label12.Visible = False
End Sub



  Re: This code would not compile  Jeff Anderson at 08:42 on Monday, September 29, 2003
 

do you definitely have a label called Label14 ?








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Cadenas.CoCreate.FTI.IMSI.CADCAM.DELCAM.GMI.PLAXIS
•  Cadenas.CoCreate.FTI.IMSI.CADCAM.DELCAM.GMI.PLAXIS
•  Schlumberger.PTC.Siemens.EDS.CATIA.CIMATRON.AUTODESK
•  PDMS.Plate.UGS.CYME.FLOMERICS.Tanner.LINUX.MAC.UNIX
•  Tanner.CrossLight.Elite.Software.Geocentrix.FLOW.3D.PTC.
•  ITTVIS.ENVI.Leica.Erdas.LEAP.SOFTWARE.MapInfo.Nobeltec.
•  Re: Cracked software ftp download 2013
•  Re: Crack Engineering Software
•  Full engineering software


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2013