delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/01/11/19:15:20

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Zenko B. Klapko Jr." <zen1 AT comcast DOT net>
Subject: Re: allegro and math libraries
Newsgroups: comp.os.msdos.djgpp
References: <5cp%7.332292$ez DOT 47656452 AT news1 DOT rdc1 DOT nj DOT home DOT com> <Xns91939FA2EA6EASINANUNUR AT 132 DOT 236 DOT 56 DOT 8>
User-Agent: Pan/0.9.1 (Unix)
X-No-Productlinks: Yes
Lines: 46
Message-ID: <56L%7.334708$ez.48032249@news1.rdc1.nj.home.com>
Date: Sat, 12 Jan 2002 00:06:25 GMT
NNTP-Posting-Host: 68.38.96.90
X-Complaints-To: abuse AT home DOT net
X-Trace: news1.rdc1.nj.home.com 1010793985 68.38.96.90 (Fri, 11 Jan 2002 16:06:25 PST)
NNTP-Posting-Date: Fri, 11 Jan 2002 16:06:25 PST
Organization: Excite AT Home - The Leader in Broadband http://home.com/faster
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello A. Sinan!

Thank you for responding to my post! I'm really greatful for the help it
gave me a new persepctive on the problem. Heres a revised edition for the
propeller spinning line if you want one point stationary then comment out
xang2 and yang2. 

-Zen
#include <math.h>
#include <conio.h>
#include <iostream.h>
#include <allegro.h>

void linerotate();

int main()
{
allegro_init();
set_gfx_mode(GFX_VESA1,800,600,0,0);
linerotate();
return 0;
};
/******************************************************************/
void linerotate()
{  double rad,rad2,xang,yang,xpos=100,ypos=100,xpos2=100,ypos2=100,xang2,yang2;

for(int ang=0;ang<=360;ang++)
{
 rad=ang*(3.14/180);
 rad2=(ang+180)*(3.14/180);
 xang=25*cos(rad)-25*sin(rad);
 yang=25*sin(rad)+25*cos(rad);
 xang2=25*cos(rad2)-25*sin(rad2);
 yang2=25*sin(rad2)+25*cos(rad2);
 xpos+=xang2;
 ypos+=yang2;
 xpos2+=xang;
 ypos2+=yang;
 
line(screen,int(xpos),int(ypos),int(xpos2),int(ypos2),3);
 if(getch()=='q')
   ang=359;
 xpos=100; ypos=100; xpos2=100; ypos2=100;
}
clear(screen);
};

- Raw text -


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