Skip to main content
Solved

find begin or end of line

  • July 17, 2020
  • 2 replies
  • 551 views

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.

 

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+47
  • Celebrity
  • 2000 replies
  • Best Answer
  • July 17, 2020

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
  • 56 replies
  • July 17, 2020

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.