Skip to main content
Solved

Move a point to a fix distance


boubcher
Contributor
Forum|alt.badge.img+11

Hello there

we are a series of building points in each side of the road we need to move all the points to the same distance on each side of the road

Actual Status

point_toRoad_actual 

 

Target

point_toRoad_target 

Best answer by geomancer

Hi @boubcher​ , I was away from work for over a week, so my apologies for this late answer.

In @ebygomm​ 's solution, the offset is calculated from the original vertex, with the positive direction away from the corresponding point on the line.

Fixed_Distance_ebygomm

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

17 replies

tomfriedl
Contributor
Forum|alt.badge.img+13
  • Contributor
  • May 25, 2022

An idea:

  • NeighborFinder
  • VertexCreator (add vertex)
  • LineExtenter with your distance
  • CoordinateExtractor
  • VertexCreator (replace vertex)

ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • May 25, 2022

If you use the NeighborFinder you should then be able to use the attributes that are generated (distance and angle) in an offsetter in polar coordinate mode.

 

image


geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • May 25, 2022

EDIT: VertexCreator is not needed, see comment by ebygomm below.

@ebygomm​ Great idea! Calculating points at a fixed distance from the line then goes like this:

Fixed_DistanceYou may want to check for points that are not projected perpendicularly onto the line.


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • May 25, 2022
geomancer wrote:

EDIT: VertexCreator is not needed, see comment by ebygomm below.

@ebygomm​ Great idea! Calculating points at a fixed distance from the line then goes like this:

Fixed_DistanceYou may want to check for points that are not projected perpendicularly onto the line.

No need for the VertexCreator, you can just offset the existing points

image


geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • May 25, 2022
ebygomm wrote:

No need for the VertexCreator, you can just offset the existing points

image

You are absolutely right, I made it too complicated.


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • May 25, 2022
geomancer wrote:

EDIT: VertexCreator is not needed, see comment by ebygomm below.

@ebygomm​ Great idea! Calculating points at a fixed distance from the line then goes like this:

Fixed_DistanceYou may want to check for points that are not projected perpendicularly onto the line.

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?


geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • May 25, 2022
boubcher wrote:

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

Nope, that was me offsetting the line vertex. ebygomm moves the original point, which results in a simpler workspace.


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • May 25, 2022
boubcher wrote:

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

@geomancer​ 

sorry,

but when using only the offset it's not working since we are deducing the same value for the distance

we need a fixed distance

Please check the attached WS

Thanks

 


geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • May 25, 2022
boubcher wrote:

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

You are mixing my and ebygomm's ideas, with disastrous results.

ebygomm offsets the original point, using _angle. I offset the projected point on the line in the reversed direction, thus using _angle+180 .

 

I should have kept out of this one, as ebygomm's solution was good, and my 'improvements' only lead to confusion.

 


geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • May 25, 2022

Note that the NeighborFinder will not give the perpendicular projected point for points whose perpendicular projection falls outside of the line segment, instead it will find the first (or last) vertex of the line. 

NeighborFinder_vs_Perpendicular


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • May 25, 2022
boubcher wrote:

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

You need to offset by the distance produced by the neighborfinder minus the fixed distance value you want

 

So if your original point was 50 m away you offset by 50-20 (@Value(_distance)-20) which would move the point 30m closer to the line so it ends up being 20m away from the line


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • May 25, 2022
boubcher wrote:

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

@ebygomm​ 

So sorry, I am missing something here the output value for the offset is not the same for each vertex how come they are at the same distance from the line

offset 


geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • May 25, 2022
boubcher wrote:

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

All points get the same distance from the line by calculating @Value(_distance)-20, as @ebygomm​ explained above. You move the point over the calculated distance towards the line (because the direction indicated by _angle is towards the line).

So when _distance is larger than your fixed distance (20 in this example) the point will be moved towards the line, and when _distance is smaller than your fixed distance, the point will be moved away from the line.

 

All credits for this solution should go to ebygomm. I apologize for muddying a perfect solution.


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • May 25, 2022
boubcher wrote:

@ebygomm​ 

That's a brilliant approach, you are offsetting the line vertex not the original point, Great

Why are you adding to the angle 180 ?

@ebygomm​ 

Sorry, I think I am missing something, how come the offset is different in value for each vertex but their  position to the line is the same

offset 

 


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • May 26, 2022
geomancer wrote:

Note that the NeighborFinder will not give the perpendicular projected point for points whose perpendicular projection falls outside of the line segment, instead it will find the first (or last) vertex of the line. 

NeighborFinder_vs_Perpendicular

@geomancer​ 

I totally agree with you, but still I am not getting, how come the offset value is different for each vertex and on the map, they are at the same the same distance from the line , as you can see in the table view

 

 


geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • Best Answer
  • June 7, 2022

Hi @boubcher​ , I was away from work for over a week, so my apologies for this late answer.

In @ebygomm​ 's solution, the offset is calculated from the original vertex, with the positive direction away from the corresponding point on the line.

Fixed_Distance_ebygomm


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • June 7, 2022
geomancer wrote:

Hi @boubcher​ , I was away from work for over a week, so my apologies for this late answer.

In @ebygomm​ 's solution, the offset is calculated from the original vertex, with the positive direction away from the corresponding point on the line.

Fixed_Distance_ebygomm

@geomancer​ 

Thats fine and welcom back

Well you are right ,I don't know how I missed it

Thanks for the illustration


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