Determining Orbit Location
Posted 17 December 2009 - 07:31 PM
A bit of a math question here, hopefully someone finds this interesting, or better yet, a possible solution. :)
I've drawn this up on a diagram, but I'll explain it here for further illustration.
I've got a camera that orbits around a point. It has a set radius away from it's orbit point, and an object it 'looks at'.
Here's where things start to get interesting. The object it's looking at can have a target, somewhere else in the world. I'd like to constrain the camera to orbit such that it keeps a set number of degrees between the target and the object it's looking at.
Is there any mathematical way of getting the precise location(s) of the new camera resting point? Ideally one that isn't too computationally expensive, and ideally one I can understand? :)
Here's a diagram where I've tried to illustrate the issues, as well as the knowns and unknowns.
After doing some research, I'm thinking I can solve this using a combination of cosine law and tan law, substituting when necessary, but I'm not entirely confident and it'll take a while to build the equations and plug it in. In the meantime, I'd love to have other people's opinions or ideas.
Posted 17 December 2009 - 10:48 PM
Assuming I've correctly understood your problem, I don't have a full solution, but here's another way of looking at it. You have two constraints (camera's radius from C and the angle between A and . You can thus think of the point you want to find as the intersection of two curves. One curve would be a circle around C of radius cd, i.e. all the points that satisfy the radius constraint. The second curve would be all the points that satisfy the angle constraint. The shape of this second curve isn't obvious; a quick sketch suggests it's kind of like a cardioid, but with two cusps, one each at A and B. But perhaps with a bit of work you can find the equation of this curve, and then algebraically intersect it with the circle.
EDIT: One way to construct the latter curve might be as follows: imagine two lines, one through A and one through B; the absolute angles of the two lines differ by the desired AB angle. Their intersection point is thus one point on the curve we wish to find. As you rotate the two lines around their respective points, in lockstep so that their relative angle remains constant, their intersection point should sweep out that double-cardioid curve.
Posted 17 December 2009 - 10:53 PM
Reebeta, you always amaze me with what you know.
Now, I have to admit that math isn't my strongest suit. Can you offer me some pointers in how I go about discovering the equation of the curve? Tutorials, web links, anything would be appreciated.
Posted 17 December 2009 - 10:58 PM
Posted 18 December 2009 - 06:49 AM
Posted 18 December 2009 - 07:26 AM
The left side shows the construction of the two circles based on A and B, and the desired angle theta_AB. The right shows intersecting that with the camera circle around C to get the two possible solution points. Depending on the relative size and position of the camera circle it's possible to have as many as four solution points.
Posted 18 December 2009 - 07:41 AM
Itll definitely add play value.
Posted 18 December 2009 - 05:00 PM
Awesome, thanks so much for putting that talented cranium to work for me.
That's fascinating - I didn't know of the inscribed angle law. That totally was the keystone for this problem.
In the interests of me not having to ask the same questions at a later date, would you mind if I paraphrase my understanding of this, and hopefully if you could correct me where my assertions are incorrect? It would help me solidify this in my head.
As I understand it, you're building a circle that inscribes an angle of theta_AB and reaches out to two points that are |AB| apart.
You can then find the 'height' from the mid point of the |AB| chord to the inner point of the circle using simple tan = opposite/adjacent, solving for the 'adjacent', and the radius using a similar sin = opposite/hypotenuse, solving for hypotenuse.
Man, writing that down even makes me think of it clearer. I hope I'm not wrong in my paraphrasing, as that sounds more and more correct.
After that, you're right - treating the original orbit as simply a circle that intersects with this larger circle should make solving this solution much simpler. Off the top of my head I don't remember calculating circle intersections, but I remember doing it in junior high, so I can't imagine it'll be too hard to scrape the rust off the noggin.
Thanks again Reed! Please let me know if I've thought of any of this incorrectly.
P.S. If you don't mind, how did you end up drawing such good math diagrams? Mine was just a botched MS Paint job, yours looks much better. :)
Posted 18 December 2009 - 05:34 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users