CartesianToPolar (FB)ΒΆ

FUNCTION_BLOCK CartesianToPolar

This function block will change the Cartesian coordinates of the two dimensional space \((x,y) \in \mathbb{R^{2}}\), to polar coordinates \((r, \varphi) \in \mathbb{R_{0}^{+}} \times \left( -\pi, \pi\right]\), which are connected via:

\[ \begin{align}\begin{aligned}r=\sqrt{x^{2} + y^{2}}\\\varphi = \arctan\left(y, x\right)\end{aligned}\end{align} \]
InOut:

Scope

Name

Type

Comment

Input

lrX

LREAL

X coordinate \(x\)

lrY

LREAL

Y coordinate \(y\)

Output

lrAngle

LREAL

Angular coordinate \(\varphi\) (azimuth)

lrDistance

LREAL

Radius \(r\)