Skip to main content
Tweeted twitter.com/StackSoftEng/status/1014929363719081990
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

My input are two polylines -- I had one polyline and I computed offset of it, similarly to polygons. Here is the useful post: http://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygonshttps://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygons

So I have to correct polylines, however the number of vertices (and segments) can vary, consider such polyline:

A\    /D
  \__/
  B  C

After offsetting it up ("inside") I could get

A'\  /C'
   \/
   B'

The horizontal segment is gone.

My task is to add in source or target polyline empty segments (i.e. duplicate vertices) in such way that the number of vertices is the same, and that I could iterate over one polyline and can get its counterpart in the other polyline just by index (no computation during "get").

In the case above I should get two polylines -- A, B, C, D (no change here) and A', B', B', C' (B' is duplicated).

I hope my question is clear. Now -- how to add "missing" vertices?

My input are two polylines -- I had one polyline and I computed offset of it, similarly to polygons. Here is the useful post: http://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygons

So I have to correct polylines, however the number of vertices (and segments) can vary, consider such polyline:

A\    /D
  \__/
  B  C

After offsetting it up ("inside") I could get

A'\  /C'
   \/
   B'

The horizontal segment is gone.

My task is to add in source or target polyline empty segments (i.e. duplicate vertices) in such way that the number of vertices is the same, and that I could iterate over one polyline and can get its counterpart in the other polyline just by index (no computation during "get").

In the case above I should get two polylines -- A, B, C, D (no change here) and A', B', B', C' (B' is duplicated).

I hope my question is clear. Now -- how to add "missing" vertices?

My input are two polylines -- I had one polyline and I computed offset of it, similarly to polygons. Here is the useful post: https://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygons

So I have to correct polylines, however the number of vertices (and segments) can vary, consider such polyline:

A\    /D
  \__/
  B  C

After offsetting it up ("inside") I could get

A'\  /C'
   \/
   B'

The horizontal segment is gone.

My task is to add in source or target polyline empty segments (i.e. duplicate vertices) in such way that the number of vertices is the same, and that I could iterate over one polyline and can get its counterpart in the other polyline just by index (no computation during "get").

In the case above I should get two polylines -- A, B, C, D (no change here) and A', B', B', C' (B' is duplicated).

I hope my question is clear. Now -- how to add "missing" vertices?

Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
added 1 character in body
Source Link
greenoldman
  • 1.5k
  • 1
  • 14
  • 27

My input are two polylines -- I had one polyline and I computed offset of it, similarly to polygons. Here is the useful post: http://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygons

So I have to correct polylines, however the number of vertices (and segments) can vary, consider such polyline:

A\    /D
  \__/
  B  C

After inward offsetting it up ("inside") I could get

A'\  /C'
   \/
   B'

The horizontal segment is gone.

My task is to add in source or target polyline empty segments (i.e. duplicate vertices) in such way that the number of vertices is the same, and that I could iterate over one polyline and can get its counterpart in the other polyline just by index (no computation during "get").

In the case above I should get two polylines -- A, B, C, D (no change here) and A', B', B', C' (B' is duplicated).

I hope my question is clear. Now -- how to add "missing" vertices?

My input are two polylines -- I had one polyline and I computed offset of it, similarly to polygons. Here is the useful post: http://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygons

So I have to correct polylines, however the number of vertices (and segments) can vary, consider such polyline:

A\    /D
  \__/
  B  C

After inward offsetting I could get

A'\  /C'
   \/
   B'

The horizontal segment is gone.

My task is to add in source or target polyline empty segments (i.e. duplicate vertices) in such way that the number of vertices is the same, and that I could iterate over one polyline and can get its counterpart in the other polyline just by index (no computation during "get").

In the case above I should get two polylines -- A, B, C, D (no change here) and A', B', B', C' (B' is duplicated).

I hope my question is clear. Now -- how to add "missing" vertices?

My input are two polylines -- I had one polyline and I computed offset of it, similarly to polygons. Here is the useful post: http://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygons

So I have to correct polylines, however the number of vertices (and segments) can vary, consider such polyline:

A\    /D
  \__/
  B  C

After offsetting it up ("inside") I could get

A'\  /C'
   \/
   B'

The horizontal segment is gone.

My task is to add in source or target polyline empty segments (i.e. duplicate vertices) in such way that the number of vertices is the same, and that I could iterate over one polyline and can get its counterpart in the other polyline just by index (no computation during "get").

In the case above I should get two polylines -- A, B, C, D (no change here) and A', B', B', C' (B' is duplicated).

I hope my question is clear. Now -- how to add "missing" vertices?

Source Link
greenoldman
  • 1.5k
  • 1
  • 14
  • 27

How to synchronize segments in polylines?

My input are two polylines -- I had one polyline and I computed offset of it, similarly to polygons. Here is the useful post: http://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygons

So I have to correct polylines, however the number of vertices (and segments) can vary, consider such polyline:

A\    /D
  \__/
  B  C

After inward offsetting I could get

A'\  /C'
   \/
   B'

The horizontal segment is gone.

My task is to add in source or target polyline empty segments (i.e. duplicate vertices) in such way that the number of vertices is the same, and that I could iterate over one polyline and can get its counterpart in the other polyline just by index (no computation during "get").

In the case above I should get two polylines -- A, B, C, D (no change here) and A', B', B', C' (B' is duplicated).

I hope my question is clear. Now -- how to add "missing" vertices?