How Can I Find the Coordinates of Rotated Points on a Stick?

AI Thread Summary
To find the coordinates of points rotated around a center point, use the angle of rotation and the distance from the origin. The new coordinates can be calculated using the cosine and sine of the angle multiplied by the distance, added to the original coordinates. The discussion emphasizes avoiding complex calculations like arctangent and square roots for efficiency, especially in game development. Instead, focus on vector components, where the horizontal and vertical components of the vectors can be combined to determine the new positions. This approach streamlines the process of calculating rotated points on a stick.
vonWolfehaus
Messages
3
Reaction score
0

Homework Statement


I need to find the x,y coordinates of the points that neighbor a center point that has been rotated around yet another point. An illustration is best:
http://coldconstructs.com/random/point_prob.png
Given: point of origin, angle, p1, p2
Needed: p1 a, b, c etc, p2 a, b, c, etc

Homework Equations


for p1/p2 I just do:
ax = cosine(angle)
ay = sine(angle)
new x = ax * distance from origin + origin x
new y = ay * distance from origin + origin y

The Attempt at a Solution


I thought I just add/subtract an amount somehow, somewhere? Tried, couldn't find the right stuff.
 
Physics news on Phys.org
Think in vectors. See attachment. The position vector of a point is

\vec r=\vec u+\vec v

ehild
 

Attachments

  • rotation.JPG
    rotation.JPG
    5.2 KB · Views: 386
Sorry, but I'm not a student so I don't remember what those lines above the letters mean :( You're talking to a philosophy degree turned web/game developer.

It looks like you're referring to the Pythagorean theorem, which doesn't work very well for this situation. I need to get to the new coordinates as cheaply (fast for the computer to crunch) as possible (I'm working on a game). Using angles and distances like that means a lot of unnecessary arctangent and square root operations, which are expensive.

Can't I just add/subtract some values and use the cos/sin I already have to determine the new coordinates?

I could add/subtract 90 degrees from the angle I have and do another sin/cos + distance but that seems like a waste. There has to be a cheaper way to do it...
 
Those letters mean vectors, which are given by their vertical and horizontal components. When you add two vectors, these components add up.
If the length of the vector u is u, (this is the distance of the midpoint of the stick on which your points sit) its horizontal component is u*cosθ, the vertical component is u*sinθ. If v is the position of a dot on the stick, the components of the v vector are
-vsinθ and vcosθ. You can assign a v value to each of your points. The position of a selected point is the vector r,sum of u and v, you get its components by adding up those of u and v:

The horizontal component is ucosθ-vsinθ, the vertical one is usinθ+vcosθ.

ehild
 
Thread 'Variable mass system : water sprayed into a moving container'
Starting with the mass considerations #m(t)# is mass of water #M_{c}# mass of container and #M(t)# mass of total system $$M(t) = M_{C} + m(t)$$ $$\Rightarrow \frac{dM(t)}{dt} = \frac{dm(t)}{dt}$$ $$P_i = Mv + u \, dm$$ $$P_f = (M + dm)(v + dv)$$ $$\Delta P = M \, dv + (v - u) \, dm$$ $$F = \frac{dP}{dt} = M \frac{dv}{dt} + (v - u) \frac{dm}{dt}$$ $$F = u \frac{dm}{dt} = \rho A u^2$$ from conservation of momentum , the cannon recoils with the same force which it applies. $$\quad \frac{dm}{dt}...
Back
Top