From: " [iC]" Newsgroups: comp.os.msdos.djgpp Subject: Re: converting grades speed ??? Date: Sun, 1 Mar 1998 00:30:47 +0100 Organization: Telenor Online Public Access Lines: 47 Message-ID: <6da6ms$l7c$1@o.online.no> References: <199802282007 DOT MAA15146 AT adit DOT ap DOT net> NNTP-Posting-Host: ti36a01-0045.dialup.online.no To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Nate Eldredge wrote in message <199802282007 DOT MAA15146 AT adit DOT ap DOT net>... >At 12:20 2/28/1998 +0100, [iC] wrote: >>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 > ^^^^^^ >Do you mean `degrees'? yupp, my english is no good ;-) >>values vould be -1 both, and if the object has an angel of 90 and speed of 5 > ^^^^^^^^^^^^^^^^^^^^^^^ >No they wouldn't! They would be sqrt(2)/2. See below. > >>the y would have the value -5 and x = 0. uhh get the idea ?? ;-) > >If you're using standard geometric conventions, y would be +5. I meant on the screen (0,0 =top left) >>Have anybody done somthing like this or have any ideas ? > >It's simple trigonomentry/vector math. In brief: > >x = speed * cos(angle) >y = speed * sin(angle) > sorry, but we have not had about sin and cos at class..... >Note that to use the C trig functions, you must convert the argument into >radians. There are (2*pi) radians in a full circle. So: > >radians = (degrees * 180) / pi > uh, ok ;-)