Jump to content
  • Advertisement
Sign in to follow this  
gondar

Locating points on rays given distance bw them

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have three rays defined by an origin point O and three direction vectors Va, Vb, Vc. There are three points A, B and C, each one is located somewhere on a separate ray. I know distance between points A, B and C and I have to find exact position of points A, B and C. |Va| = |Vb| = |Vc| = 1 T1 = |OA| T2 = |OB| T3 = |OC| I'm unable to find a solution thus far. [Edited by - gondar on September 13, 2009 7:41:50 AM]

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by szecs
Yes, the problem is over or under constrained.
If the rays are given too, then it's over, if not, under.
It can be solved, if two rays, and the three sides are given.
Or 3 rays, and two sides -> so 5 params need to be given.

If 3 rays and 3 sides, the problem is solvable only in special cases, in general cases, no, because 5 params will define the geometry perfectly, and in general, the 6th will be in conflict with the others.


The variables marked as blue are given:
1. Distance between points A, B, C is known
2. Origin point O for the rays is known
3. Direction vectors for rays are known

If problem is either over or under constrained, can you prove it?

Share this post


Link to post
Share on other sites
If I have understood correctly its not too hard. Lets take triangle OAB. We know all inner angles and |AB|. We know the angles becase we know vectors, so we just need to take dot product to obtain angles. Than just take sine law and calculate remaining distances |OA| and |OB|. Than make your vectors unit vectors and multiply them with distances |OA| and |OB| to obtain points A and B.
For point C calculate the point between A and B, lets call it D. Since you also know all the angles in triangle ABC and all the distances its easy to find point C. Now just add point C to D and u have real C.

Share this post


Link to post
Share on other sites
I hope it makes sense without a drawing:

'a','b','c' is the angle at A,B,C points
'x' is the angle of O-B-A, 'y': O-A-B (middle is the "corner").
't' is angle between Va-Vb rays.

equations:

(180-(180-b-x)-x) + (180-(180-a-y)-y) + c =180
t+x+y=180

solve this, and you'll have 'x' and 'y', so you are able to calculate all angles in the geometry.
Then let O-A length be 1, calculate one side, it will be for example 'G1_mod'.
You have to scale with G1_mod/G1, and you got the real O-A distance.

Finding an easier solution, well, I'm not capable of that.

Some help to draw it: draw a line that goes through C and parallel to A-B.
EDIT2: (180-b-x) is the angle between B-C and Vb, (180-a-y) between A-C and Va.

This works only for the situation, you have drawn (Va,Vb,Vc in this order, and C is outside the O-A-B triangle).

EDIT: findig a general solution is f. hard, maybe easier to simply handle all the possible situations.
BTW, there are 2 solutions to the problem (C is inside or outside)



EDITX: Sorry doesn't work,
(180-(180-b-x)-x) + (180-(180-a-y)-y) + c =180 becomes a+b+c=180, so no extra info, (was a nice try anyway...)
SORRY!

[Edited by - szecs on September 13, 2009 7:50:04 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by ryt
If I have understood correctly its not too hard. Lets take triangle OAB. We know all inner angles and |AB|. We know the angles becase we know vectors, so we just need to take dot product to obtain angles. Than just take sine law and calculate remaining distances |OA| and |OB|. Than make your vectors unit vectors and multiply them with distances |OA| and |OB| to obtain points A and B.
For point C calculate the point between A and B, lets call it D. Since you also know all the angles in triangle ABC and all the distances its easy to find point C. Now just add point C to D and u have real C.


Triangle OAB is not necessarily a right-angled one.

While we clearly can find angle <AOB, since we know normalized OA and OB vectors (the ray direction vectors Va, Vb), it doesnt seem apparent that we know all the inner angles of OAB and thus we can't use the law of sines here.

Please elaborate.

Share this post


Link to post
Share on other sites
Quote:
Original post by szecs
I hope it makes sense without a drawing:

'a','b','c' is the angle at A,B,C points
'x' is the angle of O-B-A, 'y': O-A-B (middle is the "corner").
't' is angle between Va-Vb rays.

equations:

(180-(180-b-x)-x) + (180-(180-a-y)-y) + c =180
t+x+y=180

solve this, and you'll have 'x' and 'y', so you are able to calculate all angles in the geometry.
Then let O-A length be 1, calculate one side, it will be for example 'G1_mod'.
You have to scale with G1_mod/G1, and you got the real O-A distance.

Finding an easier solution, well, I'm not capable of that.

Some help to draw it: draw a line that goes through C and parallel to A-B.
EDIT2: (180-b-x) is the angle between B-C and Vb, (180-a-y) between A-C and Va.

This works only for the situation, you have drawn (Va,Vb,Vc in this order, and C is outside the O-A-B triangle).

EDIT: findig a general solution is f. hard, maybe easier to simply handle all the possible situations.
BTW, there are 2 solutions to the problem (C is inside or outside)


What do you mean by angle a, b, c? Do you mean <CAB <ABC <ACB?

Alright, we can indeed find angles <CAB <ABC <ACB by using law of cosines.

But that's when i lose the thread.

You're in effect saying that 180 - <ABC - <OBA = <OBC? Or in other words <ABC + <OBA + <OBC = 180? Is that correct? It doesn't seem right to me though. Please elaborate.

----
It's true that there are two correct solutions, but in this case we can easily assume that T1 > 0, T2 > 0, T3 > 0.

Share this post


Link to post
Share on other sites
Last idea: if you don't have to calculate it precisely, or in real time, you could use iteration:
Assume the C point, then shoot 2 rays from it (their angle should be 'c', the angle in the C point in the triangle), then calculate the A'-C' and B'-C' sides of the triangle, if their ratios A'C'/B'C' differ from the ratios of the given triangle AC/BC, you have to shoot another rays and repeat the procedure again and again, until the difference reaches a small, acceptable value.
For example, if AB'/BC' greater than the given AC/BC, you have to rotate the rays (from C) clockwise, if less, counterclockwise, if equal, than quit the iteration.

You have to rotate the rays with a decreasing absolute value in the new iteration steps, to avoid infinite loops. Meaning new angle of rays=old angle of rays + increment or decrement value

This way, you will have all the angles in the geometry.

To get O-A distance, let O-A' be 1 long. Calculate A'C', then the real O-A = AC/A'C'.
The same for the other distances.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!