# LGF_CalcDistance_3D (FC / 3.0.1)

Overview

Author: Siemens Digital Industries

## Short description

The function calculates the distance between two points in 3D space.

### Block Interface

| LGF_CalcDistance_3D (FC) |
--- | --- | ---
LReal |  |  | x1 |  | Ret_Val |  |  | LReal
LReal |  |  | y1 |  |  |  |  |
LReal |  |  | z1 |  |  |  |  |
LReal |  |  | x2 |  |  |  |  |
LReal |  |  | y2 |  |  |  |  |
LReal |  |  | z2 |  |  |  |  |

### Input parameter

Identifier | Data type | Description
--- | --- | ---
x1 | LReal | X coordinate point 1
y1 | LReal | Y coordinate point 1
z1 | LReal | Z coordinate point 1
x2 | LReal | X coordinate point 2
y2 | LReal | Y coordinate point 2
z2 | LReal | Z coordinate point 2

### Output parameter

Identifier | Data type | Description
--- | --- | ---
Ret_Val | LReal | Calculated distance between the Points

## Functional description

The block calculates the distance between two points in a Cartesian coordinate system. The distance is calculated with the following formula:

result = \sqrt[2]{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}

Figure: Graphical representation

## Change log

Version & Date | Change description
--- | ---
| 1.0.0 | Siemens Industry Presales Support
| 04.10.2019 | First released version derivate from "CalcDistance_2D" and extended to 3D
| 3.0.0 | Siemens Industry Support
| 23.04.2020 | Set version to V3.0.0, harmonize the version of the whole library
| 3.0.1 | Simatic Systems Support
| 12.11.2020 | Insert documentation