• Advertisement
Sign in to follow this  

line segments having common endpoint

This topic is 1844 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

Hey guys,

 

 I had a question regarding 2 line segments. Say we have 2 line segments whose origin and lengths are given as: (P0, L0) and (P1, L1) respectively. I need to find when can they end at the same point. The line segments lie anywhere in 3D space.

 

One of the approaches I could think about is: Let's say this common end point is T and the points are A and B. So for the line segments with A and B as origins, A,B and T must form a triangle. Length of vector AT = L0 and length of vector BT = L1. But since the orientation of the line segment is not known, there can be a lot of possibilities. Lets say we choose a particular orientation for line segment AT as (i,j,k) - 1st octant. So now we can move anywhere in space  from T but only by a distance L1 to find BT. 

 

This is where I m not sure how to move forward. 

Share this post


Link to post
Share on other sites
Advertisement

If you just want to know whether a solution exists or not, you just have to check the triangle inequalities. Define d = distance(P0, P1). Then there is a solution if and only if d <= L0+L1 and d >= abs(L0-L1).

Share this post


Link to post
Share on other sites

@Alvaro:

Thanks for the d >= abs(L0-L1) info.. I had figured out the L0+L1 part. Both of these would give if a solution exists or not. But I also want to know the configuration of the 2 line segments, as in also the point as well. I want my function to return a list of all such points. Because if I think of a brute force way, I can find atleast 3 points by moving by L0 parallel to  the 3 axes. The other points can be found by breaking L0 into x,y and z components if I am write. So if i have to iterate through a loop, how can I find the range of the loop it does not exactly go on a particular order when finding the point. 

Share this post


Link to post
Share on other sites
There is an infinite number of such points, forming a circle. You won't be able to return a list of them unless you constrain the solution further.

Share this post


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

  • Advertisement