Function Math Trig Complex Class

RectangularToPolar

"Rectangular Coordinates To Polar" Rectangular to polar conversion. Convert two-dimensional rectangular coordinates to polar measurements (expressed in radians).

Signature (Visual Basic / VBA)

Public Function RectangularToPolar( _
    ByVal vX As Variant _
    ) As Variant

Code Example

    ? RectangularToPolar("2|0")
     2
    ? RectangularToPolar("2|1")
    2.23606797749979|0.463647609000806
    ? RectangularToPolar("2|2")
    2.82842712474619|0.785398163397448
    ? RectangularToPolar("1|2")
    2.23606797749979|1.10714871779409
    ? RectangularToPolar("0|2")
    2|1.5707963267949
    ? RectangularToPolar("-1|2")
    2.23606797749979|2.0344439357957
    ? RectangularToPolar("-2|2")
    2.82842712474619|2.35619449019234

Parameters

Parameter Description
vX Complex number representing rectangular coordinates. The real part represents the X-coordinate and the imaginary part represents the Y-coordinate. Function returns a complex number where the real part represents the length of the vector, and the imaginary part represents the angle (measured in radians). Function returns Null if vX is Null or cannot be fixed up to a real or complex number (as defined by the ComplexStringToReals function). Complex numbers are represented within strings as "R|I" where R is the real part and I is the imaginary part.