|
-
April 24th, 2012, 07:42 AM
#1
how to calculate x & y in a sine wave pattern?
Hello,
I have the following initial code:
Code:
double objectAngle = -90.0f;
double objectSpeed = 3.0f; // meters per second
double objectDistance = 300.0f;
double objectTime = 0.0f;
double objectHeading = 90.0f;
double elapsedTimePerCycle = 1.0f;
My coordinate system looks like this:
Code:
90 y
|
|
|
+-180 -------------------- 0 x
|
|
|
-90
I want to calculate a new x,y such that it follows a sine wave like pattern until it gets to point (0,0). I want the width of the arc to go out to about -45 degrees, and the same on the other side to about -135 degrees.
How can I compute these new x,y coordinates in C++?
Thanks!
Alex
-
April 24th, 2012, 08:39 AM
#2
Re: how to calculate x & y in a sine wave pattern?
 Originally Posted by aseminov
I want to calculate a new x,y such that it follows a sine wave like pattern until it gets to point (0,0). I want the width of the arc to go out to about -45 degrees, and the same on the other side to about -135 degrees.
How can I compute these new x,y coordinates in C++?
How would you do it on a sheet of paper?
Victor Nijegorodov
-
April 24th, 2012, 08:47 AM
#3
Re: how to calculate x & y in a sine wave pattern?
I am trying to calculate the x and y position of the object ever second. Sorry if I was not clear on that. I would also like to calculate the new distance based on the speed. I want the object to move toward point (0,0) in a sine wave pattern.
I dont know on paper, because I only know trig basics.
-
April 24th, 2012, 08:53 AM
#4
Re: how to calculate x & y in a sine wave pattern?
 Originally Posted by aseminov
I dont know on paper, because I only know trig basics.
Then you have to first learn trigonometry.
Victor Nijegorodov
-
April 24th, 2012, 09:04 AM
#5
Re: how to calculate x & y in a sine wave pattern?
Why even bother replying when you are not goign to help?
-
April 24th, 2012, 09:17 AM
#6
Re: how to calculate x & y in a sine wave pattern?
He can't be more specific, because you need to describe more precisely what are you trying to do.
I've made my best guess on your duplicate thread, but until you confirm, we can't be of much help.
BTW, drawing a crude sketch of the end result and attaching it here might help us better understand what you're saying.
But please, pick one thread or the other - duplicate threads are discouraged on these forums.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|