| 
01-12-2008, 07:21 PM
| | Junior Member | | Join Date: Jan 2008
Posts: 6
Country: Thanks: 0
Thanked 0 Times in 0 Posts
| | Position of an observer of a square Hi all,
during some hobby research I encountered a geometrical problem I can't solve for my knowledge. I hope you can give me some help:
I have a square which I know the edge length (1); then I have a point, outside of it, and segments that connect it to each square's vertex. I know the angles between each segment and the next.
I need to know the length of at least two segments, and/or the coordinates of the observer if we place all them in a Cartesian plane.
This is needed for me for a sort of "perspective identification": i need to know the observer's orientation (yaw/pitch/roll) and distance w.r.t. to the reference square. Only when the above problem is solved, I think I can easily adapt it into 3D. But if you have good solution for this "bigger" problem too, feel free to inform me
Many many many thanks!!! and greetings from Italy!
Enrico | 
01-12-2008, 10:10 PM
|  | Flow Master | | Join Date: Dec 2007 Location: Zeitgeist
Posts: 6,069
Country: Thanks: 957
Thanked 2,345 Times in 2,119 Posts
| | Quote:
Originally Posted by ris8_allo_zen0 Hi all,
during some hobby research I encountered a geometrical problem I can't solve for my knowledge. I hope you can give me some help:
I have a square which I know the edge length (1); then I have a point, outside of it, and segments that connect it to each square's vertex. I know the angles between each segment and the next.
I need to know the length of at least two segments, and/or the coordinates of the observer if we place all them in a Cartesian plane.
This is needed for me for a sort of "perspective identification": i need to know the observer's orientation (yaw/pitch/roll) and distance w.r.t. to the reference square. Only when the above problem is solved, I think I can easily adapt it into 3D. But if you have good solution for this "bigger" problem too, feel free to inform me
Many many many thanks!!! and greetings from Italy!
Enrico | Do you know the coordinates of the point outside of the square?
__________________ There are two things you should never try to prove ...... the impossible and the obvious. Lack of planning on your part does not constitute an emergency on my part. Pressure makes diamonds. | 
01-12-2008, 10:24 PM
|  | Flow Master | | Join Date: Dec 2007 Location: Zeitgeist
Posts: 6,069
Country: Thanks: 957
Thanked 2,345 Times in 2,119 Posts
| | Quote:
Originally Posted by ris8_allo_zen0 Hi all,
during some hobby research I encountered a geometrical problem I can't solve for my knowledge. I hope you can give me some help:
I have a square which I know the edge length (1); then I have a point, outside of it, and segments that connect it to each square's vertex. I know the angles between each segment and the next.
I need to know the length of at least two segments, and/or the coordinates of the observer if we place all them in a Cartesian plane.
This is needed for me for a sort of "perspective identification": i need to know the observer's orientation (yaw/pitch/roll) and distance w.r.t. to the reference square. Only when the above problem is solved, I think I can easily adapt it into 3D. But if you have good solution for this "bigger" problem too, feel free to inform me
Many many many thanks!!! and greetings from Italy!
Enrico | If you don't know the coordinates of the point outside of the square, then one solution is to draw the four different triangles formed by two segments and a side of the square. In each triangle you know the length of a side (edge length of square = 1) and the angle between the two unknown sides (the angle between two segments). You can then use the cosine rule to write down four equations, each equation will have the length of two segments in it.
Four equations (cosine rule applied to each triangle) and four unknowns (four segments). Solve simultaneously.
__________________ There are two things you should never try to prove ...... the impossible and the obvious. Lack of planning on your part does not constitute an emergency on my part. Pressure makes diamonds. | 
01-13-2008, 04:18 AM
| | Junior Member | | Join Date: Jan 2008
Posts: 6
Country: Thanks: 0
Thanked 0 Times in 0 Posts
| | Quote:
Originally Posted by mr fantastic If you don't know the coordinates of the point outside of the square, then one solution is to draw the four different triangles formed by two segments and a side of the square. In each triangle you know the length of a side (edge length of square = 1) and the angle between the two unknown sides (the angle between two segments). You can then use the cosine rule to write down four equations, each equation will have the length of two segments in it.
Four equations (cosine rule applied to each triangle) and four unknowns (four segments). Solve simultaneously. | Thank you for the help. Do you think the same would be done with a "half-square" triangle? (e.g. two edges and the diagonal, and just three unknown segments)
Enrico | 
01-13-2008, 05:39 AM
|  | Flow Master | | Join Date: Dec 2007 Location: Zeitgeist
Posts: 6,069
Country: Thanks: 957
Thanked 2,345 Times in 2,119 Posts
| | Quote:
Originally Posted by ris8_allo_zen0 Thank you for the help. Do you think the same would be done with a "half-square" triangle? (e.g. two edges and the diagonal, and just three unknown segments)
Enrico | Yes. But first use Pythagoras' Theorem on the triangle to get its hypotenuse. Now lengths of all sides of the triangle are known and you can use the method previously outlined.
__________________ There are two things you should never try to prove ...... the impossible and the obvious. Lack of planning on your part does not constitute an emergency on my part. Pressure makes diamonds. | 
01-13-2008, 08:32 AM
| | Junior Member | | Join Date: Jan 2008
Posts: 6
Country: Thanks: 0
Thanked 0 Times in 0 Posts
| | So I have a system of three quadratic equations. Let's say c1, c2, c3 are the cosines of my known angles, and x,y,z the unknown length of segments.
It looks like this:
x^2+y^2+2*x*y*c1=1
z^2+y^2+2*z*y*c2=1
x^2+z^2+2*x*z*c3=2
Is that right? If so, the problem is now how to solve systems of quadratic equations. Which is the best method? I tried with substitution but I get square roots into square roots so I don't think it's the right way. The other methods I know are valid only for linear systems, not quadratic... any clue?
Thanks again! | 
01-13-2008, 01:47 PM
|  | Flow Master | | Join Date: Dec 2007 Location: Zeitgeist
Posts: 6,069
Country: Thanks: 957
Thanked 2,345 Times in 2,119 Posts
| | Quote:
Originally Posted by ris8_allo_zen0 So I have a system of three quadratic equations. Let's say c1, c2, c3 are the cosines of my known angles, and x,y,z the unknown length of segments.
It looks like this:
x^2+y^2+2*x*y*c1=1
z^2+y^2+2*z*y*c2=1
x^2+z^2+2*x*z*c3=2
Is that right? If so, the problem is now how to solve systems of quadratic equations. Which is the best method? I tried with substitution but I get square roots into square roots so I don't think it's the right way. The other methods I know are valid only for linear systems, not quadratic... any clue?
Thanks again! | I haven't checked the equations, but I wasn't expecting thay you'd want exact solutions - approximate solutions using a numerical method are good enough?
__________________ There are two things you should never try to prove ...... the impossible and the obvious. Lack of planning on your part does not constitute an emergency on my part. Pressure makes diamonds. | 
01-13-2008, 02:19 PM
| | Junior Member | | Join Date: Jan 2008
Posts: 6
Country: Thanks: 0
Thanked 0 Times in 0 Posts
| | Quote:
Originally Posted by mr fantastic I haven't checked the equations, but I wasn't expecting thay you'd want exact solutions - approximate solutions using a numerical method are good enough? | I know very little about numerical solving, so I didn't even thought about such a method. An approximate solution is OK for me, but i have some time constraints - the output should be updated at least 50 times at second in a Core 2 processor using Python.
However I'll try to think about a method, it shouldn't be too difficult. Please tell me if there's an already-made solution! | 
01-14-2008, 05:13 AM
| | Junior Member | | Join Date: Jan 2008
Posts: 6
Country: Thanks: 0
Thanked 0 Times in 0 Posts
| | Ok, I think I'm on the right way now.
Let's call  the angle between x and y, and  the one between y and z.
x and z join the "external" corners with the observer, and y joins the one which is farthest from the obs. Thus, y is between the two and is shared between  and  .  and  are the angles opposite to x and z, respectively. Since we're working on a half-square, their sum is  .
These are the calculations to be done, exploting theorems of sines and cosines:
(am I correct until here?)
So the the computer's mission is to find an x value such as the calculated  is near enough to the given  . This can be done in a way I'll investigate soon
Thanks mr fantastic to pointing me to the right direction!!!
Last edited by ris8_allo_zen0; 01-14-2008 at 07:19 AM.
Reason: math latex adjust
| | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -7. The time now is 06:05 AM. | | |