Hello,
I' ve been created application, that allows to input physical measures, calculate and show ballistic curve chart. Here is the link to the project:
https://sourceforge.net/projects/freebalistic/
...and some screenshoots:
I hope, that it will be useful for anyone of you.
The project in its current form is just a figment of what I would like to get, because there are some limitations that require the help of an expert in transforming physical patterns. That is what I would like to write about now.
According to what I wrote on the project website: "The aim of this project is to obtain a modification of the calculation that allows you to enter at least the angle of the projection and the strength of the wind."
Ultimately, there should be two additional fields in the program to introduce these quantities. I would like the application to only show a graph in one of the three considered planes, in a 2D view, and that the reading of the size and their analysis with the help of the legend image were intuitive. I need a formula for this purpose, which makes the result of the equation "z =" from the angle "alpha_xz" and includes the vector "Wx". Please, show the derivation, which allows you to develop the pattern for the placement of "Z =" in the "XZ" plane.
I am also asking for tips on how to consolidate patterns for rising and falling in one graph. Perhaps it is possible to transform both given patterns (climb and descent) so that a pattern is created that applies in this particular case, where the ballistic curve is considered in one dimension. The purpose of these applications is, as in most other programs of this type, the creation of a simple to analyze the 2D system, to calculate the height of the projectile after a specified time, possibly also calculating the distance traveled in a straight, horizontal line from the point of ejection. Unlike typical applications, however, the air resistance and wind force should also be taken into account. All this will be combined with a simple to read for the user drawing, presenting the size and 2D vectors used for calculations.
I am asking you, therefore, for the necessary diagrams and formulas to be available.
Greetings.
FreeBalistic  physical app to calculate ballistic curves
Re: FreeBalistic  physical app to calculate ballistic curves
hello petercat :)
your project look really good.
I would like to compile the program myself so that the menu would be in English, but there are missing bmp files, would you be so kind and add the necessary files for your project?
also, what IDE are you using?
your project look really good.
I would like to compile the program myself so that the menu would be in English, but there are missing bmp files, would you be so kind and add the necessary files for your project?
also, what IDE are you using?
Re: FreeBalistic  physical app to calculate ballistic curves
The BMP files you can download from Sourceforge project Website. There you can find screenshoots atached to project. One of them are Your missing files, just open it in new tab and save as BMP via your net browser.
I am using FBEdit. In the Website on Sourceforge there is the project file of this Editor, *.FBP.
Greetings.
I am using FBEdit. In the Website on Sourceforge there is the project file of this Editor, *.FBP.
Greetings.
Re: FreeBalistic  physical app to calculate ballistic curves
Interesting subject.
for fun
Drag is proportional to velocity, and a wind factor.
for fun
Drag is proportional to velocity, and a wind factor.
Code: Select all
Dim As Integer xres,yres
Screen 20,32,,64
Screeninfo xres,yres
Dim Shared As Any Ptr i:i=Imagecreate(xres,yres,0)
Type v2
As Single x,y
End Type
Type screendata
As Integer w,h,depth,bpp,pitch
As Any Pointer row
As Ulong Pointer pixel32
End Type
Dim Shared As screendata ThisScreen,thisimage
With ThisScreen
Screeninfo .w,.h,.depth,.bpp,.pitch
.row=Screenptr
End With
With thisimage
Imageinfo i,.w,.h,.bpp,.pitch,.row
.depth=32
End With
Const k=1
Const g=9.81 'gravity
Const m=5 'mass
Const pi=4*Atn(1)
Dim Shared As Integer mx,my,btn
#define range(f,l) Int(Rnd*((l+1)(f))+(f))
#define map(a,b,x,c,d) ((d)(c))*((x)(a))/((b)(a))+(c)
#define incircle(cx,cy,radius,x,y) (cxx)*(cxx) +(cyy)*(cyy)<= radius*radius
#define inbox mx>20 andalso mx<400 andalso my>300 andalso my<340
Sub bline(sd As screendata,x1 As Integer,y1 As Integer,x2 As Integer,y2 As Integer,col As Ulong)
#define ppset32(_x,_y,colour) *Cptr(Ulong Ptr,sd.row+ (_y)*sd.pitch+ (_x) Shl 2) =(colour)
#define onscreen ((x1+x)>=0) And ((x1+x)<(sd.w1)) And ((y1+y)>=0) And ((y1+y)<(sd.h1))
Var dx=Abs(x2x1),dy=Abs(y2y1),sx=Sgn(x2x1),sy=Sgn(y2y1)
Dim As Integer e
If dx<dy Then e=dx\2 Else e=dy\2
Do
For x As Integer=0 To 1
For y As Integer=0 To 1
If onscreen Then
ppset32((x1+x),(y1+y),col)
End If
Next y
Next x
If x1 = x2 Then If y1 = y2 Then Exit Do
If dx > dy Then
x1 += sx : e = dy : If e < 0 Then e += dx : y1 += sy
Else
y1 += sy : e = dx : If e < 0 Then e += dy : x1 += sx
End If
Loop
End Sub
'Bressenham line thickened
Sub thickline(sd As screendata,_
x1 As Long,_
y1 As Long,_
x2 As Long,_
y2 As Long,_
thickness As Single,_
colour As Ulong)
Var h=Sqr((x2x1)*(x2x1)+(y2y1)*(y2y1))
Var s=(y1y2)/h
Var c=(x2x1)/h
For yp As Double=thickness/2 To thickness/2 'step 2
bline(sd,x1+(s*yp),y1+(c*yp),x2+(s*yp),y2+(c*yp),colour)
Next yp
End Sub
Sub drawline(s As screendata,x As Long,y As Long,angle As Single,length As Long,col As Ulong)
angle=angle*.0174532925199433
Var x2=x+length*Cos(angle)
Var y2=ylength*Sin(angle)
thickline(s,x,y,x2,y2,10,col)
End Sub
Sub clearimage()
Line i,(0,0)(1023,767),Rgba(0,0,0,220),bf
drawline(thisimage,990,750,0,20,Rgb(0,200,0))
End Sub
Function Regulate(Byval MyFps As Long,Byref fps As Long=60) As Long
Static As Double timervalue,lastsleeptime,t3,frames
frames+=1
If (Timert3)>=1 Then t3=Timer:fps=frames:frames=0
Var sleeptime=lastsleeptime+((1/myfps)Timer+timervalue)*1000
If sleeptime<1 Then sleeptime=1
lastsleeptime=sleeptime
timervalue=Timer
Return sleeptime
End Function
Sub fire(startpos As v2,theta As Single,v As Single)
Randomize
#macro show_wind(d)
Draw String(500,20),"Wind " & Abs(w)
If d<0 Then
Draw String(500,60),"<"
Else
Draw String(500,60),">"
End If
#endmacro
theta=theta*(4*Atn(1))/180
Dim As Integer xres,yres,w=range(10,10)
Screeninfo xres,yres
Dim As v2 position,lastposition
Dim As Single t
Do
t+=.05
position.x=startpos.x+(m/k)*(1Exp((k/m)*t))*(V*Cos(theta)w)+w*t
position.y=startpos.y+(m/k)*(1Exp((k/m)*t))*(V*Sin(theta)+g*m/k)(g*m/k)*t
Screenlock
Put(0,0),i,Pset
show_wind(w)
Locate 2,2
Print "Speed "; 100*Sqr((position.xlastposition.x)^2+(position.ylastposition.y)^2)
thickline(thisscreen,position.x,yresposition.y,lastposition.x,yreslastposition.y,6,Rgb(0,155,255))
thickline(thisimage,position.x,yresposition.y,lastposition.x,yreslastposition.y,6,Rgb(0,155,255))
lastposition=position
Screenunlock
Sleep regulate(60)
If incircle(1000,20,10,position.x,position.y) Then Draw String i,(500,500),"HIT"
Loop Until position.y<0
End Sub
Sub show(p As Integer,theta As Long,cx As Long,cy As Long)
Put(0,0),i,Pset
Circle(150,150),25,Rgb(0,200,0),,,,f
Draw String(135,145),"Fire",Rgb(200,0,0)
Draw String(50,280),"Powder = " &p
Draw String(400,320),"< Adjust Powder"
Line(20,300)(400,340),Rgb(0,200,255),b
Draw String(20,350),"100 300"
Circle(0,768),100
Draw String(100,740),"< Adjust elevation"
Draw String(20,600),"Elevation = "&theta
Circle(cx,cy),18,Rgb(100,0,0),,,,f
drawline(thisscreen,0,768,theta,100,Rgb(200,100,0))
drawline(thisimage,990,750,0,20,Rgb(0,200,0))
End Sub
Dim As String key
Dim As Integer cx=200,cy=320,powder=200,theta=40
Dim As v2 startpos
Dim As Single a=theta*pi/180
Do
key=Inkey
Getmouse mx,my,,btn
Screenlock
show(powder,theta,cx,cy)
If btn=1 And inbox Then
Cls
show(powder,theta,cx,cy)
cx=mx
If cx<40 Then cx=40
If cx>380 Then cx=380
powder=map(40,380,cx,100,300)
End If
If incircle(150,150,25,mx,my) And btn Then
Screenunlock
Cls
clearimage
fire(startpos,theta,powder)
End If
If incircle(0,768,100,mx,my) And btn=1 Then
Cls
show(powder,theta,cx,cy)
a=Atan2(768my,mx)
theta=a*180/pi
End If
startpos=Type(100*Cos(a),100*Sin(a))
Screenunlock
Loop Until key=Chr(27)
If i Then Imagedestroy i
Re: FreeBalistic  physical app to calculate ballistic curves
Hello,
It's time for first update of my app! The files of newer FreeBalistic version are available on: https://sourceforge.net/projects/freebalistic/files/
Feel invited to download this update!
Screen of currently released version:
Have Fun, this time with english GUI !
It's time for first update of my app! The files of newer FreeBalistic version are available on: https://sourceforge.net/projects/freebalistic/files/
Feel invited to download this update!
Screen of currently released version:
Have Fun, this time with english GUI !

 Posts: 2337
 Joined: May 31, 2005 9:59
 Location: Croatia
 Contact:
