Project is compiled. Unfoftunately, the coordinates got out of control. Drawing is impossible alhought the idea and code correct. Maybe someone can improve it. I did not succeed.
struct Date
{
double X1[4];
double X2[4];
double X3[4];
double X4[4];
double X5[4];
double X6[4];
double a,b;
};
#pragma endregion
System::Double is_Minus()
{
int x;
x=rand()%20;
if(x>=14)
return -1.00;
else
return 1.00;
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
struct Date *date_Image=new struct Date[5];
int i,j,k;
for(i=0;i<5;i++)
{
for(j=0;j<4;j++)
{
date_Image[i].X1[j]=rand()%100/90*0.33;
date_Image[i].X2[j]=rand()%210/80*0.90;
date_Image[i].X3[j]=rand()%100/95*0.33;
date_Image[i].X4[j]=0.0;
date_Image[i].X5[j]=rand()%300/200*0.22;
}
}
for(i=0;i<5;i++)
{
for(j=0;j<4;j++)
{
date_Image[i].X1[j]*=is_Minus();
date_Image[i].X2[j]*=is_Minus();
date_Image[i].X3[j]*=is_Minus();
date_Image[i].X4[j]=0.0;
date_Image[i].X5[j]*=is_Minus();
}
}
Graphics^ s1=panel1->CreateGraphics();
Graphics^ s2=panel2->CreateGraphics();
Graphics^ s3=panel3->CreateGraphics();
Graphics^ s4=panel4->CreateGraphics();
Graphics^ s5=panel5->CreateGraphics();
System::Drawing::Color c1;
System::Drawing::Color c2;
System::Drawing::Color c3;
System::Drawing::Color c4;
System::Drawing::Color c5;
Bitmap^ b1=gcnew Bitmap(panel1->Width,panel1->Height);
Bitmap^ b2=gcnew Bitmap(panel2->Width,panel2->Height);
Bitmap^ b3=gcnew Bitmap(panel3->Width,panel3->Height);
Bitmap^ b4=gcnew Bitmap(panel4->Width,panel4->Height);
Bitmap^ b5=gcnew Bitmap(panel5->Width,panel5->Height);
for(i=0;i<5;i++)
{
date_Image[i].a=rand()%2000;
date_Image[i].b=rand()%2000;
}
for(i=0;i<10000;i++)
{
for(j=0;j<5;j++)
{
k=rand()%4;
switch(k)
{
case 0:
date_Image[j].a=date_Image[j].a*date_Image[j].X1[0]+date_Image[j].b*date_Image[j].X2[0]+date_Image[j].X3[0];
date_Image[j].b=date_Image[j].a*date_Image[j].X4[0]+date_Image[j].b*date_Image[j].X5[0]+date_Image[j].X6[0];
break;
case 1:
date_Image[j].a=date_Image[j].a*date_Image[j].X1[1]+date_Image[j].b*date_Image[j].X2[1]+date_Image[j].X3[1];
date_Image[j].b=date_Image[j].a*date_Image[j].X4[1]+date_Image[j].b*date_Image[j].X5[1]+date_Image[j].X6[1];
break;
case 2:
date_Image[j].a=date_Image[j].a*date_Image[j].X1[2]+date_Image[j].b*date_Image[j].X2[2]+date_Image[j].X3[2];
date_Image[j].b=date_Image[j].a*date_Image[j].X4[2]+date_Image[j].b*date_Image[j].X5[2]+date_Image[j].X6[2];
break;
case 3:
date_Image[j].a=date_Image[j].a*date_Image[j].X1[3]+date_Image[j].b*date_Image[j].X2[3]+date_Image[j].X3[3];
date_Image[j].b=date_Image[j].a*date_Image[j].X4[3]+date_Image[j].b*date_Image[j].X5[3]+date_Image[j].X6[3];
break;
}
c1=System::Drawing::Color::FromArgb(rand()%255,rand()%255,rand()%255);
c2=System::Drawing::Color::FromArgb(rand()%255,rand()%255,rand()%255);
c3=System::Drawing::Color::FromArgb(rand()%255,rand()%255,rand()%255);
c4=System::Drawing::Color::FromArgb(rand()%255,rand()%255,rand()%255);
c5=System::Drawing::Color::FromArgb(rand()%255,rand()%255,rand()%255);
b1->SetPixel(panel1->Width/10+floor(10*date_Image[0].a),panel1->Height-10+floor(10*date_Image[0].b),c1);
b2->SetPixel(panel2->Width/10+floor(10*date_Image[1].a),panel2->Height-10+floor(10*date_Image[1].b),c2);
b3->SetPixel(panel3->Width/10+floor(10*date_Image[2].a),panel3->Height-10+floor(10*date_Image[2].b),c3);
b4->SetPixel(panel4->Width/10+floor(10*date_Image[3].a),panel4->Height-10+floor(10*date_Image[3].b),c4);
b5->SetPixel(panel5->Width/10+floor(10*date_Image[4].a),panel5->Height-10+floor(10*date_Image[4].b),c5);
}
}
s1->DrawImage(dynamic_cast<Image^>(b1),10,10);
s2->DrawImage(dynamic_cast<Image^>(b2),10,10);
s3->DrawImage(dynamic_cast<Image^>(b3),10,10);
s4->DrawImage(dynamic_cast<Image^>(b4),10,10);
s5->DrawImage(dynamic_cast<Image^>(b5),10,10);
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
Close();
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
srand(time(NULL));
}
};
}
Brak komentarzy:
Prześlij komentarz