By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,913 Members | 1,305 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,913 IT Pros & Developers. It's quick & easy.

[Linker Error] Unresolved external '__fastcall TForm1::Fim_Mundo(Extctrls::TImage *)'

P: 1
[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
[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
  1. //---------------------------------------------------------------------------
  2.  
  3. #include <vcl.h>
  4. #include <fstream.h>
  5. #include <math.h>
  6. #pragma hdrstop
  7.  
  8. //variaveis da nossa estrutura do vertices
  9. struct Pontos
  10. {
  11.    int x,y,z;
  12. };
  13.  
  14. #include "Unit1.h"
  15.  
  16.  
  17. //---------------------------------------------------------------------------
  18. #pragma package(smart_init)
  19. #pragma resource "*.dfm"
  20. TForm1 *Form1;
  21.  
  22. Pontos *P1, *P2;
  23. int QtVerticesP1, QtVerticesP2;
  24.  
  25. //Fim do Mundo
  26. float XminP, XmaxP, YminP, YmaxP;
  27. float XminR, XmaxR, YminR, Ymax;
  28.  
  29. //Definir matrizes de T, R e Auxiliares
  30.  float E[3][3], T[3][3], R[3][3], MT[3][3], MAux[3][3];
  31.  
  32. //Ordem da matriz
  33. float ordem_matrizes=3;
  34.  
  35. //Coordenadas do Centro de massa
  36. float Xcm, Ycm;
  37.  
  38. //Número de Coordenação dos dois poligonos (1-> Cinza e 2->Amarelo)
  39. AnsiString  NC_Pol1 = "", NC_Pol2 = "";
  40.  
  41. void __fastcall Fim_Mundo(TImage *Im);
  42. //---------------------------------------------------------------------------
  43. __fastcall TForm1::TForm1(TComponent* Owner)
  44.         : TForm(Owner)
  45. {
  46. }
  47. //---------------------------------------------------------------------------
  48. void __fastcall TForm1::CarregarClick(TObject *Sender)
  49. {
  50. char Linha[1024];
  51. String Dados;
  52. int i;
  53. float X, Y;
  54.  
  55.        QtVerticesP1 = 3;
  56.        P1=new Pontos[QtVerticesP1];
  57.  
  58.          P1[0].x=120;
  59.          P1[0].y=30;
  60.          P1[0].z=1;
  61.  
  62.          P1[1].x= 230;
  63.          P1[1].y=90;
  64.          P1[1].z=1;
  65.  
  66.          P1[2].x= 100;
  67.          P1[2].y=160;
  68.          P1[2].z=1;
  69.  
  70.  
  71.      Desenhar_Poligono(P1,QtVerticesP1, clGray);
  72.  
  73.      //------------------- Poligono 2
  74.      QtVerticesP2 = 3;
  75.  
  76.      P2=new Pontos[QtVerticesP2];
  77.      for(i=0;i<QtVerticesP2;i++)
  78.        {
  79.  
  80.          P2[0].x=890;
  81.          P2[0].y=30;
  82.          P2[0].z=1;
  83.  
  84.          P2[1].x=900;
  85.          P2[1].y=160;
  86.          P2[1].z=1;
  87.  
  88.          P2[2].x=800;
  89.          P2[2].y=160;
  90.          P2[2].z=1;
  91.        }
  92.      Desenhar_Poligono(P2,QtVerticesP2, clYellow);
  93.  
  94.      Button2 ->Enabled = True;
  95. }
  96. //---------------------------------------------------------------------------
  97.  
  98. void __fastcall TForm1::Limpar_Area_Trabalho()
  99. {
  100.   Image1->Canvas->Pen->Color=clBlack;
  101.   Image1->Canvas->Brush->Color=clWhite;
  102.   Image1->Canvas->Rectangle(0,0,Image1->Width,Image1->Height);
  103. }
  104. //---------------------------------------------------------------------------
  105. void __fastcall TForm1::FormCreate(TObject *Sender)
  106. {
  107.    Limpar_Area_Trabalho();
  108.    Fim_Mundo(Image1);
  109.    Timer1->Enabled=False;
  110. }
  111. //---------------------------------------------------------------------------
  112. void __fastcall Fim_Mundo(TImage *Im)
  113. {
  114. XminP=0; XmaxP=Im->Width;
  115. YminP=0; YmaxP=Im->Height;
  116. XminR=0; XmaxR=Im->Width;
  117. YminR=0; YmaxP=Im->Height;
  118. };
  119. //---------------------------------------------------------------------------
  120. void TForm1::Desenhar_Poligono(Pontos *PAux, int QtV, TColor cColor)
  121. {
  122. TPoint *vertices;
  123. int i;
  124.  
  125. // Limpar_Area_Trabalho();
  126. Image1->Canvas->Brush->Color=cColor;
  127. Image1->Canvas->Pen->Color=clBlack;
  128. Image1->Canvas->Pen->Width=1;
  129.  
  130. vertices = new TPoint[QtV];
  131.  
  132. for(i=0;i<QtV;i++)
  133.   {
  134.    Image1->Canvas->Ellipse(PAux[i].x-5,PAux[i].y-5,PAux[i].x+5,PAux[i].y+5);
  135.  
  136.    vertices[i].x=PAux[i].x;
  137.    vertices[i].y=PAux[i].y;
  138.   }
  139.   Image1->Canvas->Polygon(vertices,QtV-1);
  140.  
  141. };
  142. //---------------------------------------------------------------------------
  143. void TForm1::CentroDeMassa(Pontos *PAux, int QtV)
  144. {
  145.  float TempX = 0, TempY = 0;
  146.  
  147.  for(int i=0; i<QtV; i++)
  148.  {
  149.   TempX = TempX + PAux[i].x;
  150.   TempY = TempY + PAux[i].y;
  151.  }
  152.  Xcm=TempX/QtV;
  153.  Ycm=TempY/QtV;
  154. };
  155. //---------------------------------------------------------------------------
  156. AnsiString TForm1::Determinar_NC(float px, float py, Pontos *PAux, int QtV)
  157. {
  158.  int i,j;
  159.  float x1,y1,x2,y2,m;
  160.  AnsiString NC="";
  161.  
  162.  for(int i=0; i<QtV; i++)
  163.  {
  164.   x1=PAux[i].x;
  165.   y1=PAux[i].y;
  166.  
  167.   if(i != QtV -1)
  168.   {
  169.    x2=PAux[i+1].x;
  170.    y2=PAux[i+1].y;
  171.   }
  172.   else
  173.   {
  174.     x2=PAux[0].x;
  175.    y2=PAux[0].y;
  176.   }
  177.   if(x1==x2) m=1;
  178.   else m=(y2-y1)/(x2-x1);
  179.  
  180.   if(m==1)
  181.   {
  182.    if(px>x1) NC=NC+"0";
  183.    else NC=NC+"1";
  184.   }
  185.   else
  186.   {
  187.    if((m*(x2-px)+(py-y2))>0)
  188.    NC=NC+"0";
  189.    else
  190.    NC=NC+"1";
  191.   };
  192.  } //«Fim do For
  193.  return(NC);
  194. };
  195. //---------------------------------------------------------------------------
  196. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  197. {
  198. float Tx1, Ty1, Tz1, Tm;
  199.  
  200. Limpar_Area_Trabalho();
  201.  
  202. // Poligono Cinza
  203.  
  204. CentroDeMassa(P1,QtVerticesP1);
  205. Tx1 = Edit1->Text.ToDouble();
  206. Ty1 = Edit2->Text.ToDouble();
  207. Tz1=1;
  208. Tm= Edit3->Text.ToInt();
  209.  
  210. Transladar(P1,Tx1,Ty1,Tz1,QtVerticesP1);
  211. Rotar(Xcm,Ycm,1,Tm,P1,QtVerticesP1);
  212. NC_Pol1 = Determinar_NC(Xcm, Ycm, P1, QtVerticesP1);
  213. Edit7 ->Text = NC_Pol1;
  214.  
  215. //Desenhar Poligono
  216. Desenhar_Poligono(P1, QtVerticesP1, clGray);
  217.  
  218. CentroDeMassa(P2, QtVerticesP2);
  219. Tm = Edit6->Text.ToDouble();
  220. Tx1= Edit4->Text.ToDouble();
  221. Ty1=Edit5->Text.ToDouble();
  222. Tz1=1;
  223.  
  224. Transladar(P2,Tx1,Ty1,Tz1,QtVerticesP2);
  225. Rotar(Xcm,Ycm,1,Tm,P2,QtVerticesP2);
  226. NC_Pol2= Determinar_NC(Xcm,Ycm,P2,QtVerticesP2);
  227. Edit8->Text=NC_Pol2;
  228.  
  229. //Desenhar poligono
  230.  
  231. Desenhar_Poligono(P2,QtVerticesP2,clYellow);
  232.  
  233. //Chocando-se
  234.  
  235. if(Chocaram(P1,P2))
  236. {
  237. Timer1->Enabled=False;
  238. ShowMessage("Houve Choque");
  239. }
  240.  
  241.  
  242. }
  243. //---------------------------------------------------------------------------
  244. void TForm1::Formar_Mat_E(float Sx,float Sy,float Sz)
  245.  {
  246.    E[0][0]=Sx; E[0][1]=0;  E[0][2]=0;
  247.    E[1][0]=0;  E[1][1]=Sy; E[1][2]=0;
  248.    E[2][0]=0;  E[2][1]=0;  E[2][2]=1;
  249.  }
  250. //---------------------------------------------------------------------------
  251. void TForm1::Formar_Mat_T(float Tx, int Ty, float Tz)
  252. {
  253.         T[0][0]=1;    T[0][1]=0;  T[0][2]=Tx;
  254.         T[1][0]=0;    T[1][1]=1;  T[1][2]=Ty;
  255.         T[2][0]=0;    T[2][1]=0;  T[2][2]=1;
  256.  
  257. }
  258. //---------------------------------------------------------------------------
  259. void TForm1::Formar_Mat_R(float Tm)
  260. {
  261.  
  262. float Ang=Tm*M_PI/180;
  263. float S= sin(Ang);
  264. float C= cos(Ang);
  265.  
  266.         T[0][0]=C;    T[0][1]=-S;  T[0][2]=0;
  267.         T[1][0]=S;    T[1][1]=C;   T[1][2]=0;
  268.         T[2][0]=0;    T[2][1]=0;   T[2][2]=1;
  269.  
  270. }
  271. //---------------------------------------------------------------------------
  272. void TForm1::Mult_Mat(float A[3][3], float B[3][3], float C[3][3])
  273. {
  274. int i,j,k;
  275.  
  276. for(i=0;i<ordem_matrizes;i++)
  277. for(j=0;j<ordem_matrizes;j++)
  278. for(k=0;k<ordem_matrizes;k++)
  279.  
  280. C[i][j]=C[i][j]+A[i][k]*B[k][j];
  281. }
  282. //---------------------------------------------------------------------------
  283. void TForm1::Aplicar_Mat(float M[3][3], Pontos *PAux, int QtV)
  284. {
  285.  int i,j;
  286.  float Num;
  287.  Pontos *P_Resultado;
  288.  P_Resultado = new Pontos[QtV];
  289.  for(i=0;i<QtV;i++)
  290.  {
  291.   Num=0;
  292.   for(j=0;j<ordem_matrizes;j++)
  293.   {
  294.    Num=M[j][0]*PAux[i].x + M[j][1]*PAux[i].y + M[j][2]*PAux[i].z;
  295.    if(j==0) P_Resultado[i].x=Num;
  296.    if(j==1) P_Resultado[i].y=Num;
  297.    if(j==2)P_Resultado[i].z=Num;
  298.   }
  299.  }
  300.  for(i=0;i<QtV;i++)
  301.  PAux[i]=P_Resultado[i];
  302. }
  303. //---------------------------------------------------------------------------
  304. void TForm1::Inic_Matrizes_Transf()
  305. {
  306. int i,j;
  307. for(i=0;i<ordem_matrizes;i++)
  308. for(j=0;j<ordem_matrizes;j++)
  309.  {
  310.   MT[i][j]=0;
  311.   MAux[i][j]=0;
  312.  }
  313. }
  314. //---------------------------------------------------------------------------
  315. void TForm1::Rotar(float Tx,float Ty,float Tz, float Tm,Pontos *PAux, int QtV)
  316. {
  317.  Inic_Matrizes_Transf();
  318.  Formar_Mat_T(-Tx,-Ty,-Tz);
  319.  Formar_Mat_R(Tm);
  320.  Mult_Mat(R,T,MAux);
  321.  Formar_Mat_T(Tx,Ty,Tz);
  322.  Mult_Mat(T,MAux,MT);
  323.  Aplicar_Mat(MT,PAux,QtV);
  324. }
  325. //---------------------------------------------------------------------------
  326. void TForm1::Transladar(Pontos *PAux, float Tx11, float Ty22, float Tz33, int nVert)
  327. {
  328. Inic_Matrizes_Transf();
  329. Formar_Mat_T(Tx11,Ty22,Tz33);
  330. Aplicar_Mat(T,PAux,nVert);
  331. };
  332. //---------------------------------------------------------------------------
  333.  
  334.  
  335. void __fastcall TForm1::Button2Click(TObject *Sender)
  336. {
  337. Timer1->Enabled=True;
  338. }
  339. //---------------------------------------------------------------------------
  340. bool TForm1::Chocaram(Pontos *PAux1, Pontos *PAux2)
  341. {
  342.  bool Choque= false;
  343.  int i=0;
  344.  float Px, Py;
  345.  AnsiString NC_Ponto;
  346.  
  347.  while((i<QtVerticesP1) && (!Choque))
  348.  {
  349.   Px=PAux1[i].x;
  350.   Py=PAux1[i].y;
  351.   NC_Ponto=Determinar_NC(Px,Py,PAux2, QtVerticesP2);
  352.   if(NC_Pol2 == NC_Ponto)
  353.    Choque=True;
  354.     i++;
  355.  };
  356.  if(!Choque)
  357.  {
  358.   i=0;
  359.   while((i<QtVerticesP2) && (!Choque))
  360.   {
  361.    Px=PAux2[i].x;
  362.    Py=PAux2[i].y;
  363.    NC_Ponto=Determinar_NC(Px,Py,PAux1,QtVerticesP1);
  364.    if(NC_Pol1==NC_Ponto)
  365.     Choque= True;
  366.     i++;
  367.   };
  368.  };
  369.  return (Choque);
  370. };
  371. //---------------------------------------------------------------------------
1 Week Ago #1
Share this Question
Share on Google+
1 Reply


100+
P: 135
- Posted code is incomplete. The code includes a custom header file "Unit1.h".
- Use code tags.
- Explain what the code is about (in English).
- Mention the environment details (OS/IDE/Compiler).
1 Week Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.