Location on a circle at time t.

  • Context: Undergrad 
  • Thread starter Thread starter NCGrimbo
  • Start date Start date
  • Tags Tags
    Circle Time
Click For Summary

Discussion Overview

The discussion revolves around calculating the position of an object moving in a circular path over time, given its initial position, radius, and velocity. Participants explore the mathematical formulas needed to determine the final coordinates of the object after a specified duration, with a focus on programming implementation.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Homework-related

Main Points Raised

  • One participant seeks a formula to calculate the final x and y positions (Fx, Fy) of an object on a circle after a certain time, given the radius, starting positions, and velocity.
  • Another participant proposes a set of equations to compute the final positions based on the initial conditions provided.
  • A participant shares their code implementation but encounters issues with the output not matching the expected circular path centered at a specified point.
  • Subsequent replies suggest adjustments to the formulas to account for the center of the circle not being at the origin, proposing a revised set of equations that incorporate the center coordinates.
  • One participant confirms that the adjustments resolved their issue with the calculations.

Areas of Agreement / Disagreement

Participants generally agree on the need for adjustments to the formulas to account for the center of the circle. However, there is no explicit consensus on the initial formulas proposed, as they were refined throughout the discussion.

Contextual Notes

The discussion includes assumptions about the constancy of radius and velocity, and the need for clarity on the reference point for the circular motion calculations. There are unresolved aspects regarding the implementation details in the code shared.

NCGrimbo
Messages
4
Reaction score
0
Hi all. I'm doing a little program for my own fun and I'm having troubles with the physics. I need to be able to calculate where an object is on a circle after an amount of time has passed. I know the radius (R) of the circle, the starting x (Sx) and y (Sy) positions, and the velocity (v). I'd like to be able to generated the finishing x (Fx) and y (Fy) positions. The velocity and radius are constant for each object, but I have several objects rotating around a central point. It's similar to planets orbiting the sun, but I don't need to have any gravitational interaction between the objects. I also know the mass of the objects (m) if I need that for calculating.

Can anyone give me a formula or set of formulas to solve for Fx,Fy?

Thanks!
 
Physics news on Phys.org
In terms of the variables given it should be:

[tex] \begin{align*}<br /> F_x &= S_x\cos(vt/R) - S_y\sin(vt/R) \\<br /> F_y &= S_x\sin(vt/R) + S_y\cos(vt/R) <br /> \end{align*}[/tex]
 
That's what I was looking for. Thanks Peeter.
 
I seem to be having problems converting the formulas into my code. Here's the code I've created:

Code:
'Starting values
    nRadius = 30
    StartX = 130
    StartY = 100
    CenterX = 100
    CenterY = 100
    nVelocity = 1

    'Set the current XY to be the starting XY
    CurX = StartX
    CurY = StartY

    'Draw a line from 0,0 to the starting point
    DrawPoint(0, 0, CurX, CurY)

    'Save the point data to a file for analysis (currentX, CurrentY, Distance from "center" to XY, Distance from 0,0 to XY)
    fStream.WriteLine(CurX.ToString + "," + CurY.ToString + "," + Sqrt(((CurX - CenterX) * (CurX - CenterX)) + ((CurY - CenterY) * (CurY - CenterY))).ToString + "," + Sqrt(((CurX) * (CurX)) + ((CurY) * (CurY))).ToString)

    'Loop 360 times to form the circle
    For nTime = 1 To 360
      'Set the new CurX
      CurX = StartX * (Cos((nVelocity * nTime) / nRadius)) - StartY * (Sin((nVelocity * nTime) / nRadius))
      'Set the new CurY
      CurY = StartX * (Sin((nVelocity * nTime) / nRadius)) + StartY * (Cos((nVelocity * nTime) / nRadius))

      'Save the point data to a file for analysis (currentX, CurrentY, Distance from "center" to XY, Distance from 0,0 to XY)
      fStream.WriteLine(CurX.ToString + "," + CurY.ToString + "," + Sqrt(((CurX - CenterX) * (CurX - CenterX)) + ((CurY - CenterY) * (CurY - CenterY))).ToString + "," + Sqrt(((CurX) * (CurX)) + ((CurY) * (CurY))).ToString)

      'Draw a line from 0,0 to the calculated point
      DrawPoint(0, 0, CurX, CurY)

    Next

This code draws a cicle centered on 0,0 that is 164 pixels long. Since my value for nRadius is 30, what I was expecting is a circle centered on 100,100 that is 30 pixels long. Here's a few of the data points that get generated:

Code:
X Coord         Y Coord         Distance from 100,100    Distance from 0,0
130             100             30                       164.0121947
126.5950684     104.2769805     26.936782                164.0121947
123.0494886     108.4381084     24.5454802               164.0121947
119.3671998     112.4787607     23.03926859              164.0121947
115.5522931     116.3944481     22.59760498              164.0121947
111.6090068     120.1808204     23.28163551              164.0121947
107.541722      123.8336708     24.99842864              164.0121947
103.3549575     127.3489409     27.55395272              164.0121947
99.05336477     130.7227254     30.73730588              164.0121947
94.64172292     133.9512758     34.37150361              164.0121947
90.12493334     137.0310052     38.32508694              164.0121947

Is there some sort of shifting I need to do in the formula to account for the fact that my center is not 0,0?

Thanks,
NCGrimbo
 
Yes, those points were relative to the center at the origin.

[tex] \begin{align*}<br /> F_x &= C_x + (S_x-C_x)\cos(vt/R) - (S_y-C_y)\sin(vt/R) \\<br /> F_y &= C_y + (S_x-C_x)\sin(vt/R) + (S_y-C_y)\cos(vt/R) <br /> \end{align*}[/tex]
 
Peeter said:
Yes, those points were relative to the center at the origin.

[tex] \begin{align*}<br /> F_x &= C_x + (S_x-C_x)\cos(vt/R) - (S_y-C_y)\sin(vt/R) \\<br /> F_y &= C_y + (S_x-C_x)\sin(vt/R) + (S_y-C_y)\cos(vt/R) <br /> \end{align*}[/tex]

That fixed it. Thanks again Peeter!
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
24
Views
4K