Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Request / Listing] Drawing line based on angle less than 360 degrees and length  (Read 2046 times)

0 Members and 1 Guest are viewing this topic.

Ben

[Request / Listing] Drawing line based on angle ...
« on: April 18, 2006, 08:35:57 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
Taking the starting position of this as 0,0 (for ease, and the fact that you can just add anything on to it anyway), how would I draw a line of angle theta and length l?

It's been annoying me because sin and cos only range from 0 to 90, not 360.
Help please.
« Last Edit: February 24, 2012, 11:02:50 am by Niek »
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion
Re: Drawing a line based on an angle less than 3...
« Reply #1 on: April 18, 2006, 09:08:06 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
Basic pusedo code for drawing a line along a Angle / Length.

Code: [Select]
X2 = X + (Sin(Angle) * Length)
Y2 = Y + ((-Cos(Angle)) * Length)
DrawLine(X,Y,X2,Y2)

Im not sure what you mean by sin/cos being only from 0-90, but it may be because C++ using another measurment for Angles, ill have a look 1 sec.
Logged

Ben

Re: Drawing a line based on an angle less than 3...
« Reply #2 on: April 18, 2006, 09:24:07 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
What I mean is that sine ranges from -1 to 1, and the arcsine of those is 90, the maximum, and of course the lowest is 0 (asin(0))
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion

aab

^ Evolved from a Hobbit
Re: Drawing a line based on an angle less than 3...
« Reply #3 on: April 19, 2006, 11:02:01 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 992
radians?
the range of asin is -Pi/2 to Pi/2 and inverse sin doesnt mathematically exist beyond those values, its all fine. acos is 0 to Pi as this is similarly the closed interval under which inverse cosine is mathematically a function.
Logged




I ♥ Sol
.... I ♥ Sol ? wtf how long has that been there? >_> *rrrrrrrrar*
  • MySpace
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.044 seconds with 45 queries.

anything