Home » Source Code » Polygon generation » ConcreteBone2d_Polygon.m

ConcreteBone2d_Polygon.m ( File view )

  • By lp1284298 2013-11-24
  • View(s):70
  • Download(s):2
  • Point(s): 1
			function [Cir]=ConcreteBone2d_Polygon(Cir,Range,Num,Rmin,Rmax,Ne,da_max,da_min)

cum=0;
mn=size(Cir);

while 1
    if cum==Num
        break;
    end
    x=rand(1)*(Range(1,2)-Range(1,1))+Range(1,1);
    y=rand(1)*(Range(2,2)-Range(2,1))+Range(2,1);
    r=rand(1)*(Rmax-Rmin)+Rmin;
    if (x-1.05*r>Range(1,1) & x+1.05*r<Range(1,2)) & (y-1.05*r>Range(2,1) & y+1.05*r<Range(2,2))
        if mn(1)==0  & cum==0
           cum=cum+1;
           Cir(cum,:)=[x y r];
       else
           sum=0;
           for j=1:cum+mn(1)
               D=sqrt((Cir(j,1)-x)^2+(Cir(j,2)-y)^2);
               if D<(Cir(j,3)+r)*1.05
                   break;
               else
                   sum=sum+1;
               end
           end
           if sum==cum+mn(1)
               cum=cum+1;
               Cir(cum+mn(1),:)=[x y r];
           end
       end
   end
end

plot([Range(1,:) Range(1,2) Range(1,1) Range(1,1)],[Range(2,1) Range(2,1) Range(2,2) Range(2,2) Range(2,1)],'-b','linewidth',3);
hold on;
h=fill([Range(1,:) Range(1,2) Range(1,1) Range(1,1)],[Range(2,1) Range(2,1) Range(2,2) Range(2,2) Range(2,1)],'w');
set(h,'linewidth',3);
theta=0:5*pi/180:360*pi/180;
for i=1:Num+mn(1)
    n=round(3+rand(1)*(Ne-3));
    while 1
        ang=rand(1,n)*360;
        dmax=max(ang)-min(ang);
        dmin=360;
        f
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
Ansys-ConcreteBone2d_Polygon.txt1.15 kB23-06-10|23:03
creat0.00 B30%|23-06-10
lspost.cfile401.00 B19-11-13|10:36
lspost.msg0.00 B19-11-13|10:36
parameters.txt165.00 B23-06-10|22:48
ansys0.00 B19-11-13|10:36
ConcreteBone2d_Polygon.m1.98 kB06-07-10|22:55
matlab0.00 B14-11-13|08:38
任意多边形0.00 B14-11-13|08:38
...
Sponsored links

ConcreteBone2d_Polygon.m (2.91 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D