Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
simple 2D vector graphics part 2: moving in the direction of an angle
#3
(10-28-2022, 09:36 PM)bplus Wrote: Ugh! you make it W A Y too complicated! Sorry I got to say.

dx = change along x axis ie xnew = xold + dx
dy = change along y axis ie ynew = yold + dy

dx = speed * cos(directionRadians)
dy = speed * sin(directionRadians)

Thanks for your reply and sorry for giving you a headache! 

I probably do make it too complicated, I just totally suck at math.
The whole radians thing confuses me. 
According to this article, 1 radian = distanceTravelled/radius. 
That makes no sense to me in this context, 
since there is no circle and hence no radius. 
What should the radius be? 
Half the screen width (or height, whichever is bigger)? 
Or if the world extends to beyond the screen, half of that width? 
And what is distance travelled supposed to be? 
Sorry, I do believe you, just not sure I understandHuh

(Also the precalculated arrays for dx/dy to degrees are to save having to do some of the math on the fly.)
Reply


Messages In This Thread
RE: simple 2D vector graphics part 2: moving in the direction of an angle - by madscijr - 10-28-2022, 10:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Halloween Game - Part 1 Unseen Machine 24 2,567 10-15-2025, 07:11 PM
Last Post: Unseen Machine
  Angle, Vector, Radian, and Distance Library TerryRitchie 11 2,747 03-31-2025, 10:16 PM
Last Post: Dragoncat
  SVG graphics demos James D Jarvis 4 904 03-25-2025, 12:41 AM
Last Post: James D Jarvis
  Endian conversion...Part 2, The Endian Is Nigh! tantalus 0 395 03-22-2025, 09:43 PM
Last Post: tantalus
  Got so drunk for St. Patricks Day, I programmed something in graphics... Pete 42 8,706 08-04-2024, 04:05 PM
Last Post: Pete

Forum Jump:


Users browsing this thread: 1 Guest(s)