00001 #ifndef ZIARNO_H_ 00002 #define ZIARNO_H_ 00003 00004 #include <math.h> 00005 #include <cstdlib> 00006 00007 #include "wektor.h" 00008 00009 class Kolor{ 00010 00011 public: 00012 float r,g,b; 00013 00014 Kolor(float R,float G,float B ){r=R;g=G;b=B;} 00015 Kolor(){r=0;g=0;b=0;} 00016 00017 }; 00018 00019 class Ziarno{ 00020 00021 int rodzaj; 00022 Kolor rgb; 00023 00024 public: 00025 00026 void ustalZiarno(int rodz, float R , float G , float B ){rodzaj = rodz;rgb.r = R; rgb.g=G; rgb.b=B;} 00027 void ustawRodzaj(int rodz){rodzaj = rodz;} 00028 void ustawKolor(Kolor k){ rgb.r = k.r; rgb.g=k.g; rgb.b=k.b;} 00029 void ustawKolor( float R , float G , float B ){ rgb.r = R; rgb.g=G; rgb.b=B;} 00030 00031 int pobierzRodzaj(){return rodzaj;} 00032 Kolor &pobierzKolor(){return rgb;} 00033 00034 float pobierzKolorR(){return rgb.r;} 00035 float pobierzKolorG(){return rgb.g;} 00036 float pobierzKolorB(){return rgb.b;} 00037 00038 00039 00040 }; 00041 00042 class ZiarnoList{ 00043 00044 int iter,grow,max; 00045 00046 Ziarno *Lista; 00047 00048 public: 00049 00050 ZiarnoList(int grow1,int max1){iter=0;grow=grow1;max=max1;Lista = new Ziarno[max];} 00051 ZiarnoList(){iter=0;max=100;grow=100;Lista = new Ziarno[max];} 00052 00053 int getIter(){return iter;} 00054 void setGrow(int grow1){if(grow>1){grow=grow1;}} 00055 00056 void setElement(Ziarno a); 00057 void setElement(int rodzaj,float r,float g,float b); 00058 00059 Ziarno &getElement(int ktory){return Lista[ktory];} 00060 Ziarno &getLastElement(){return Lista[iter-1];} 00061 Ziarno &getLastElement(int odKonca){return Lista[iter-(1+odKonca)];} 00062 00063 void czysc(int grow1,int max1){grow=grow1;max=max1; delete []Lista; Lista = new Ziarno[max];iter=0;} 00064 void ustawIter(int iter1){iter = iter1;} 00065 void zmienIterO(int iter1){iter += iter1;} 00066 void identyfikacjaZiaren(); 00067 00068 void przesunZiarno(int numerZiarna,PunktList &points,ElementList &elements,int kierunek,double wartosc); 00069 void obrocZiarno(int numerZiarna,PunktList &points,ElementList &elements,int kierunekOsi,double wartosc); 00070 00071 ~ZiarnoList(){if(Lista!=NULL){delete []Lista;Lista = NULL;}} 00072 }; 00073 00074 00075 00076 #endif // ZIARNO_H_