erifash Posted June 26, 2005 Share Posted June 26, 2005 (edited) Any first-year in physics should learn this: ; Variables ;============================== $n_orig_velocity = 40 $n_angle = 35 ; Constants ;============================== $n_acceleration_y = -9.8 $n_acceleration_x = 0 ; Calculations ;============================== $n_velocity_x = $n_orig_velocity * Cos(_Radian($n_angle)) $n_velocity_y = $n_orig_velocity * Sin(_Radian($n_angle)) $n_half_time = ( 0 - $n_velocity_y ) / $n_acceleration_y ;Return: Time to halfway point in trajectory $n_displacement_y = ( $n_velocity_y * $n_half_time ) + ( 0.5 * $n_acceleration_y * ( $n_half_time * $n_half_time ) );Return: Vertical displacement $n_total_time = 2 * $n_half_time ;Return: Total time in trajectory $n_displacement_x = $n_velocity_x * $n_total_time ;Return: Horizontal displacement ; Return ;============================== $s_ret = "Velocity: " & $n_orig_velocity & " meters per second" & @CRLF & "Angle: " & $n_angle & " degrees" & @CRLF & "Horizontal Velocity: " & $n_velocity_x & " meters per second" & @CRLF & "Vertical velocity: " & $n_velocity_y & " meters per second" & @CRLF & "Time to halfway point in trajectory: " & $n_half_time & " seconds" & @CRLF & "Total time in trajectory: " & $n_total_time & " seconds" & @CRLF & "Horizontal displacement: " & $n_displacement_x & " meters" & @CRLF & "Vertical displacement: " & $n_displacement_y & " meters" ClipPut($s_ret) Run("notepad.exe", @SystemDir, @SW_MAXIMIZE) Do Sleep(100) Until WinActive("Untitled - Notepad", "") Send("^v") Func _Radian($nDegrees) If not Number($nDegrees) Then SetError(1) Return "" EndIf Return $nDegrees / 57.2957795130823 EndFunc Just to make things easier! Also, I will be submitting this _Radian() function to math.au3 as AutoIt currently has no function to convert degrees into radians. EDIT: Angle is measured in degrees and velocity is measured in meters per second. Edited June 26, 2005 by erifash My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now