Re: FreeBalistic  physical app to calculate ballistic curves
Really cool stuff. Something I wanted to do for a while (learn/refresh physics by producing physics related toys/educational programs).
Realtime simulation planned?
Realtime simulation planned?
Re: FreeBalistic  physical app to calculate ballistic curves
Thanks!
The real time simulation is not plannet yet, but I was thinking about it. Maybe some animation of moving bullet will be added. But first I would like to fix the problem of the tight scope of values on the chart. It should be more flexible and work like Excel, that can automatically make the scales for axis in charts. I was looking for some freebasic charts library and it seems like it is possible to use it in this app. I'll do it when I get some free time, maybe then with some advanced graphical simulations :)
The real time simulation is not plannet yet, but I was thinking about it. Maybe some animation of moving bullet will be added. But first I would like to fix the problem of the tight scope of values on the chart. It should be more flexible and work like Excel, that can automatically make the scales for axis in charts. I was looking for some freebasic charts library and it seems like it is possible to use it in this app. I'll do it when I get some free time, maybe then with some advanced graphical simulations :)
Re: FreeBalistic  physical app to calculate ballistic curves
As you've noted yourself, it's currently having a to much limited scope.
(guns can fire 'downhill' too)
I'm an old armourer of the: Oerlikon_GDF (twin AA autocannon, 35 mm NATO),
which have a barrel movement angle from: below 0° to more than 90° (straight up).
This would require a change in the currently preset min./max. input values ...
(a split into height of cannon itself (barrel pivot point) and added/subtracted barrel
end's distance (from pivot), derived from lenght/angle of barrel+weapon)
There is yet another part to be taken into consideration: (but nice, for animation!)
The WarAmunition (grenades) have a 'self destruct' mechanism, set at 4000 m (of flight).
The latest Ammo, called AHEAD, is even a more complex beast, to deal with ...
(guns can fire 'downhill' too)
I'm an old armourer of the: Oerlikon_GDF (twin AA autocannon, 35 mm NATO),
which have a barrel movement angle from: below 0° to more than 90° (straight up).
This would require a change in the currently preset min./max. input values ...
(a split into height of cannon itself (barrel pivot point) and added/subtracted barrel
end's distance (from pivot), derived from lenght/angle of barrel+weapon)
There is yet another part to be taken into consideration: (but nice, for animation!)
The WarAmunition (grenades) have a 'self destruct' mechanism, set at 4000 m (of flight).
The latest Ammo, called AHEAD, is even a more complex beast, to deal with ...
Who is online
Users browsing this forum: No registered users and 3 guests