Проектування мережі Ethernet, страница 5

for( w=0;w<ds;w++)             //2fl pravo

{  min1=w+ds/2+da+w+da+ds-w+ds-w+6;

if (min1<mini) mini=min1;

}

for( w=0;w<da;w++)             //3fl verh

{  min1=da-w+ds/2+w+ds+w+ds-w+da+12;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<da;w++)             //3fl niz

{  min1=ds+da-w+ds/2+w+w+da-w+12;

if (min1<mini) {mini=min1;fl=1;}

}

for( w=0;w<da;w++)             //3fl levo

{  min1=da+w+abs(ds/2-w)+ds-w+da+ds-w+12;

if (min1<mini) {mini=min1;fl=1;}

}

for( w=0;w<ds;w++)             //3fl pravo

{  min1=w+ds/2+da+w+da+ds-w+ds-w+12;

if (min1<mini) {mini=min1;fl=1;}

}

setcolor(GREEN);

circle(1.4*(a-10),1.4*(s-3),2);

setcolor(WHITE);

rectangle(1.4*(a-11),1.4*(s+1),1.4*(a-9),1.4*(s+3));

}

void hubposition3(void)

{int mini=10000,min1,fl=1;

for( int w=0;w<df;w++)             //1fl verh

{  min1=w+df-w+df/2+dm+df-w+dm/2-w+df+12;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<df;w++)             //1fl niz

{  min1=abs(df/2-w)+dm/2+df-w+dm+df-w+dm+w+12;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dm;w++)             //1fl levo

{  min1=w+df+w+dm/2+df+w+df/2+dm-w+12;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dm;w++)             //1fl pravo

{  min1=w+abs(dm/2-w)+df+w+df/2+dm-w+12;

if (min1<mini) {mini=min1;fl=2;}

}

for(  w=0;w<df;w++)             //2fl verh

{  min1=w+df-w+df/2+dm+df-w+dm/2-w+df+6;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<df;w++)             //2fl niz

{  min1=abs(df/2-w)+dm/2+df-w+dm+df-w+dm+w+6;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dm;w++)             //2fl levo

{  min1=w+df+w+dm/2+df+w+df/2+dm-w+6;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dm;w++)             //2fl pravo

{  min1=w+abs(dm/2-w)+df+w+df/2+dm-w+6;

if (min1<mini) {mini=min1;fl=2;}

}

for(  w=0;w<df;w++)             //3fl verh

{  min1=w+df-w+df/2+dm+df-w+dm/2-w+df+12;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<df;w++)             //3fl niz

{  min1=abs(df/2-w)+dm/2+df-w+dm+df-w+dm+w+12;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dm;w++)             //3fl levo

{  min1=w+df+w+dm/2+df+w+df/2+dm-w+12;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dm;w++)             //3fl pravo

{  min1=w+abs(dm/2-w)+df+w+df/2+dm-w+12;

if (min1<mini) {mini=min1;fl=2;}

}

setcolor(GREEN);

circle(1.4*(f-3),1.4*(m-dm/2-7),2);

setcolor(WHITE);

rectangle(1.4*(f+1),1.4*(m-dm/2-8),1.4*(f+3),1.4*(m-dm/2-6));

}

void hubposition4(void)

{int mini=10000,min1,fl=1;

for( int w=0;w<dg;w++)             //1fl verh

{  min1=w+dg-w+dh+dg-w+dg/2+dh+dg-w+12;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dg;w++)             //1fl niz

{  min1=abs(dg/2-w)+dg-w+dh+dg-w+dh+w+12;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dh;w++)             //1fl levo

{  min1=w+dg+w+dg/2+dh-w+dg+dh-w+12;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dh;w++)             //1fl pravo

{  min1=w+dh-w+dg/2+dh-w+dg+w+12;

if (min1<mini) {mini=min1;fl=2;}

}

for(  w=0;w<dg;w++)             //2fl verh

{  min1=w+dg-w+dh+dg-w+dg/2+dh+dg-w+6;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dg;w++)             //2fl niz

{  min1=abs(dg/2-w)+dg-w+dh+dg-w+dh+w+6;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dh;w++)             //2fl levo

{  min1=w+dg+w+dg/2+dh-w+dg+dh-w+6;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dh;w++)             //2fl pravo

{  min1=w+dh-w+dg/2+dh-w+dg+w+6;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dg;w++)             //3fl verh

{  min1=w+dg-w+dh+dg-w+dg/2+dh+dg-w+12;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dg;w++)             //3fl niz

{  min1=abs(dg/2-w)+dg-w+dh+dg-w+dh+w+12;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dh;w++)             //3fl levo

{  min1=w+dg+w+dg/2+dh-w+dg+dh-w+12;

if (min1<mini) {mini=min1;fl=2;}

}

for( w=0;w<dh;w++)             //3fl pravo

{  min1=w+dh-w+dg/2+dh-w+dg+w+12;