找回密码
 注册
Simdroid-非首页
查看: 301|回复: 4

[原创] 不相交的随机大小的椭圆

[复制链接]
发表于 2007-7-10 16:47:36 | 显示全部楼层 |阅读模式 来自 大连理工大学
此函数产生的椭圆通过调整长径比可以用来模拟纤维混凝土中的纤维,当然也可以模拟类似的其它材料。

function myellipse
% cheng wf 2007 6 11 19:51
close all
clear all
clc
%format compact
depth=60;
a=[3 2 1 0.5];b=[2 1 0.5 0.25];
number=[10 10 100 20];
x0=[];y0=[];xlat=[];ylon=[];
[x0new1,y0new1,xlat1,ylon1]=myellipse_one(depth,a(1),b(1),number(1),x0,y0,xlat,ylon)
x0=x0new1;y0=y0new1;xlat=xlat1;ylon=ylon1;
for i=2:length(a)
    [x0new2,y0new2,xlat2,ylon2]=myellipse_rest(depth,a(i),b(i),number(i),x0,y0,xlat,ylon)
    x0=x0new2;y0=y0new2;xlat=xlat2;ylon=ylon2;
end
%  绘制椭圆图形
[m,n]=size(xlat)
    plot(xlat,ylon)
    axis([0 60 0 60])
%------------------------------
function [x0new,y0new,xlat,ylon]=myellipse_one(depth,a,b,number,x0,y0,xlat,ylon)
xxlen=length(x0);yylen=length(y0);
x0(xxlen+1)=a+(depth-2*a)*rand;
y0(yylen+1)=a+(depth-2*a)*rand;
ecc=axes2ecc(a,b);
[lat1,lon1]=ellipse1(x0(xxlen+1),y0(yylen+1),[a,ecc],rand*180);
xlat=[xlat,lat1];ylon=[ylon,lon1];
for i=2:number
    while 1
    x0(xxlen+i)=a+(depth-2*a)*rand;
    y0(yylen+i)=a+(depth-2*a)*rand;
    [lati,loni]=ellipse1(x0(xxlen+i),y0(yylen+i),[a,ecc],rand*180);
    xlat=[xlat,lati];ylon=[ylon,loni];

    for j=1:xxlen+i-1
        in1=[];in2=[];
        in1=inpolygon(xlat(:,xxlen+i),ylon(:,yylen+i),xlat(:,j),ylon(:,j))
        in2=inpolygon(xlat(:,j),ylon(:,j),xlat(:,xxlen+i),ylon(:,yylen+i))
        if all(in1==0)&&all(in2==0)
            n_j=j;
            if n_j==xxlen+i-1
               N=1
                break
            end
            continue
        else
              N=2;
              xlat(:,xxlen+i)=[];ylon(:,xxlen+i)=[];x0(xxlen+i)=[];y0(yylen+i)=[];
              break
         end
     end
      if N==1
        break
      end
   end
end
x0new=x0;y0new=y0;xlat=xlat;ylon=ylon;
% -----------------------------
function [x0new,y0new,xlat,ylon]=myellipse_rest(depth,a,b,number,x0,y0,xlat,ylon)
xxlen=length(x0);yylen=length(y0);
ecc=axes2ecc(a,b);N=0;
for i=1:number
     while 1
    x0(xxlen+i)=a+(depth-2*a)*rand;
    y0(xxlen+i)=a+(depth-2*a)*rand;
    [lat,lon]=ellipse1(x0(xxlen+i),y0(xxlen+i),[a,ecc],rand*180);
   xlat=[xlat,lat];ylon=[ylon,lon];
    for j=1:xxlen+i-1
        in1=[];in2=[];
        in1=inpolygon(xlat(:,xxlen+i),ylon(:,xxlen+i),xlat(:,j),ylon(:,j));
        in2=inpolygon(xlat(:,j),ylon(:,j),xlat(:,xxlen+i),ylon(:,yylen+i));
        if all(in1==0)&&all(in2==0)
             n_j=j;
             if n_j==xxlen+i-1
                N=1;
                break
            end
           continue
       else
             N=2;
             xlat(:,xxlen+i)=[];ylon(:,xxlen+i)=[];x0(xxlen+i)=[];y0(yylen+i)=[];
              break
       end
    end
       if N==1
       break
       end
  end
end
x0new=x0;y0new=y0;xlat=xlat;ylon=ylon;

备注:本程序里虽然采用椭圆个数作为判据,但是完全可以通过面积率来作为判据,稍加转化即可。当然三维亦可采用体积率作为判据。

参考文献:http://okok.org/cgi-bin/ut/topic_show.cgi?id=127992&h=1&bpg=1&age=30

[ 本帖最后由 chengweifeng 于 2007-7-10 16:49 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×

评分

1

查看全部评分

发表于 2007-7-10 22:06:57 | 显示全部楼层 来自 江苏无锡
Simdroid开发平台
此函数产生的椭圆通过调整长径比可以用来模拟纤维混凝土中的纤维,当然也可以模拟类似的其它材料。

How to simulate ?  Any comments or experience ?
回复 不支持

使用道具 举报

 楼主| 发表于 2007-7-10 22:52:58 | 显示全部楼层 来自 大连理工大学
I just started constructing the computer-generated microstructure of concrete three months ago,now 3-D modeling of concrete aggregates with arbitrary shapes is thinking about. So I am sorry to say that I have no experiences to show you .
But after  the computer-generated modeling is completed,by means of a finite element mesh,a detailed numerical analysis is possible.

[ 本帖最后由 chengweifeng 于 2007-7-10 22:55 编辑 ]
回复 不支持

使用道具 举报

发表于 2007-7-10 23:31:39 | 显示全部楼层 来自 韩国

回复 #3 chengweifeng 的帖子

楼上是哪个学校的,对你的研究很感兴趣。
回复 不支持

使用道具 举报

发表于 2017-7-20 16:58:47 | 显示全部楼层 来自 广东深圳
很不错,学习下!!!!!
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-3-29 13:03 , Processed in 0.040192 second(s), 18 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表