Results 1 to 10 of 10

Thread: parabolic graph

  1. #1

    Thread Starter
    Member
    Join Date
    May 1999
    Location
    Tulsa,OK,USA
    Posts
    56

    parabolic graph

    How do you draw a parabolic graph in a Picture object?

  2. #2

    Thread Starter
    Member
    Join Date
    May 1999
    Location
    Tulsa,OK,USA
    Posts
    56

    cont

    Actually I want to do is drawing a graph between 2 points that will result as a parabolic graph

  3. #3
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    Be more specific.

    Your question is too general to answer.

    What is it you are trying to do?

    Are you trying to display XY-Axes with scales and a plot of a parabola?

    Are you just trying to display part of a parabola as one item in some graphic display?

    Are you trying to do curve fitting using a parabola?

    Do you know how to plot points in a Picture Box? Do you know what the scale mode property is?

    Do you just need to know the equation of a parabola?

    Might you be interested in second order curves in general instead of parabolas?

    BTW: There are many possible parabolas through any two points. Three points determine a unique parabola.
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  4. #4
    Fanatic Member siyan's Avatar
    Join Date
    Jul 2001
    Location
    GOOOAAAAALLLLL!!!!!
    Posts
    869
    I did this once...I almost had a full graphing calculator proggie and i just lost track of it..

    Set the scale on the picture box to match whatever

    then run a loop
    go through all the X values ont he picture box
    calculate Y for the current X value

    determine if Y would show up on the picture box

    then usethe line drawing methods to go from one point to another. relatively simple..i think?

    -C
    Unite, proletariat!

  5. #5
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    relatively simple..i think?
    I dont think it is so simple. The shortest line between two points (ignoring all space/time stuff ) is going to be a straight line. As Guv said, any number of parabolic curves could contain the two points that u are referencing. I wonder if eida is talking about chart smoothing a la Excel charts?
    Regards
    Stuart
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  6. #6
    wossname
    Guest
    One way of writing a 'parabolic' graph equation is: y=x^2
    (X squared)

    But that doesn't mean it is obvious where the zeroes are...

    Lets say that you want the graph to pass through the 2 points at: (-3, 4) and (7,4), then you would use the equation: y=i*(x+3)*(x-7)+4

    The plus 4 raises the entire shape of the graph upwards by 4.

    The x- and x+ parentheses define where the zeroes are (remember to reverse the signs before you put them into the equation).

    i determines the flatness of the parabola. As is mentioned earlier there is actually an infinite number of parabolas that can pass through 2 points, but it it either the i value or a third point that is the defining entity.

  7. #7
    barnabas
    Guest

    RE: Parabola

    Hello,

    The general equation for one type of parabola is

    Y^2=4*a*X

    a is a constant (distance between focus and center of parabola).

    fix a value of 'a' and then feed different values of Y into the equation to get the corresponding value of X.

    obtain 10 points once you have done this scale these points to fit into the picture box control, and you get a parabola with the pointed side facing left and the open end to the right ...like this (

    I think this should work.....


    Thank you

    Arun

  8. #8
    DaoK
    Guest
    I already made something who work with Sinus and it make with a timer the curve slowly ( and when you change the X variable in create the sinus more fast ) If you want to take a look I can give you the code.

  9. #9
    appi101
    Guest
    Hi

    Why not post the code here??

    Appi

  10. #10
    DaoK
    Guest
    Add one picturebox : Picture1
    Add one timer : Timer1

    VB Code:
    1. Option Explicit
    2. Dim speeD
    3. Dim gfDrawing As Integer
    4. Dim gColor
    5. Dim gWidth As Integer
    6. Dim gfPoint As Integer
    7. Dim X1 As Integer
    8. Dim Y1 As Integer
    9. Dim choice As Boolean
    10. Dim abc As Integer
    11. Dim save1 As Integer
    12.  
    13. Private Sub Form_Load()
    14. Me.Width = 4000
    15. Me.Height = 1500
    16. Picture1.Top = 0
    17. Picture1.Left = 0
    18. Picture1.Width = 4000
    19. Picture1.Height = 1500
    20. Timer1.Interval = 10
    21. gWidth = 2
    22. gfDrawing = True
    23. Picture1.DrawWidth = gWidth
    24. choice = True
    25. Picture1.CurrentX = 0
    26. Picture1.CurrentY = 175
    27.  
    28. End Sub
    29.  
    30. Private Sub Timer1_Timer()
    31. 'Daok own code
    32. If Picture1.CurrentY > Picture1.ScaleHeight Then
    33.     choice = False
    34. End If
    35. If Picture1.CurrentY < 0 Then
    36.     choice = True
    37. End If
    38. If choice = True Then
    39.     If gfDrawing Then
    40.         Picture1.DrawWidth = (gWidth)
    41.         'picture1.Line -(picture1.CurrentX + 8, picture1.CurrentY + abc), (gColor)
    42.         Picture1.Line -(Picture1.CurrentX + 8, abc), (gColor)
    43.     End If
    44. End If
    45. If choice = False Then
    46.     If gfDrawing Then
    47.         Picture1.DrawWidth = (gWidth)
    48.         'picture1.Line -(picture1.CurrentX + 8, picture1.CurrentY - abc), (gColor)
    49.         Picture1.Line -(Picture1.CurrentX + 8, abc), (gColor)
    50.     End If
    51. End If
    52. If Picture1.CurrentX > Picture1.ScaleWidth Then
    53.     save1 = Picture1.CurrentY
    54.     Picture1.Cls
    55.     Picture1.CurrentY = save1
    56. End If
    57.  
    58. gColor = RGB(150, 200, 100)
    59. speeD = 0.0048
    60. abc = (Picture1.ScaleHeight / 2) * Cos(speeD * Picture1.CurrentX) + (Picture1.ScaleHeight / 2)
    61.  
    62.  
    63.  
    64. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width