0% found this document useful (0 votes)
31 views

Programacion

This document contains code for graphing the trajectory of a projectile over time in a picture box. It includes declarations of variables for the gravitational constant, pi, time, position, velocity, and radius. In the first click sub, it scales the graph, calculates the x and y positions over time using kinematic equations, and graphs blue circles at each position. It pauses between each iteration. The second click sub clears the graph by filling it with white and redrawing the trajectory in white.

Uploaded by

mirko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Programacion

This document contains code for graphing the trajectory of a projectile over time in a picture box. It includes declarations of variables for the gravitational constant, pi, time, position, velocity, and radius. In the first click sub, it scales the graph, calculates the x and y positions over time using kinematic equations, and graphs blue circles at each position. It pauses between each iteration. The second click sub clears the graph by filling it with white and redrawing the trajectory in white.

Uploaded by

mirko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Opcin xplicit

Private Declare Sub Sleep Lib "kernel32" (By Val milliseconds As Long)
Private Sub Command1_Click () graficar
Dim g As Double
Dim pi As Double
Dim n As Double
Dim i As Double
Dim y As Double
Dim xs As Double
Dim ys As Double
Dim r As Double
Dim z As Double
Dim zz As Double
Dim h As Double
Dim ym As Double
Dim xm As Double
g = 9.8
graf.FillColor = vbBluesirve par modificar color del relleno . Es una propiedad
del picture box
pi = 3.14156265359
t = 2 * v * Sin(alfa * pi / 180) / g
estas instrc son para escalar
xm = v * Cos(45 * pi / 180) * t
ym = v * v * Sin(90 * pi / 180) * Sin(90 * pi / 180) / 2 / g
modificar formula
x = v * Cos(alfa * pi / 180) * t
ymax = v * v * Sin(alfa * pi / 180) * Sin(alfa * pi / 180) / 2 / g
r=x/50

xs = xm +2*r
ys = ym + 2*r
z = xm / 10
zz = ymax / 10
graf.Scale (-z, ys)-(xs, -zz)
n=t/9
For i = 0 To 9

h=i*n
y = v * Sin(alfa * pi / 180) * h - 1 / 2 * g * h * h
x = v * Cos (alfa * pi / 180) * h
graficar crculos . Coord. Del centroradiocolor
graf.Circle (x, y), r, vbBlue
pausar esta milisegundos
Sleep 1000
Next i
End Sub
Private Sub Command2_Click() limpiar la pantalla
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim

g As Double
pi As Double
n As Double
i As Double
y As Double
xs As Double
ys As Double
r As Double
z As Double
zz As Double
h As Double
ym As Double
xm As Double

g = 9.8
pi = 3.14156265359
t = 2 * v * Sin (alfa * pi / 180) / g
xm = v * Cos(45 * pi / 180) * t
x = v * Cos (alfa * pi / 180) * t
ym = v * v * Sin (90 * pi / 180) * Sin(90 * pi / 180) / 2 / g
ymax = v * v * Sin(alfa * pi / 180) * Sin(alfa * pi / 180) / 2 / g
xs = x + x / 10
ys = ym + ym / 10
z = x / 10
zz = ymax / 10
graf.Scale (-z, ys)-(xs, -zz)
r = xs / 50
graf.FillColor = vbWhitegraficamos lo mismo en color blanco
n=t/9
For i = 0 To 9
h=i*n
y = v * Sin (alfa * pi / 180) * h - 1 / 2 * g * h * h
x = v * Cos(alfa * pi / 180) * h

graf.Circle (x, y), r, vbWhitecamniamos a blanco


Next i
End Sub

You might also like