Convert spherical coordinates to Cartesian
Minimum Origin Version Required:9.1 SR0
1. sph2cart format:=virmat iw:=[Book1]Sheet1! omx:=<new>!<new> omy:=<same>!<new> omz:=<same>!<new>;//Convert the virtual matrix data in Book1 Sheet1 and output the three matrix objects for X Y Z to the same matrix sheet.
2. sph2cart ir:=[Book1]Sheet1!(A,B,C)[1:3] unit:=1 oz:=<new>!(<new>,<new>,<new>);//Convert the XYZ worksheet column data and output the resulting XYZ data to a new worksheet as XYZ columns.
3. sph2cart format:=mats ima:=[MBook1]MSheet1!1 ime:=[MBook2]MSheet1!1 imr:=[MBook3]MSheet1!1;//Convert three matrix objects in different matrix books and output three matrix books for converted X, Y and Z data.
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Data Format | format |
Input int |
|
Specify the input data format. The input is presumed to use a spherical coordinate system.
Option list:
|
Input | ir |
Input XYZRange |
|
This variable is only valid when the format variable is set to xyz. It is used to specify the input XYZ data range. |
Azimuth | ima |
Input MatrixObject |
|
This variable is only valid when the format variable is set to mats. It is used to specify the input matrix object for Azimuth data. |
Elevation | ime |
Input MatrixObject |
|
This variable is only valid when the format variable is set to mats. It is used to specify the input matrix object for Elevation data. |
Radius | imr |
Input MatrixObject |
|
This variable is valid when the format variable is set to mat or mats. If the format was mat, this variable specifies the input matrix object. If the format was mats, it then specifies the input matrix object for the Radius data. |
Input | iw |
Input Worksheet |
|
This variable is only valid when the format variable is set to virmat. It is used to specify the worksheet range of the virtual matrix. |
Angle Data | angle |
Input int |
|
This variable is only valid when the format variable is set to virmat or mat. It specifies how the Azimuth and Elevation values are considered to be arranged in the source data.
Option list:
|
Azimuth Values in | alabel |
Input int |
|
This variable is only valid when the angle variable is set to 0(Azimuth Across Columns). It specifies the data source of Azimuth values.
Option list:
|
Elevation Values in | elabel |
Input int |
|
This variable is only valid when the angle variable is set to 1(Elevation Across Columns). It specifies the data source of Elevation values. Option list:
|
Column Label | param |
Input int |
|
This variable is only valid when the alabel or elabel variable is set to second or 1 (Column Label). It specifies the column label row to be used as Azimuth or Elevation data.
Option list:
|
Angular Unit | unit |
Input int |
|
This variable specifies the Azimuth unit for input data.
Option list:
|
X | omx |
Output MatrixObject |
|
This variable is valid when the format variable is NOT set to XYZ. It specifies where to output the converted X value. The converted X value will be the Z value in this output matrix object. |
Y | omy |
Output MatrixObject |
|
This variable is valid when the format variable is NOT set to XYZ. It specifies where to output the converted Y value. The converted Y value will be the Z value in this output matrix object. |
Z | omz |
Output MatrixObject |
|
This variable is valid when the format variable is NOT set to XYZ. It specifies where to output the converted Z value. The converted Z value will be the Z value in this output matrix object. |
Output | oz |
Output XYZRange |
|
This variable is only valid when the format variable is set to XYZ. It specifies the worksheet range to output the converted XYZ data. |
This tool is used to convert data in spherical coordinates to Cartesian coordinates. The input data can be XYZ worksheet columns, a virtual matrix, one matrix object, or three matrix objects with the same dimensions.
You can run the following command in the Script Window or Command Window to bring up the GUI dialog box for this tool:
sph2cart -d;
The spherical coordinates are defined by , in which
is the radius (the distance between the origin and the data point),
is the elevation (the angular displacement of the data point from the XY plane, expressed in Radians) and
is the azimuth (the angular displacement of the data point from the X axis in the positive direction, i.e. X > 0, expressed in Radians). The image below illustrates how each of the three variables is defined:
The source data for azimuth, elevation and radius vary by input data format:
Input Data Format | Azimuth | Elevation | Radius |
---|---|---|---|
XYZ | X column | Y column | Z column |
Virtual Matrix/One Matrix Object | X value of the virtual matrix/matrix object | Y value of the virtual matrix/matrix object | Z value of the virtual matrix/matrix object |
Three Matrix Objects | Z value in the matrix object which is selected for Azimuth | Z value in the matrix object which is selected for Elevation | Z value in the matrix object which is selected for Radius |
Input data are converted from spherical coordinates to Cartesian coordinates, using the following: