//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "UITransformaciones.h"
#include "Matrix.h"
#include "Mapeo.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TrackBar1Change(TObject *Sender)
{
Form1->Refresh();
int ancho = Panel1->Width;
int grados = 0;
if(TrackBar1->Position>36)
{
grados = TrackBar1->Position;
}
else if(TrackBar1->Position<36)
{
grados = TrackBar1->Position * -1;
}
else
grados = 0;
/*
Matrix fig(4,3,Fig);
Matrix id(3,3,0);
Matrix fres(4,3,0);
*/
Matrix fig,id,fres;
//nreng
fig.Inicializa(4,3);
id.Inicializa(3,3);
fres.Inicializa(4,3);
for(int i=0;i
//fres.traslacion(fig,id,tx,ty);
fres.rotacion(fig,id,grados);
int L = (Form1->ClientWidth-ancho)/2;
int M = Form1->ClientHeight/2;
UnidadII obj;
obj.ventana((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
obj.puerto((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
int x,y;
obj.mapeo(fres.GETM(0,0), fres.GETM(0,1), x, y, L, M);
Canvas->MoveTo(x,y);
for(int i=0; i
obj.mapeo(fres.GETM(i,0),fres.GETM(i,1), x, y, L, M);
Canvas->LineTo(x, y);
}
for(int i=0;i
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
PageControl1->Enabled = true;
Form1->Refresh();
int ancho = Panel1->Width;
int L = (Form1->ClientWidth-ancho)/2;
int M = Form1->ClientHeight/2;
Fig[0][0]= 10; Fig[0][1]= 10; Fig[0][2]= 1;
Fig[1][0]= 30; Fig[1][1]= 10; Fig[1][2]= 1;
Fig[2][0]= 10; Fig[2][1]= 30; Fig[2][2]= 1;
Fig[3][0]= 10; Fig[3][1]= 10; Fig[3][2]= 1;
//RESPALDAR VALORES
for(int i = 0; i< 4; i++)
for(int j = 0; j < 3; j++)
FigAux[i][j] = Fig[i][j];
UnidadII obj;
obj.ventana((Form1->ClientWidth-ancho)/2,0,(Form1->ClientWidth-ancho),Form1->ClientHeight/2);
obj.puerto((Form1->ClientWidth-ancho)/2,0,(Form1->ClientWidth-ancho),Form1->ClientHeight/2);
int x,y;
obj.mapeo(Fig[0][0], Fig[0][1], x, y, L, M);
Canvas->MoveTo(x,y);
for(int i=0; i< 4; i++)
{
obj.mapeo(Fig[i][0],Fig[i][1], x, y, L, M);
Canvas->LineTo(x, y);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Form1->Refresh();
int ancho = Panel1->Width;
int L = (Form1->ClientWidth-ancho)/2;
int M = Form1->ClientHeight/2;
//No. de Renglones de la Figura
for(int i=0;i<4;i++)
for(int j=0;j<3;j++)
Fig[i][j]=FigAux[i][j];
UnidadII obj;
obj.ventana(Form1->ClientWidth/2,0,Form1->ClientWidth,Form1->ClientHeight/2);
obj.puerto(Form1->ClientWidth/2,0,Form1->ClientWidth,Form1->ClientHeight/2);
int x,y;
obj.mapeo(Fig[0][0], Fig[0][1], x, y, L, M);
Canvas->MoveTo(x,y);
//No. de Renglones de la Figura
for(int i=0; i<4; i++)
{
obj.mapeo(Fig[i][0],Fig[i][1], x, y, L, M);
Canvas->LineTo(x, y);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TrackBar2Change(TObject *Sender)
{
Form1->Refresh();
Tx = Edit3->Text.ToIntDef(3);
Ty = Edit4->Text.ToIntDef(0);
int ancho = Panel1->Width;
int grados = 0;
if(TrackBar1->Position>36)
{
grados = TrackBar1->Position;
}
else if(TrackBar1->Position<36)
{
grados = TrackBar1->Position * -1;
}
else
grados = 0;
/*
Matrix fig(4,3,Fig);
Matrix id(3,3,0);
Matrix fres(4,3,0);
*/
Matrix fig,id,fres;
//nreng
fig.Inicializa(4,3);
id.Inicializa(3,3);
fres.Inicializa(4,3);
for(int i=0;i
//fres.traslacion(fig,id,tx,ty);
//fres.rotacion(fig,id,grados);
fres.rotacion_pivote(fig,id,Tx,Ty,grados);
int L = (Form1->ClientWidth-ancho)/2;
int M = Form1->ClientHeight/2;
UnidadII obj;
obj.ventana((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
obj.puerto((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
int x,y;
obj.mapeo(fres.GETM(0,0), fres.GETM(0,1), x, y, L, M);
Canvas->MoveTo(x,y);
for(int i=0; i
obj.mapeo(fres.GETM(i,0),fres.GETM(i,1), x, y, L, M);
Canvas->LineTo(x, y);
}
for(int i=0;i
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormPaint(TObject *Sender)
{
//LINEA HORIZONTAL
Canvas->MoveTo(0,Form1->ClientHeight/2);
Canvas->LineTo(Form1->Width-Panel1->ClientWidth,Form1->ClientHeight/2);
//LINEA VERTICAL
Canvas->MoveTo((Form1->ClientWidth-Panel1->Width)/2,0);
Canvas->LineTo((Form1->ClientWidth-Panel1->Width)/2,Form1->ClientHeight);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TrackBar5Change(TObject *Sender)
{
Form1->Refresh();
int ancho = Panel1->Width;
if(TrackBar5->Position
Tx = -TrackBar5->Position;
}
else
Tx =TrackBar5->Position;
Ty = TrackBar6->Position;
Matrix fig,id,fres;
//nreng
fig.Inicializa(4,3);
id.Inicializa(3,3);
fres.Inicializa(4,3);
for(int i=0;i
fres.escalacion(fig,id,Tx,Ty);
//fres.rotacion(fig,id,grados);
int L = (Form1->ClientWidth-ancho)/2;
int M = Form1->ClientHeight/2;
UnidadII obj;
obj.ventana((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
obj.puerto((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
int x,y;
obj.mapeo(fres.GETM(0,0), fres.GETM(0,1), x, y, L, M);
Canvas->MoveTo(x,y);
for(int i=0; i
obj.mapeo(fres.GETM(i,0),fres.GETM(i,1), x, y, L, M);
Canvas->LineTo(x, y);
}
for(int i=0;i
posAcX = TrackBar5->Position;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TrackBar6Change(TObject *Sender)
{
Form1->Refresh();
int ancho = Panel1->Width;
if(TrackBar5->Position
Tx = -TrackBar5->Position;
}
else
Tx =TrackBar5->Position;
Ty = TrackBar6->Position;
Matrix fig,id,fres;
//nreng
fig.Inicializa(4,3);
id.Inicializa(3,3);
fres.Inicializa(4,3);
for(int i=0;i
fres.escalacion(fig,id,Tx,Ty);
//fres.rotacion(fig,id,grados);
int L = (Form1->ClientWidth-ancho)/2;
int M = Form1->ClientHeight/2;
UnidadII obj;
obj.ventana((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
obj.puerto((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
int x,y;
obj.mapeo(fres.GETM(0,0), fres.GETM(0,1), x, y, L, M);
Canvas->MoveTo(x,y);
for(int i=0; i
obj.mapeo(fres.GETM(i,0),fres.GETM(i,1), x, y, L, M);
Canvas->LineTo(x, y);
}
for(int i=0;i
posAcX = TrackBar5->Position;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
switch(ComboBox1->ItemIndex)
{
case 0:
{
Form1->Refresh();
int ancho = Panel1->Width;
Matrix fig,id,fres;
//nreng
fig.Inicializa(4,3);
id.Inicializa(3,3);
fres.Inicializa(4,3);
for(int i=0;i
fres.reflexion_con_X(fig,id);
//fres.rotacion(fig,id,grados);
int L = (Form1->ClientWidth-ancho)/2;
int M = Form1->ClientHeight/2;
UnidadII obj;
obj.ventana((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
obj.puerto((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
int x,y;
obj.mapeo(fres.GETM(0,0), fres.GETM(0,1), x, y, L, M);
Canvas->MoveTo(x,y);
for(int i=0; i
obj.mapeo(fres.GETM(i,0),fres.GETM(i,1), x, y, L, M);
Canvas->LineTo(x, y);
}
for(int i=0;i
}
break;
case 1:
{
Form1->Refresh();
int ancho = Panel1->Width;
Matrix fig,id,fres;
//nreng
fig.Inicializa(4,3);
id.Inicializa(3,3);
fres.Inicializa(4,3);
for(int i=0;i
fres.reflexion_con_Y(fig,id);
//fres.rotacion(fig,id,grados);
int L = (Form1->ClientWidth-ancho)/2;
int M = Form1->ClientHeight/2;
UnidadII obj;
obj.ventana((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
obj.puerto((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
int x,y;
obj.mapeo(fres.GETM(0,0), fres.GETM(0,1), x, y, L, M);
Canvas->MoveTo(x,y);
for(int i=0; i
obj.mapeo(fres.GETM(i,0),fres.GETM(i,1), x, y, L, M);
Canvas->LineTo(x, y);
}
for(int i=0;i
}
break;
case 2:
{
Form1->Refresh();
int ancho = Panel1->Width;
Matrix fig,id,fres;
//nreng
fig.Inicializa(4,3);
id.Inicializa(3,3);
fres.Inicializa(4,3);
for(int i=0;i
fres.reflexion_eje_coord(fig,id);
//fres.rotacion(fig,id,grados);
int L = (Form1->ClientWidth-ancho)/2;
int M = Form1->ClientHeight/2;
UnidadII obj;
obj.ventana((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
obj.puerto((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
int x,y;
obj.mapeo(fres.GETM(0,0), fres.GETM(0,1), x, y, L, M);
Canvas->MoveTo(x,y);
for(int i=0; i
obj.mapeo(fres.GETM(i,0),fres.GETM(i,1), x, y, L, M);
Canvas->LineTo(x, y);
}
for(int i=0;i
}
break;
case 3:
{
Form1->Refresh();
int ancho = Panel1->Width;
Matrix fig,id,fres;
//nreng
fig.Inicializa(4,3);
id.Inicializa(3,3);
fres.Inicializa(4,3);
for(int i=0;i
fres.reflexion_yigualmenosx(fig,id);
//fres.rotacion(fig,id,grados);
int L = (Form1->ClientWidth-ancho)/2;
int M = Form1->ClientHeight/2;
UnidadII obj;
obj.ventana((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
obj.puerto((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
int x,y;
obj.mapeo(fres.GETM(0,0), fres.GETM(0,1), x, y, L, M);
Canvas->MoveTo(x,y);
for(int i=0; i
obj.mapeo(fres.GETM(i,0),fres.GETM(i,1), x, y, L, M);
Canvas->LineTo(x, y);
}
for(int i=0;i
}
break;
case 4:
{
Form1->Refresh();
int ancho = Panel1->Width;
Matrix fig,id,fres;
//nreng
fig.Inicializa(4,3);
id.Inicializa(3,3);
fres.Inicializa(4,3);
for(int i=0;i
fres.reflexion_yigualx(fig,id);
//fres.rotacion(fig,id,grados);
int L = (Form1->ClientWidth-ancho)/2;
int M = Form1->ClientHeight/2;
UnidadII obj;
obj.ventana((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
obj.puerto((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
int x,y;
obj.mapeo(fres.GETM(0,0), fres.GETM(0,1), x, y, L, M);
Canvas->MoveTo(x,y);
for(int i=0; i
obj.mapeo(fres.GETM(i,0),fres.GETM(i,1), x, y, L, M);
Canvas->LineTo(x, y);
}
for(int i=0;i
}
break;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
Form1->Refresh();
int tx= Edit1->Text.ToIntDef(0);
int ty= Edit2->Text.ToIntDef(0);
int ancho = Panel1->Width;
/*
Matrix fig(4,3,Fig);
Matrix id(3,3,0);
Matrix fres(4,3,0);
*/
Matrix fig,id,fres;
//nreng
fig.Inicializa(4,3);
id.Inicializa(3,3);
fres.Inicializa(4,3);
for(int i=0;i
fres.traslacion(fig,id,tx,ty);
int L = (Form1->ClientWidth-ancho)/2;
int M = Form1->ClientHeight/2;
UnidadII obj;
obj.ventana((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
obj.puerto((Form1->ClientWidth-ancho)/2,0,Form1->ClientWidth-ancho,Form1->ClientHeight/2);
int x,y;
obj.mapeo(fres.GETM(0,0), fres.GETM(0,1), x, y, L, M);
Canvas->MoveTo(x,y);
for(int i=0; i
obj.mapeo(fres.GETM(i,0),fres.GETM(i,1), x, y, L, M);
Canvas->LineTo(x, y);
}
for(int i=0;i
}
//---------------------------------------------------------------------------
No hay comentarios:
Publicar un comentario