Search code examples
mathgeometrycomputational-geometry

Calculate Total Length of Given linear Curves ignoring Bends


I want to calculate the total length of the Linear (Straight curves) by Ignoring the bends. Note: Bend angle will be 90 degrees.

enter image description here

I have a solution but need it in an optimal way or any formula will be welcomed.

Current Solution:

  1. Calculate the endpoints of all Linear lines.
  2. Intersects the line and get virtual intersection points.
  3. Then calculate the distance between points with each linear line start and virtual intersection point.
  4. Sum all the lengths.

Solution

  • Don't take it badly, but I fail to see a difficulty.

    L = L1 + 2 R1 + L2 + 2 R2 + L3.
    

    Note that the exact length (not ignoring bends) is

    L = L1 + π/2 R1 + L2 + π/2 R2 + L3.