1 Star 0 Fork 1

biiigbao/myOpenFOAMscripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
xy.m 1.08 KB
一键复制 编辑 原始数据 按行查看 历史
%if ~exist('filename')
% indextypes = {'png','jpg','gif'};
% [filename, pathname, filterindex] = uigetfile( ...
% {'*.png';'*.jpg';'*.gif'},'Pick a file');
%end
filename = 'Martinez_Figure_21a.png';
pathname = '/home/hanan/MartinezBump2D';
c=imread([pathname '/' filename]);
fig=image(c);
colormap('bone');
%the next values should be input for the specific chart
% use the new opened sketch to decide what they should be
minX=input('minX: ');
maxX=input('maxX: ');
minY=input('minY: ');
maxY=input('maxY: ');
[x,y]=ginput;
%first point: min x
%second point: max x
%third point: min y
%fourth point: max y
% next points - the graph itself.
TetaX=atan2((y(2)-y(1)),(x(2)-x(1)));
CosX=cos(TetaX);
SinX=sin(TetaX);
SinTeta=SinX;
CosTeta=CosX;
%teta=0.5*(tetaX+tetaY);
%teta=tetaX;
for (i=1:length(x))
xOut(i)=x(i)*CosTeta-y(i)*SinTeta;
yOut(i)=x(i)*SinTeta+y(i)*CosTeta;
end
for (i=5:length(x))
xOut(i)=(xOut(i)-xOut(1))/(xOut(2)-xOut(1))*(maxX-minX)+minX;
yOut(i)=(yOut(i)-yOut(3))/(yOut(4)-yOut(3))*(maxY-minY)+minY;
end
format long
save xyTemp xOut yOut
[xOut' yOut']
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/biiigbao/myOpenFOAMscripts.git
[email protected]:biiigbao/myOpenFOAMscripts.git
biiigbao
myOpenFOAMscripts
myOpenFOAMscripts
master

搜索帮助