SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.LinkedList;
  2.  
  3. public class Generators {
  4.     public static LinkedList<NODE> generateNODES(double W,double nW,double H,double nH)
  5.     {
  6.         double dW=W/(nW-1);
  7.         double dH=H/(nH-1);
  8.         System.out.println(dW);
  9.         System.out.println(dH);
  10.         LinkedList<NODE> tmp=new LinkedList<>();
  11.         for(int i=0;i<nW;i++)
  12.         {
  13.             for(int j=0;j<nH;j++)
  14.             {
  15.  
  16.                 if(i*dW==0 || i*dW==W || j*H==0 || j*dH==H)
  17.                     tmp.add(new NODE(i*dW,j*dH,true));
  18.                 else
  19.                     tmp.add(new NODE(i*dW,j*dH,false));
  20.             }
  21.  
  22.         }
  23.         return tmp;
  24.     }
  25.     public static void print(LinkedList<NODE>list)
  26.     {
  27.         for(NODE a:list)
  28.         {
  29.             System.out.println(a.x+ " "+a.y+" "+a.BC);
  30.         }
  31.     }
  32.     public static LinkedList<Element> generateElements(double nH,double nW)
  33.     {
  34.         LinkedList<Element> tmp=new LinkedList<>();
  35.         int i=1;
  36.  
  37.         tmp.add(new Element(i,i+(int)nH,i+1+(int)nH,i+1));
  38.         for(int j=0;j<(nW-1)*(nH-1)-1;j++)
  39.         {
  40.             i++;
  41.             if(i%nH==0)
  42.                 i++;
  43.             tmp.add(new Element(i,i+(int)nH,i+1+(int)nH,i+1));
  44.         }
  45.         return tmp;
  46.     }
  47.     public static void printElements(LinkedList<Element> list)
  48.     {
  49.         for(Element a:list)
  50.         {
  51.             System.out.println(a.ID[0]+" "+a.ID[1]+" "+a.ID[2]+" "+a.ID[3]);
  52.         }
  53.     }
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top