www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/28/17:27:07

From: Darren Tanner <darren AT vayona DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: converting grades speed ???
Date: Sat, 28 Feb 1998 19:14:50 +0000
Distribution: world
Message-ID: <6uyUQGAqIG+0Iwkz@vayona.demon.co.uk>
References: <6d8rsg$gc4$1 AT o DOT online DOT no>
NNTP-Posting-Host: vayona.demon.co.uk
MIME-Version: 1.0
Lines: 18
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <6d8rsg$gc4$1 AT o DOT online DOT no>, "[iC]"
<jan AT narvik DOT crosswinds DOT net> writes
>Uh, this might not be the right group to poste this question, but anyway ...
>
>Does anybody knows how to convert speed and angel to +-x and y ?
>like if the angel of the object is 45 grades and speed is one the x and y
>values vould be -1 both, and if the object has an angel of 90 and speed of 5
>the y would have the value -5 and x = 0. uhh get the idea ?? ;-)
>Have anybody done somthing like this or have any ideas ?

This is fairly easy. The equation to give the results requested would
be:
x = -speed * cos(angle)
y = -speed * sin(angle)

These should work fine.
-- 
Darren Tanner

- Raw text -


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