# Geometry triangle problem

This topic is 2464 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Imagine a camera orbiting an spherical object. For a given orbit rotation, I'm trying to find out what the maximum change in the observed image angle of any point on the surface of the spherical object would be. I've reduced the problem to the diagram shown below.

The object is centered at A. B is the original camera location and D is the rotated camera location after orbiting. C is the point on the surface of the object. The original observed angle is ABC = atan( r/d). However, I can't figure out how to calculate Theta2 = angle ADC.

##### Share on other sites
Hi Yahastu,

I would approach this problem by first converting the points into a set of vectors where,

A = (0,0)
B = (-d,0)
C = (0,r)

The dot product is related to the cosine of the angle between two vectors so what I want is to calculate the dot product of the vector AD and CD. That means I need to calculate D. D is a rotation of B about A so multiplying B by the appropriate rotation matrix gives

D = (-d*cos(theta1), d*sin(theta1))

The dot product between AD and CD is,

(C - D).(A - D) = |C - D||A - D| cos(theta2)

Therefore,

theta2 = acos((C - D).(A - D)/(|C - D||A - D|)).

-Josh

##### Share on other sites
Given that you know r and d, and that you can calculate the distance between D and C, you can use the Law of Cosines.

 c^2 = a^2 + b^2 - 2ab*cos(theta) 

In this case, the distance between D and C is a and the distance between A and D is b. The distance between A and C is c. Re-arranging the above equation gets you:

 cos(theta)=(a^2+b^2-c^2)/2ab 

Thus, the angle ADC would be calculated as:

 ADC=acos( ( (AD)^2+(CD)^2-(CA)^2 ) / 2*(AD)*(CD) ) 

##### Share on other sites
Thanks both of you. jjd, your approach of converting into vectors is a good method to keep in mind for the future as well!

I was hoping to rearrange the solution in order to be able to compute the necessary value of Theta1 in order to achieve a given value of Theta2. However that is not possible via these solution methods. Do you think there is a closed form solution for the reverse problem?

##### Share on other sites
Do you know what the positions of the points in the diagram are and can they be used in the calculations or must it be limited to theta1, r, and d?

EDIT: Ok, after looking at the problem, I think I managed to find a single "formula" that will solve everything in pretty much one step, although you should take precaution dealing with various things like diving by zero and the fact that the formula uses fairly inefficient means to calculate the angle (square roots, sin, arccos, etc). Also, do take into consideration that arccos is only defined on a certain interval, that interval being [-1, 1]. If the ratio is outside of that, then you'll run into trouble, although I think the only real cause of that is if the triangle is impossible (which I think may actually happen so do be careful).

So, the end result isn't all that straightforward either. I don't really know how to put it in fancy image form, so I'll have to convey it via good ol' textual means:

theta2 = arccos( (d - r*sin(theta1))/sqrt(r^2 + d^2 - 2*a*d*sin(theta1)) )

Also, I have not tested this on anything. I wrote a proof to make sure I wasn't doing something wrong and it all seems to be OK. Again, I don't know how to make fancy diagrams so relied on caveman technology. Here is the writing:

http://img525.imageshack.us/img525/1002/lawofcosineproof.jpg

I apologize for the handwriting

##### Share on other sites
Well, if you know the value of Theta2, as well as the lengths of the AD and AC line segments, you can easily calculate the value of DAC, then subtract that from 90 degrees to get Theta1. Just re-arrange the Law of Cosines to get what you need.

##### Share on other sites
EDIT: nvm, that was the answer to the "reverse problem." I seem to have missed that.

1. 1
2. 2
3. 3
Rutin
21
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 10
• ### Forum Statistics

• Total Topics
633653
• Total Posts
3013149
×