**Information:**For more information on how to draw a Polyline in the rayCloud: How to draw a Polyline in the rayCloud.

This article explains how the projected 3D length and terrain 3D length of polylines are calculated in PIX4Dmapper.

## Projected 2D length

The *Projected 2D Length* is the length of a polyline, only taking into account the (X, Y) coordinates of the vertices and omitting the Z coordinate.

*The Projected 2D Length* is the sum of the 2D length of each segment of the polyline (a segment being defined as the line between two consecutive vertices)

Consider two consecutive vertices V_{1} and V 2 with coordinates (X_{1}, Y_{1}, Z_{1}) and (X_{2}, Y_{2}, Z_{2}). The 2D length of this segment is given by:

√ ΔX2 + ΔY2

Where:

ΔX = Χ_{2} − Χ_{1}ΔY = Υ_{2 −} Υ_{1}

The *Projected 2D Length* of the *Polyline* is calculated by adding the 2D length of the segments:

L_{p} = L_{1} + L_{2} + L_{3} + ... + L_{v}

Where:

L_{p} = The *Projected 2D Length* of the polyline.

L_{1}, ..., L_{v }= The 2D length of the segments.

## Terrain 3D length

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} are (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

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 with 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's 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*: What is the Theoretical Error S(X,Y,Z) of a computed 3D point?.

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(Sx_{j}, Sy_{j}, Sz_{j}))

Where:

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