Message-ID: <00ac01b9f3cb$b6b49d40$89f8c6c3@johans-dator> From: "Johan Henriksson" To: Subject: Re: Trig Help Date: Thu, 16 Mar 1995 19:28:17 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Reply-To: djgpp AT delorie DOT com from Johan Henriksson, Sweden HTTP://come.to/jhewok | Primary mail: johan DOT he AT telia DOT com #UIN 12035895 Second: jhe75 AT hotmail DOT com Third: johan_he AT yahoo DOT com Leadprogrammer and FX-specialist at Real software http://come.to/real_software ************************************************************************* -----Original Message----- From: Ya'qub Newsgroups: comp.os.msdos.djgpp To: djgpp AT delorie DOT com Date: Tuesday, March 16, 1999 7:19 PM Subject: Re: Trig Help >Greetings, > I believe that the trig. functions require the angle argument to be in >radians not degrees. Maybe that's where it's going wrong. >Regards >Ya'qub Not to be rude but I first thought ya'qub to mean good bye... Anyway, didn't someone (I don't know who) change the help to really state that radians are the units? As they are. If you don't like it, switch over to Allegro (256 deg A = 360 deg C). > >Lester Davis wrote in message <36EE71C9 DOT 6A160A75 AT bellsouth DOT net>... >>Hi, IM trying to plot readings gathered from a scanning sonar device. I >>get angle and range readings and would like to see them graphically. But >>my problem is I'm trying to convert the (R,A) into (X,Y) but get >>negative numbers alot of the time. RIght now I'm using an angle of 45 >>and varying the range and looking at the data. To get X im using >>R*cos(a), and y = r*sin(a). Its been a long time since trig, but I >>thought this was correct, Can someone tell me whats wrong, my code id >>below. >>Thanks >>Ringo >> >> >> >> >>#include // For the getch() function. >>#include >>#include >>#define cone 20 >>int main() >>{ >>//screen is 640 W 480 H >> double x1,x2,y1,y2; >> int angle,posangle,negangle; >> int range; >>double cx1,cx2,cy1,cy2; >> >>for(range=15;range<200;range=range+15) >> { >> angle=45; >> posangle=angle+10; >> negangle=angle-10; >> x1=range*cos(posangle); >> y1=range*sin(posangle); >> x2=range*cos(negangle); >> y2=range*sin(negangle); >> printf("x1=%d y1=%d x2=%d y2=%d >>\n",(int)x1,(int)y1,(int)x2,(int)y2); >> } >>return 0; >>} >> >> > > >