📄 rotcoord.m,v
字号:
head 3.0;access;symbols;locks; strict;comment @// @;3.0date 2000.06.13.19.18.04; author gilles; state Exp;branches;next ;desc@Release 3@3.0log@*** empty log message ***@text@function [u,v]=rotcoord(x,y,angle,pivx,pivy)%%function [u,v]=rotcoord(x,y,angle,pivx,pivy)%%[u,v]=rotcoord(x,y,angle,pivx,pivy)%[u,v]=rotcoord(x,y,angle)%%this function will rotate coordinate system by a given angle (in degrees) %around a pivot and return values for the point in the new co-ordinate system%%INPUT%x - x coordinate of point in original system or a vector of x coordinates%y - y coordinate corresponding to the same point in the roginal system% y is a vector of points corresponding to x if x is a vector%angle - angle of rotation in degrees%pivx - x coordinate of pivot point (or vector of points, one for each x)%pivy - y coordinate of pivot point (or vector of points, one for each y)%%pivx and pivy are both zero if not specified%%OUTPUT%u - new x coordinate(s) after rotation%v - new y coordinate(s) after rotation%%DSISoft Version 1.0%Customized VSP Processing Software%written by K.S. Beaty July 1998%last modified July 21, 1998w=pi./180;if nargin==3 %set default to rotate around origin pivx=0; pivy=0;end %ifif angle~=0 & angle~=360 u=(x(:)-pivx(:)).*cos(angle.*w)-(y(:)-pivy(:)).*sin(angle.*w)+pivx(:); %rotation of x v=(x(:)-pivx(:)).*sin(angle.*w)+(y(:)-pivy(:)).*cos(angle.*w)+pivy(:); %rotation of yelse %rotation not necessary u=x; v=y;end %if/else@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -