00001 #ifndef PLANSZA_H_
00002 #define PLANSZA_H_
00003
00004 #include "ziarno.h"
00005
00006 class Komorka{
00007
00008 int rodzajKomorki;
00009
00010 public:
00011
00012 int runda;
00013 int sasiad[26];
00014 int polozenie[6];
00015
00016
00017
00018 void rysujKomorkaKrawedzie();
00019 void rysujKomorkaPowierzchnie();
00020 void rysujKomorkaPunkt();
00021
00022 double getPolozenieSX(){return (polozenie[3]+polozenie[0])*0.5;}
00023 double getPolozenieSY(){return (polozenie[4]+polozenie[1])*0.5;}
00024 double getPolozenieSZ(){return (polozenie[5]+polozenie[2])*0.5;}
00025
00026 void setRodzajKomorki(int rodzaj){ rodzajKomorki = rodzaj ;}
00027 int getRodzajKomorki(){return rodzajKomorki;}
00028
00029
00030 };
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 class Plansza{
00140
00141 int wielkoscX,wielkoscY,wielkoscZ;
00142 int rysujX,rysujY,rysujZ;
00143 bool warPer;
00144
00145 int *wyszukajSasiadow(int x,int y,int z);
00146 void ustawSasiadowPolozenieKomorkiPer(Komorka &Komorka,int x,int y,int z);
00147 void ustawSasiadowPolozenieKomorkiNiePer(Komorka &k,int x,int y,int z);
00148 int polPerX(int a){if(a==-1){return wielkoscX-1;}else if(a==wielkoscX){return 0;}return a;}
00149 int polPerY(int a){if(a==-1){return wielkoscY-1;}else if(a==wielkoscY){return 0;}return a;}
00150 int polPerZ(int a){if(a==-1){return wielkoscZ-1;}else if(a==wielkoscZ){return 0;}return a;}
00151
00152 int polNiePer(int ax,int ay,int az);
00153
00154
00155
00156 public:
00157
00158
00159
00160 IntList niePokZiarn;
00161
00162
00163
00164 ZiarnoList ziarna;
00165 Komorka* komorki;
00166
00167
00168
00169
00170
00171
00172 Plansza(int wX,int wY,int wZ,bool periodyczne){setPlansza(wX,wY,wZ,periodyczne,true);}
00173
00174 int getWielkoscX(){return wielkoscX;}
00175 int getWielkoscY(){return wielkoscY;}
00176 int getWielkoscZ(){return wielkoscZ;}
00177
00178 bool getWarPer(){return warPer;};
00179 void setPlansza(int wX,int wY,int wZ,bool periodyczne,bool wlaczAC);
00180 void wczytajAC(const char *nazwa);
00181
00182
00183 void rysujSasiadow(int ktory);
00184 void rysujWszystkieKomorki();
00185 void rysujZiarna(bool punktami,int polZ);
00186 void rysujZiarnaGraniczne();
00187 void rysujElementyZiarn(PunktList &punkty,ElementList &elementy);
00188 void rysujElementyZiarnPrzekroj(PunktList &punkty,ElementList &elementy,int x,int y,int z,bool rysowac);
00189 void elementyDoZiaren(ElementList &elementy);
00190 void resetZiaren(int ileZ);
00191 void resetKomorek();
00192
00193 void przesunZiarno(int numerZiarna,PunktList &points,ElementList &elements,int kierunek,double wartosc){
00194 ziarna.przesunZiarno(numerZiarna,points,elements,kierunek,wartosc);
00195 }
00196
00197 void obrocZiarno(int numerZiarna,PunktList &points,ElementList &elements,int kierunek,double wartosc){
00198 ziarna.obrocZiarno(numerZiarna,points,elements,kierunek,wartosc);
00199 }
00200
00201 ~Plansza(){delete []komorki;}
00202
00203 };
00204
00205
00206 #endif // PLANSZA_H_
00207
00208
00209