[Linker Error] Unresolved external '__fastcall TForm1::Fim_Mundo(Extctrls::TImage *)' referenced from C:\USERS\AMELIA DANIEL\DOCUMENTS\PROJECTOCG\UNIT1.OBJ
[Linker Error] Unresolved external '__fastcall TForm1::Fim_Mundo(Extctrls::TImage *)' referenced from C:\USERS\AMELIA DANIEL\DOCUMENTS\PROJECTOCG\UNIT1.OBJ
TENHO ESTE ERRO NO CÓDIGO
Expand|Select|Wrap|Line Numbers
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include <fstream.h>
- #include <math.h>
- #pragma hdrstop
- //variaveis da nossa estrutura do vertices
- struct Pontos
- {
- int x,y,z;
- };
- #include "Unit1.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- Pontos *P1, *P2;
- int QtVerticesP1, QtVerticesP2;
- //Fim do Mundo
- float XminP, XmaxP, YminP, YmaxP;
- float XminR, XmaxR, YminR, Ymax;
- //Definir matrizes de T, R e Auxiliares
- float E[3][3], T[3][3], R[3][3], MT[3][3], MAux[3][3];
- //Ordem da matriz
- float ordem_matrizes=3;
- //Coordenadas do Centro de massa
- float Xcm, Ycm;
- //Número de Coordenação dos dois poligonos (1-> Cinza e 2->Amarelo)
- AnsiString NC_Pol1 = "", NC_Pol2 = "";
- void __fastcall Fim_Mundo(TImage *Im);
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::CarregarClick(TObject *Sender)
- {
- char Linha[1024];
- String Dados;
- int i;
- float X, Y;
- QtVerticesP1 = 3;
- P1=new Pontos[QtVerticesP1];
- P1[0].x=120;
- P1[0].y=30;
- P1[0].z=1;
- P1[1].x= 230;
- P1[1].y=90;
- P1[1].z=1;
- P1[2].x= 100;
- P1[2].y=160;
- P1[2].z=1;
- Desenhar_Poligono(P1,QtVerticesP1, clGray);
- //------------------- Poligono 2
- QtVerticesP2 = 3;
- P2=new Pontos[QtVerticesP2];
- for(i=0;i<QtVerticesP2;i++)
- {
- P2[0].x=890;
- P2[0].y=30;
- P2[0].z=1;
- P2[1].x=900;
- P2[1].y=160;
- P2[1].z=1;
- P2[2].x=800;
- P2[2].y=160;
- P2[2].z=1;
- }
- Desenhar_Poligono(P2,QtVerticesP2, clYellow);
- Button2 ->Enabled = True;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Limpar_Area_Trabalho()
- {
- Image1->Canvas->Pen->Color=clBlack;
- Image1->Canvas->Brush->Color=clWhite;
- Image1->Canvas->Rectangle(0,0,Image1->Width,Image1->Height);
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FormCreate(TObject *Sender)
- {
- Limpar_Area_Trabalho();
- Fim_Mundo(Image1);
- Timer1->Enabled=False;
- }
- //---------------------------------------------------------------------------
- void __fastcall Fim_Mundo(TImage *Im)
- {
- XminP=0; XmaxP=Im->Width;
- YminP=0; YmaxP=Im->Height;
- XminR=0; XmaxR=Im->Width;
- YminR=0; YmaxP=Im->Height;
- };
- //---------------------------------------------------------------------------
- void TForm1::Desenhar_Poligono(Pontos *PAux, int QtV, TColor cColor)
- {
- TPoint *vertices;
- int i;
- // Limpar_Area_Trabalho();
- Image1->Canvas->Brush->Color=cColor;
- Image1->Canvas->Pen->Color=clBlack;
- Image1->Canvas->Pen->Width=1;
- vertices = new TPoint[QtV];
- for(i=0;i<QtV;i++)
- {
- Image1->Canvas->Ellipse(PAux[i].x-5,PAux[i].y-5,PAux[i].x+5,PAux[i].y+5);
- vertices[i].x=PAux[i].x;
- vertices[i].y=PAux[i].y;
- }
- Image1->Canvas->Polygon(vertices,QtV-1);
- };
- //---------------------------------------------------------------------------
- void TForm1::CentroDeMassa(Pontos *PAux, int QtV)
- {
- float TempX = 0, TempY = 0;
- for(int i=0; i<QtV; i++)
- {
- TempX = TempX + PAux[i].x;
- TempY = TempY + PAux[i].y;
- }
- Xcm=TempX/QtV;
- Ycm=TempY/QtV;
- };
- //---------------------------------------------------------------------------
- AnsiString TForm1::Determinar_NC(float px, float py, Pontos *PAux, int QtV)
- {
- int i,j;
- float x1,y1,x2,y2,m;
- AnsiString NC="";
- for(int i=0; i<QtV; i++)
- {
- x1=PAux[i].x;
- y1=PAux[i].y;
- if(i != QtV -1)
- {
- x2=PAux[i+1].x;
- y2=PAux[i+1].y;
- }
- else
- {
- x2=PAux[0].x;
- y2=PAux[0].y;
- }
- if(x1==x2) m=1;
- else m=(y2-y1)/(x2-x1);
- if(m==1)
- {
- if(px>x1) NC=NC+"0";
- else NC=NC+"1";
- }
- else
- {
- if((m*(x2-px)+(py-y2))>0)
- NC=NC+"0";
- else
- NC=NC+"1";
- };
- } //«Fim do For
- return(NC);
- };
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Timer1Timer(TObject *Sender)
- {
- float Tx1, Ty1, Tz1, Tm;
- Limpar_Area_Trabalho();
- // Poligono Cinza
- CentroDeMassa(P1,QtVerticesP1);
- Tx1 = Edit1->Text.ToDouble();
- Ty1 = Edit2->Text.ToDouble();
- Tz1=1;
- Tm= Edit3->Text.ToInt();
- Transladar(P1,Tx1,Ty1,Tz1,QtVerticesP1);
- Rotar(Xcm,Ycm,1,Tm,P1,QtVerticesP1);
- NC_Pol1 = Determinar_NC(Xcm, Ycm, P1, QtVerticesP1);
- Edit7 ->Text = NC_Pol1;
- //Desenhar Poligono
- Desenhar_Poligono(P1, QtVerticesP1, clGray);
- CentroDeMassa(P2, QtVerticesP2);
- Tm = Edit6->Text.ToDouble();
- Tx1= Edit4->Text.ToDouble();
- Ty1=Edit5->Text.ToDouble();
- Tz1=1;
- Transladar(P2,Tx1,Ty1,Tz1,QtVerticesP2);
- Rotar(Xcm,Ycm,1,Tm,P2,QtVerticesP2);
- NC_Pol2= Determinar_NC(Xcm,Ycm,P2,QtVerticesP2);
- Edit8->Text=NC_Pol2;
- //Desenhar poligono
- Desenhar_Poligono(P2,QtVerticesP2,clYellow);
- //Chocando-se
- if(Chocaram(P1,P2))
- {
- Timer1->Enabled=False;
- ShowMessage("Houve Choque");
- }
- }
- //---------------------------------------------------------------------------
- void TForm1::Formar_Mat_E(float Sx,float Sy,float Sz)
- {
- E[0][0]=Sx; E[0][1]=0; E[0][2]=0;
- E[1][0]=0; E[1][1]=Sy; E[1][2]=0;
- E[2][0]=0; E[2][1]=0; E[2][2]=1;
- }
- //---------------------------------------------------------------------------
- void TForm1::Formar_Mat_T(float Tx, int Ty, float Tz)
- {
- T[0][0]=1; T[0][1]=0; T[0][2]=Tx;
- T[1][0]=0; T[1][1]=1; T[1][2]=Ty;
- T[2][0]=0; T[2][1]=0; T[2][2]=1;
- }
- //---------------------------------------------------------------------------
- void TForm1::Formar_Mat_R(float Tm)
- {
- float Ang=Tm*M_PI/180;
- float S= sin(Ang);
- float C= cos(Ang);
- T[0][0]=C; T[0][1]=-S; T[0][2]=0;
- T[1][0]=S; T[1][1]=C; T[1][2]=0;
- T[2][0]=0; T[2][1]=0; T[2][2]=1;
- }
- //---------------------------------------------------------------------------
- void TForm1::Mult_Mat(float A[3][3], float B[3][3], float C[3][3])
- {
- int i,j,k;
- for(i=0;i<ordem_matrizes;i++)
- for(j=0;j<ordem_matrizes;j++)
- for(k=0;k<ordem_matrizes;k++)
- C[i][j]=C[i][j]+A[i][k]*B[k][j];
- }
- //---------------------------------------------------------------------------
- void TForm1::Aplicar_Mat(float M[3][3], Pontos *PAux, int QtV)
- {
- int i,j;
- float Num;
- Pontos *P_Resultado;
- P_Resultado = new Pontos[QtV];
- for(i=0;i<QtV;i++)
- {
- Num=0;
- for(j=0;j<ordem_matrizes;j++)
- {
- Num=M[j][0]*PAux[i].x + M[j][1]*PAux[i].y + M[j][2]*PAux[i].z;
- if(j==0) P_Resultado[i].x=Num;
- if(j==1) P_Resultado[i].y=Num;
- if(j==2)P_Resultado[i].z=Num;
- }
- }
- for(i=0;i<QtV;i++)
- PAux[i]=P_Resultado[i];
- }
- //---------------------------------------------------------------------------
- void TForm1::Inic_Matrizes_Transf()
- {
- int i,j;
- for(i=0;i<ordem_matrizes;i++)
- for(j=0;j<ordem_matrizes;j++)
- {
- MT[i][j]=0;
- MAux[i][j]=0;
- }
- }
- //---------------------------------------------------------------------------
- void TForm1::Rotar(float Tx,float Ty,float Tz, float Tm,Pontos *PAux, int QtV)
- {
- Inic_Matrizes_Transf();
- Formar_Mat_T(-Tx,-Ty,-Tz);
- Formar_Mat_R(Tm);
- Mult_Mat(R,T,MAux);
- Formar_Mat_T(Tx,Ty,Tz);
- Mult_Mat(T,MAux,MT);
- Aplicar_Mat(MT,PAux,QtV);
- }
- //---------------------------------------------------------------------------
- void TForm1::Transladar(Pontos *PAux, float Tx11, float Ty22, float Tz33, int nVert)
- {
- Inic_Matrizes_Transf();
- Formar_Mat_T(Tx11,Ty22,Tz33);
- Aplicar_Mat(T,PAux,nVert);
- };
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button2Click(TObject *Sender)
- {
- Timer1->Enabled=True;
- }
- //---------------------------------------------------------------------------
- bool TForm1::Chocaram(Pontos *PAux1, Pontos *PAux2)
- {
- bool Choque= false;
- int i=0;
- float Px, Py;
- AnsiString NC_Ponto;
- while((i<QtVerticesP1) && (!Choque))
- {
- Px=PAux1[i].x;
- Py=PAux1[i].y;
- NC_Ponto=Determinar_NC(Px,Py,PAux2, QtVerticesP2);
- if(NC_Pol2 == NC_Ponto)
- Choque=True;
- i++;
- };
- if(!Choque)
- {
- i=0;
- while((i<QtVerticesP2) && (!Choque))
- {
- Px=PAux2[i].x;
- Py=PAux2[i].y;
- NC_Ponto=Determinar_NC(Px,Py,PAux1,QtVerticesP1);
- if(NC_Pol1==NC_Ponto)
- Choque= True;
- i++;
- };
- };
- return (Choque);
- };
- //---------------------------------------------------------------------------