Skip to main content
Solved

find begin or end of line


I have a line starting at (A) and ending at (B), consider it's a 50m distance

I may be at either (A) or (B). Using a nieghbourfinder , I know this line is there. How do I know at which end I am.

Please advise. Expect your feedback

 

 

Gosh, my professor always used to say to me, it all depends on which end of the stick you are in :). Now I am still trying to figure it out.

 

 

Best answer by virtualcitymatt

You should be able to extract either the first or last coordinate of the line with a CoordinateExtractor. Use index '0' for the first index and '-1' for the last index.

 

If you know you will always be at either end of the line then you could use the NeighbourFinder on the end points rather than the line.

 

 

View original
Did this help you find an answer to your question?

2 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+35

You should be able to extract either the first or last coordinate of the line with a CoordinateExtractor. Use index '0' for the first index and '-1' for the last index.

 

If you know you will always be at either end of the line then you could use the NeighbourFinder on the end points rather than the line.

 

 


Forum|alt.badge.img+1
  • July 17, 2020
virtualcitymatt wrote:

You should be able to extract either the first or last coordinate of the line with a CoordinateExtractor. Use index '0' for the first index and '-1' for the last index.

 

If you know you will always be at either end of the line then you could use the NeighbourFinder on the end points rather than the line.

 

 

To follow along on this, because the coordinateExtractor is definitely the way to go: Do you know that the coordinate you have ("Where you are") is exactly the same as the endpoint? If so, you could probably avoid using the neighborfinder and get better speed with other, more direct, comparisons. Also, if you're guaranteed to be in either end, you can test for just one and if not -> assume the other. That should also help with the speed.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings