Section 8. Processing and Math Instructions
8-24
RectPolar (Dest, Source)
Converts from rectangular to polar coordinates.
Parameter
& Data Type
Enter
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
Содержание CR5000
Страница 39: ...Section 1 Installation and Maintenance 1 15 S A N Y O FIGURE 1 11 6 Removal of band clamp and battery ...
Страница 40: ...Section 1 Installation and Maintenance 1 16 This is a blank page ...
Страница 54: ...Section 2 Data Storage and Retrieval 2 14 This is a blank page ...
Страница 88: ...Section 4 CRBasic Native Language Programming 4 12 This is a blank page ...
Страница 94: ...Section 5 Program Declarations 5 6 This is a blank page ...
Страница 172: ...Section 7 Measurement Instructions 7 46 This is a blank page ...
Страница 206: ......
Страница 236: ...Index Index 4 This is a blank page ...
Страница 237: ...This is a blank page ...