delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/03/09:36:55

Newsgroups: comp.os.msdos.djgpp
Subject: Re: Trig
From: richard AT stardate DOT bc (NOSPAM), ca AT delorie DOT com (Richard Sanders)
X-Newsreader: WinVN 0.99.9 (Released Version) (x86 32bit)
References: <7gf98i$bc8 AT journal DOT concentric DOT net> <372B2E4E DOT C416477B AT earthlink DOT net>
MIME-Version: 1.0
NNTP-Posting-Host: wlp40.rapidnet.net
Message-ID: <372cfe25@news.vphos.net>
Date: 2 May 1999 18:38:45 -0800
X-Trace: 2 May 1999 18:38:45 -0800, wlp40.rapidnet.net
Lines: 34
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In article <372B2E4E DOT C416477B AT earthlink DOT net>, mambuhl AT earthlink DOT net says...
>
>Paradox wrote:
>> 
>> How do I use Trig to determine the reverse slope of an object traveling at n
>> degrees? And vise versia?
>> 
>> Paradox
>
>Since you are using gcc, <math.h> will provide M_PI, as long as you are not
>compiling in ANSI mode.  This allows you to convert an angle from degrees into
>radian measure:
>
>#define radians(a) )(a)*(M_PI/180.))
>
>The slope (dy/dx) is just tan(radians(angle)).
>
>This is extremely simple math and should be learned before attempting such
>programming.  

Agreed.  The simple way is 


if( angle < 180 )
  angle += 180;
else
  angle = 360 - angle;

I used to use this about 30 years ago when the army dropped me off in the 
middle of nowhere with a map, compas, protractor and pencil.  If you wanted 
supper you marched to map reff where you would be picked up. We had to find 
where we were on the map by taking compas bearings on mountains and the like 
and drawing two back bearings on the map.  X marks the spot you are at. 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019