开发者

Code coordinates to match compass bearings

Right now in Matlab (0,0) is the origin, 0 degrees / 2pi would be to the right of the cartesian plane and angles are measured counter clockwise with 90 degrees being at the top.

I'm trying to write a simulator where the coordinates would match a compass bearing. 0/360 degrees or 2pi would be at开发者_如何学编程 the top and 90 degrees would be on the right.

Any idea how to code in Matlab or c++? I'd imaging it'd be a matrix flipped about the x axis and rotated 90 degrees but I'm at a total loss.

Phil


You need do nothing more than swap x and y coordinates. This is a reflection in the line x=y. No need to use a matrix or anything. Just swap coordinates before using them. If you really insist on applying a matrix then

[0 1]
[1 0]

swaps x and y.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