Hey i have a mathmatical code that i want to put into a VB program does anyone hav a good idea how i can do it. im not sure what language this code is in but i want to make a program that draws a line that uses this formula to bend.
Code:'Parameters needed: 'wind 'windir (wind direction) 'angle 'power (silver marker) (value 0 - 400) Dim w1 as double = wind * 2 - 1 If w1 < 0 Then w1 = 0 Dim ca As Double = Math.Cos(angle / 180.0 * 3.14159265358979) Dim cw As Double = Math.Cos(windir * 3.14159265358979 / 180.0) Dim wind2 As Double = w1 * cw Dim X As Double = ca * 920 * power / 400 Dim w2 As Double = wind * 2 - 1 If w2 < 0 Then w2 = 0 Dim sa As Double = Math.Sin((angle / 180.0 * 3.14159265358979)) Dim sw As Double = Math.Sin((windir * 3.14159265358979 / 180.0)) Dim wind3 As Double = we * sw Dim Y As Double = sa * 920 * power / 400 Dim i As Double 'This one MUST be double, or at least decimal 'To draw the line going right For i = 0.0 To 12.0 Step 0.05 Dim drawx As Double = (PointOfOriginX) + (X * i + wind2 * i * i) Dim drawy As Double = (PointOfOriginY) - (Y * i - wind3 * i * i - 0.5 * (387) * i * i) ('To draw the line going left For i = 0.0 To 12.0 Step 0.05 Dim drawx As Double = (PointOfOriginX) - (X * i - wind2 * i * i) Dim drawy As Double = (PointOfOriginY) - (Y * i - wind3 * i * i - 0.5 * (387) * i * i)) If i = 0.0 Then MoveToEx((DC), CInt(X - 2), CInt(Y - 2), 0) 'For DC you can use a simple GetDC(0) Else LineTo((DC), CInt(X - 2), CInt(Y - 2)) End If




Reply With Quote