# Projected 2D length and terrain 3D length of polylines

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

## 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 the 2D length of each segment of the polyline (a segment being defined as the line between two consecutive vertices)

Consider two consecutive vertices V1 and V2 with coordinates (X1, Y1, Z1) and (X2, Y2, Z2). 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:

Lp = L1 + L2 + L3 + … + Lv

Where:

Lp = The Projected 2D Length of the polyline.
L1, ..., Lv = 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 Vi and Vj. The 3D coordinates of vertex Vi is (Xi, Yi, Zi) and the 3D coordinates of vertex Vj is (Xj, Yj, Zj). The 3D length Li,j of the subline is given by:

Li,j = sqrt (Lxi,j+ Lyi,j2 + Lzi,j2)

Where:

Lxi,j = Χj - Χi
Lyi,j = Υ- Υi
Lzi,j = Ζj - Ζi

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

Lp = L1,2 + L2,3 + Li,j + … + Ln-1,n

Where:

n is the number of vertices of the polyline
Lp is the Terrain 3D Length of the polyline
Li,j is the 3D length of the subline defined by the two vertices Vi and Vj

### 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 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 PointWhat 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:

dLp = dL1,2 + dL2,3 + dL3,4 + … + dLn-1,n

Where:

n is the number of vertices of the polyline
dLis the error of the Terrain 3D Length of the polyline
dLi,j is the error of the subline Li,j

The error on a subline dLi,j is computed as follows:

dLi,j = abs(max(Sxi, Syi, Szi)) + abs(max(Sxj, Syj, Szj))

Where:

Sxi, Syi, Szi are the x,y,z components of the Theoretical Error for vertex Vi