Prev: RE: [FT] SMLs and Banzai Jammers Next: Re: Damage Control and CVs

Re: OT: QBASIC TRIG HELP WANTED

From: Nyrath the nearly wise <nyrath@c...>
Date: Tue, 07 Dec 1999 06:44:16 -0500
Subject: Re: OT: QBASIC TRIG HELP WANTED

Denny Graver wrote:
> 
> I am trying to write a Qbasic program for figuring movement for Full
Thrust.
> I'm not too proud to ask for help when I'm beat and although I have a
dimly
> remembered recollection of trigonometry, I have spent too much time
with
> wrong results to justify not asking.
> 
> Can anyone out there can give me the formula for FT movement (using
QBASIC
> statements if possible)using the following variables:
> 
> X = X START POSTION
> Y = Y START POSTION
> V = VELOCITY
> H = HEADING (1-12)

	It's been years, but I'll try.
	Alas, my copy of FT is buried on my desk and I cannot
	find it, and I disremember the facings.
	The facings below are based on heading=1 being
	to the right, and the headings going counter-clockwise.
	Alter the numbers in the "HAngle" array to change this.
	I have not tested this in QBasic, so you might
	have to clean it up.

DEGREESTORADIANS = 0.0174532925
DIM HANGLE(12)
HANGLE(1) = 0 * DEGREESTORADIANS 
HANGLE(2) = 30 * DEGREESTORADIANS 
HANGLE(3) = 60 * DEGREESTORADIANS 
HANGLE(4) = 90 * DEGREESTORADIANS 
HANGLE(5) = 120 * DEGREESTORADIANS 
HANGLE(6) = 150 * DEGREESTORADIANS 
HANGLE(7) = 180 * DEGREESTORADIANS 
HANGLE(8) = 210 * DEGREESTORADIANS 
HANGLE(9) = 240 * DEGREESTORADIANS 
HANGLE(10) = 270 * DEGREESTORADIANS 
HANGLE(11) = 300 * DEGREESTORADIANS 
HANGLE(12) = 330 * DEGREESTORADIANS 
INPUT "XSTART = "; X
INPUT "YSTART = "; Y
INPUT "VELOCITY = "; V
INPUT "HEADING (1-12)"; H
NEWX = X + (COS(HANGLE(H))*V)
NEWY = Y + (SIN(HANGLE(H))*V)
PRINT NEWX, NEWY

	Of course, you should put in some error checking
	with the Heading input, to be sure that what the user
	types in is between 1 and 12.


Prev: RE: [FT] SMLs and Banzai Jammers Next: Re: Damage Control and CVs