Reputation: 541
I have an Array of Points (CGPoints) which form a curve, actually not a real curve but short line-segments. I need a parallel offset of that curve. Just moving the curve down obviously results in thinner segments if the slope is steep. Any ideas on how i could approach this?
Upvotes: 1
Views: 1684
Reputation: 10896
You will need to compute the tangent/normal per segment and then translate the points along the normal.
For a polyline - the normal at a vertex is some combination ((n1 + n2) / 2?) of the two segment normals it straddles, so you may need to take that into account during your "offset" curve computation.
Actually - all you need is the Normal - as indicated here.
Hope this helps.
Upvotes: 1