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

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

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.

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)

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?

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?

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!

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