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

Click For Summary

Homework Help Overview

The discussion revolves around finding the x,y coordinates of points that are rotated around a specified origin point. The original poster seeks to determine the new coordinates of points p1 and p2 after rotation, given an angle and the point of origin.

Discussion Character

  • Exploratory, Mathematical reasoning, Assumption checking

Approaches and Questions Raised

  • Participants discuss using trigonometric functions (cosine and sine) to calculate new coordinates based on distance and angle. There is an exploration of vector addition and the components of vectors in relation to the problem.

Discussion Status

Some participants are offering insights into vector representation and the components involved in the calculations. There is an ongoing exploration of the most efficient method to compute the new coordinates without incurring heavy computational costs, particularly in the context of game development.

Contextual Notes

The original poster expresses a need for a computationally efficient solution, indicating a preference for methods that avoid complex operations like arctangent and square roots. There is also a mention of a lack of familiarity with vector notation from one participant.

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

[tex]\vec r=\vec u+\vec v[/tex]

ehild
 

Attachments

  • rotation.JPG
    rotation.JPG
    5.2 KB · Views: 400
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
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 25 ·
Replies
25
Views
4K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K