Skip to content

Chain multiple polylines.

Jaswant Panchumarti requested to merge (removed):ChainMultiplePolylines into master

Bug: vtkStripper is unable to chain 2 or more polylines that are contiguous.

To reproduce:

  1. Explore state file attached in this post.

Fix:

Maintain a dictionary; given an endpoint, all incident/outgoing polyline ids can be found. Traverse such a graph following these steps:

currentChain: a polyline (list of verts) that is currently being accumulated.

chaining = currentChain.size()
if not chaining:
  start a new chain
traverse currentChain until it's end. (flip traversal if needed)
if other routes exist, set hints to the next chain and continue..
if all nodes have not yet been visited, capture currentChain, reset its verts and continue..
else break

Apart from the existing test case, an additional unit-test was introduced to ensure multiple polylines can be chained if they're contiguous.

@will.schroeder , @yohann.bearzi

Merge request reports