VB Circle Method Seems to be Seriously Flawed

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Randy Gardner (RandyGardner_at_discussions.microsoft.com)
Date: 01/29/05


Date: Fri, 28 Jan 2005 18:05:01 -0800


'I am using the Circle Method in a picture box to create cam geometry (Arcs)

'I discovered an error in positioning the arc in the Y direction. To
explain the
'point please open a new project and create a picture box, Picture1, and a
command
'button, Command1, on Form1. Insert the following code in procedure
:Form_Load
'and Command1_Click then run.

'Clicking the command button moves the center of the circle to different
axis at Radius, R!, distance and demonstrates that when the center is on or
near the Y axis
'the circumference does not intersect the origin like when it is on the X
axis. Demonstrating the problem in Y. As the radius ,R!, increases the
error increases!
'
'*************
'How do I report this problem and get a fix fast??????

'**************
Watch out for format distruction of code here!

'Form_Load code:

'
'
Form1.WindowState = 2
Picture1.BackColor = vbWhite
Picture1.AutoRedraw = vbTrue
'
' Set Coordinate (0,0) in the center of the picture box.
'
Picture1.ScaleWidth = 5
'
Picture1.ScaleHeight = (Picture1.ScaleWidth / 2) * (Picture1.Height /
Picture1.Width)
'
Picture1.Scale ((Picture1.ScaleWidth * -1) / 2,
Picture1.ScaleHeight)-(Picture1.ScaleWidth / 2, Picture1.ScaleHeight * -1)
'
' Draw Axis at (o,o)
'
Picture1.Line (1 * -1, 0)-(1, 0), vbBlack
Picture1.Line (0, 1)-(0, 1 * -1), vbBlack
'
'
'END CODE Form

'Command1_Click code:

'
' THE PROBLEM IS AGREVATED BY LARGE DIAMETERS (Try : R! = 50, 100, 500)
' and the ERROR only exist in the Y direction.
'
' When the center of the circle is place the radius distance from the
origin on the
' axis the circumference should go through (0,0)
'
' Move center of circle around the axis (R!, 0); (-R!, 0); (0, R!); (0, -R!)
'
Static I As Integer
Dim X!
Dim Y!
Dim R!
Dim Pi!
'
'
Pi! = 3.141592654
'
' Changing R! changes the Circles Diameter
R! = 50
'
Select Case I
    '
    Case 0
        X! = R!: Y! = 0: I = 1
    Case 1
        X! = 0: Y! = R! * -1: I = 2
    Case 2
        X! = (R! * -1): Y! = 0: I = 3
    Case 3
        X! = 0: Y! = R!: I = 0
End Select
'
'
'
' Clear Picture1
Picture1.Cls
'
' Print X! Y! Values
Picture1.CurrentX = 0.2: Picture1.CurrentY = -0.2
Picture1.Print " Center X! = "; X!; " "; " Center Y! = "; Y!
'
'
' Draw Axis at (o,o)
Picture1.Line (1 * -1, 0)-(1, 0), vbBlack
Picture1.Line (0, 1)-(0, 1 * -1), vbBlack
'
' DRAW CIRCLE
' object.Circle [Step] (x, y), radius, [color, start, end, aspect]
Picture1.Circle (X!, Y!), R!, vbRed, 2 * Pi!
'
'
Picture1.Refresh
'
'
'END CODE Command1

-- 
Thank you,
Randy


Relevant Pages

  • VB CircleMethod is Seriously Flawed!!!
    ... I am using the Circle Method in a picture box to create cam geometry ... Clicking the command button moves the center of the circle to different axis ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: VB Circle Method Seems to be Seriously Flawed
    ... it works perfectly when the picture box is made square by setting the ... Randy Birch ... : 'Clicking the command button moves the center of the circle to different: axis at Radius, R!, distance and demonstrates that when the center is on or: near the Y axis ...
    (microsoft.public.vb.general.discussion)
  • Re: Including an area into a circle
    ... gray stuff and erode it by 5 pixels to get pixels where a circle of ... Can you give the code to go from your original picture to the ... But before I start to research how to command a robotic arm to place the object into the center of the future circle, I must find the coordinates of the circles, which I did with your help and to draw the circles on top of the picture that I have. ...
    (comp.soft-sys.matlab)
  • Re: Including an area into a circle
    ... > gray stuff and erode it by 5 pixels to get pixels where a circle of ... > Can you give the code to go from your original picture to the ... But before I start to research how to command a robotic arm to place the object into the center of the future circle, I must find the coordinates of the circles, which I did with your help and to draw the circles on top of the picture that I have. ...
    (comp.soft-sys.matlab)
  • Re: How Are You Celebrating Falwells Death...???
    ... traitor, abortionist, leftist agitators who promotes the axis of evil, ... would rather fight them here than over there, ...
    (rec.food.cooking)