主要内容

local2globalcoord

Convert local to global coordinates

描述

格库罗德= local2globalcoord(lclCoord)转换本地矩形坐标lclCoordto the global rectangular coordinates格库罗德

example

格库罗德= local2globalcoord(lclCoord,选项)converts local coordinates to global coordinates using the coordinate transformation type选项

example

格库罗德= local2globalcoord(___,Imamiorigin)指定本地坐标系的起源Imamiorigin。使用此语法与先前语法中的任何输入参数。

example

格库罗德= local2globalcoord(___,localAxes)specifies the axes of the local coordinate systemlocalAxes。使用此语法与先前语法中的任何输入参数。

例子

全部收缩

Convert local rectangular coordinates to global rectangular coordinates. The local coordinate origin is (1, 1, 1)

globalcoord = local2globalcoord([0;1;0],"rr",[1;1;1])
globalcoord =3×11 2 1

Convert local spherical coordinates to global rectangular coordinates.

globalcoord = local2globalcoord([30;45;4],"sr")
globalcoord =3×12.4495 1.4142 2.8284

Convert two vectors from global to local coordinates using theglobal2localcoord函数。然后将它们转换为back from local to global coordinates using thelocal2globalcoord函数。

Start with two vectors in global coordinates, (0, 1, 0) and (1, 1, 1). The local coordinate origins are (1, 5, 2) and (-4, 5, 7), respectively.

格库罗德= [0 1;1 1;0 1]
格库罗德=3×20 1 1 1 0 1
lclOrig = [1 -4;5 5;2 7];

Construct two rotation matrices using the rotation functions.

lclAxes(:,:,1) = rotz(45)*roty(-15); lclAxes(:,:,2) = roty(45)*rotx(35);

将来自全局坐标的向量转换为本地坐标。

lclCoord = global2localcoord(gCoord,"rr",lclOrig,lclAxes)
lclCoord =3×2-3.9327 7.7782 -2.1213 -3.6822 -1.0168 1.7151

Convert the vectors from local coordinates back to global coordinates.

gcoord1 = local2globalcoord(lclcoord,"rr",lclOrig,lclAxes)
Gcoord1 =3×2-0.0000 1.0000 1.0000 1.0000 1.0000 0 1.0000

Input Arguments

全部收缩

矩形或球形坐标形式的本地坐标,指定为3-by-N矩阵。Each column represents one set of local coordinates.

如果坐标以矩形形式,则每列包含(x,y,z) components. Units are in meters.

If the coordinates are in spherical form, each column contains (az,el,r) components.az是个方位角in degrees,el是个仰角以度为程度,r是米的半径。

Data Types:双倍的

坐标变换类型, specified as a string scalar or character vector. Specify one of the following values.

价值 转型
"rr"要么'rr' Local rectangular to global rectangular
"rs"要么'rs' 局部矩形到全球球形
"sr"要么'sr' 局部球形到全球矩形
"ss"要么'ss' 局部球形到全球球形

Data Types:string|char

本地坐标系的起源,指定为3-by-Nmatrix containing the rectangular coordinates of the local coordinate system origin with respect to the global coordinate system.Nmust match the number of columns of格库罗德。每列代表一个单独的原点。或者,您可以指定Imamiorigin作为3×1载体。如果你这样做,Imamioriginexpands to a 3-by-N具有相同列的矩阵。

Data Types:双倍的

Axes of the local coordinate system, specified as a 3-by-3-by-N大批。每个页面都包含一个3×3矩阵,表示不同的本地坐标系的轴。3×3矩阵的列指定了本地x,y, 和z矩形形式的轴相对于全局坐标系。或者,您可以指定localAxesas a single 3-by-3 matrix. If you do so,localAxesexpands to a 3-by-3-by-N数组具有相同的3×3矩阵。默认值是标识矩阵。

Data Types:双倍的

Output Arguments

全部收缩

Global coordinates in rectangular or spherical coordinate form, returned as a 3-by-N矩阵。尺寸格库罗德match the dimensions oflclCoord。这要么igin of the global coordinate system is assumed to be (0, 0, 0). The global system axes are the standard unit basis vectors in three-dimensional space, (1, 0, 0), (0, 1, 0), and (0, 0, 1).

Data Types:双倍的

More About

全部收缩

方位角和高度角度

方位角of a vector is the angle between thex-axis and the orthogonal projection of the vector onto thexy-飞机。这angle is positive from thex- 对这件事的兴趣y-轴。方位角在-180和180度之间。这仰角是个angle between the vector and its orthogonal projection onto thexy-飞机。角度为正向正向z-axis from thexy-飞机。缺省情况下,元素或数组的阻止方向与正面对齐x-轴。触控方向是元件或阵列的主叶的方向。

Note

仰角有时被定义为矢量使得阳性的角度z-轴。matlab.®相控阵系统工具箱™products do not use this definition.

This figure illustrates the azimuth and elevation angles of a direction vector.

参考

[1] Foley,J. D.,A.Van Dam,S.K.Feiner和J. F. Hughes。Computer Graphics: Principles and Practice in C, 2nd Ed. Reading, MA: Addison-Wesley, 1995.

Extended Capabilities

Version History

在R2011A介绍