The *Terrain 3D Length* is the length of a polyline, taking into account the three coordinates of its vertices.

To calculate this length, the 3D length of each subline of the polyline is first calculated, by taking into account the coordinates of the vertices defining the subline.

A subline is defined by two vertices V_{i} and V_{j}. The 3D coordinates of vertex V_{i} is (X_{i}, Y_{i}, Z_{i}) and the 3D coordinates of vertex V_{j} is (X_{j}, Y_{j}, Z_{j}). The 3D length L_{i,j} of the subline is given by:

L_{i,j} = sqrt (Lx_{i,j}^{2 }+ Ly_{i,j}^{2} + Lz_{i,j}^{2})

Where:

Lx_{i,j} = Χ_{j} - Χ_{i}

Ly_{i,j} = Υ_{j }- Υ_{i}

Lz_{i,j} = Ζ_{j} - Ζ_{i}

The *Terrain 3D Length* of *a* polyline is calculated by adding the 3D length of each subline:

L_{p} = L_{1,2} + L_{2,3} + L_{i,j} + … + L_{n-1,n}

Where:

n is the number of vertices of the polyline

L_{p }is the *Terrain 3D Length* of the polyline

L_{i,j}_{ }is the 3D length of the subline defined by the two vertices V_{i} and V_{j}

**Error estimation of the Terrain 3D Length**

The error of the *Terrain 3D Length* can only be estimated when all the vertices have been marked on at least two images. A *Manual Tie Point* is associated to each vertex of the polyline. When a *Manual Tie Point* is marked on at least two images, its 3D position is estimated using the current camera external and internal parameters. The estimated 3D point allows to compute the *Theoretical Error* for this *Manual Tie Point*. The *Theoretical Error* of each vertex is used to estimate the error of the *Terrain 3D Length*. For more information about the *Theoretical Error* for a *Manual Tie Point*: 202559139.

The error on the *Terrain 3D Length* is computed by adding the error on each subline:

dL_{p} = dL_{1,2} + dL_{2,3} + dL_{3,4} + … + dL_{n-1,n}

Where:

n is the number of vertices of the polyline

dL_{p }is the error of the *Terrain 3D Length* of the polyline

dL_{i,j} is the error of the subline L_{i,j}

The error on a subline dL_{i,j} is computed as follows:

dL_{i,j} = abs(max(Sx_{i}, Sy_{i}, Sz_{i})) + abs(max(Sxj, Syj, Szj))

Where:

Sx_{i}, Sy_{i}, Sz_{i }are the x,y,z components of the *Theoretical Error* for vertex V_{i}