Section 8. Processing and Math Instructions
8-19
RectPolar (Dest, Source)
Converts from rectangular to polar coordinates.
Parameter
& Data Type
Enter
RectPolar Parameters
Dest
Variable
array
Variable array in which to store the 2 resultant values. The length of the vector is stored in the
specified destination element and the angle, in radians(±
π
), in the next element of the array
Source
Variable
Array
The variable array containing the X and Y coordinates to convert to Polar coordinates. The X
value must be in the specified array element and the Y value in the next element of the array.
Example: In the following example, a counter (Deg) is incremented from 0 to
360 degrees. The cosine and sine of the angle are taken to get X and Y in
rectangular coordinates. RectPolar is then used to convert to polar coordinates.
Dim XY(2),Polar(2),Deg,AnglDeg
Const Pi=4*ATN(1)
Alias XY(1)=X
Alias XY(2)=Y
Alias Polar(1)=Length
Alias Polar(2)=AnglRad
DataTable(RtoP,1,500)
Sample(1,Deg,IEEE4)
Sample(2,XY,IEEE4)
Sample(2,Polar,IEEE4)
Sample(1,AnglDeg,IEEE4)
EndTable
BeginProg
For Deg=0 to 360
XY(1)=Cos(Deg*Pi/180)
‘Cos and Sin operate on radians
XY(2)=Sin(Deg*Pi/180)
RectPolar(Polar,XY)
AnglDeg=Polar(2)*180/Pi
‘Convert angle to degrees for comparison w/Deg
CallTable
RtoP
Next
Deg
EndProg
Содержание CR9000
Страница 6: ...CR9000 Table of Contents iv This is a blank page ...
Страница 22: ...CR9000 Overview OV 16 This is a blank page ...
Страница 26: ...Section 1 Installation 1 4 CR9000 FIGURE 1 1 3 CR9000 Battery Pack ...
Страница 72: ...Section 3 CR9000 Measurement Details 3 28 This is a blank page ...
Страница 88: ...Section 5 Program Declarations 5 6 This is a blank page ...
Страница 217: ...This is a blank page ...