Click to See Complete Forum and Search --> : parabolic graph
eida_hanafiah
Jul 12th, 2001, 01:22 AM
How do you draw a parabolic graph in a Picture object?
eida_hanafiah
Jul 12th, 2001, 01:52 AM
Actually I want to do is drawing a graph between 2 points that will result as a parabolic graph
Guv
Jul 13th, 2001, 09:24 PM
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.
siyan
Aug 11th, 2001, 10:04 PM
I did this once...I almost had a full graphing calculator proggie and i just lost track of it.. :mad: :)
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
beachbum
Aug 11th, 2001, 10:18 PM
relatively simple..i think? I dont think it is so simple. The shortest line between two points (ignoring all space/time stuff :p) 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
wossname
Sep 9th, 2001, 02:43 PM
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.
barnabas
Sep 16th, 2001, 11:10 PM
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
DaoK
Sep 17th, 2001, 05:05 PM
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.
appi101
Sep 18th, 2001, 06:32 AM
Hi
Why not post the code here??
Appi
DaoK
Sep 18th, 2001, 10:40 AM
Add one picturebox : Picture1
Add one timer : Timer1
Option Explicit
Dim speeD
Dim gfDrawing As Integer
Dim gColor
Dim gWidth As Integer
Dim gfPoint As Integer
Dim X1 As Integer
Dim Y1 As Integer
Dim choice As Boolean
Dim abc As Integer
Dim save1 As Integer
Private Sub Form_Load()
Me.Width = 4000
Me.Height = 1500
Picture1.Top = 0
Picture1.Left = 0
Picture1.Width = 4000
Picture1.Height = 1500
Timer1.Interval = 10
gWidth = 2
gfDrawing = True
Picture1.DrawWidth = gWidth
choice = True
Picture1.CurrentX = 0
Picture1.CurrentY = 175
End Sub
Private Sub Timer1_Timer()
'Daok own code
If Picture1.CurrentY > Picture1.ScaleHeight Then
choice = False
End If
If Picture1.CurrentY < 0 Then
choice = True
End If
If choice = True Then
If gfDrawing Then
Picture1.DrawWidth = (gWidth)
'picture1.Line -(picture1.CurrentX + 8, picture1.CurrentY + abc), (gColor)
Picture1.Line -(Picture1.CurrentX + 8, abc), (gColor)
End If
End If
If choice = False Then
If gfDrawing Then
Picture1.DrawWidth = (gWidth)
'picture1.Line -(picture1.CurrentX + 8, picture1.CurrentY - abc), (gColor)
Picture1.Line -(Picture1.CurrentX + 8, abc), (gColor)
End If
End If
If Picture1.CurrentX > Picture1.ScaleWidth Then
save1 = Picture1.CurrentY
Picture1.Cls
Picture1.CurrentY = save1
End If
gColor = RGB(150, 200, 100)
speeD = 0.0048
abc = (Picture1.ScaleHeight / 2) * Cos(speeD * Picture1.CurrentX) + (Picture1.ScaleHeight / 2)
End Sub
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.