How to reindex a python array to move polyline starting point?
<p>I have a python array defining the points for a polyline P(x,y,z). I need to align the points with points on another polyline - to be precise, the point with index 0 on polyline 1 should be close to the point with index 0 of the second polyline. </p>

<p>Think of a polyline circle. How can I move the "index number" or rather rearrange the points in an array so that the index number of the points moves clockwise or counter clockwise by x points?</p>

<p>Klausb</p>

<p>To shift to left by x points(assuming x is less than the length of array):</p>

<pre><code>newPolyline = polyline[x:] + polyline[:x]
</code></pre>

<p>To shift right:</p>

<pre><code>newPolyline = polyline[len(polyline) - x:] + polyline[:len(polyline) - x]
</code></pre>

python arrays numpy