Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Go Back   Foros Club Delphi > Principal > Varios
Register FAQ Members List Calendar Guía de estilo Search Today's Posts Mark Forums Read

Coloboración Paypal con ClubDelphi

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02/03/2011
darnnezt darnnezt is offline
Miembro
 
Join Date: Jul 2010
Posts: 17
Poder: 0
darnnezt Va por buen camino
Arrow Ayuda Con Una Codificacion-delphi

BUENAS QUERIDOS AMIGOS Y AFELIADOS DEL CLUB DELPHI COMO EN OTRA OCASIONES, HE VUELTO ACA PARA PEDIR UN POCO DE SU AYUDA Y CONOCIMIENTOS SOBRE EL COMPLEJO PROGRAMA DELPHI:
EN ESTA OCACION LES TRAIGO COMO TAREA ( es solo Juego es un programa de la Universidad), el siguiente programa:
el cual desearía que me ayudaran a corregir el los posibles errores presentes en el y si es posible mostrarme hasta una mejor opción de cómo poder codificarlo.
Por otra parte el siguiente programa quería realizarlo usando ya se la estructura Repetitiva “ While to do” o la “Fort o Do” pero en visto de la falta de practica y conocimientos lo hice de la siguiente manera;

El PROGRAMA QUE DISEÑE SE BASA EN EL CALCULO DE CENTROIDES DE FIGURAS COMPUESTA, TENIENDO PREVIENTA EN AREA Y LAS COORDENADAS CENTROIDALES DE CADA FIGURA POR SEPARADO.

Les doy por adalantado las gracias aquellos que se adentren en mi Post también a los q tengan la molestia en ayudar,



Me despido con un cordial saludo : atta: DarNNezT


Código Delphi [-]
TForm1.Button1Click(Sender: TObject);
var a1,a2,a3,a4,a5,a6,areas:real;  // centroides de cada area 
x1,y1,z1:real; 
x2,y2,z2:real; 
x3,y3,z3:real; 
x4,y4,z4:real; 
x5,y5,z5:real; 
x6,y6,z6:real; 
//centroide general 
xc,yc,zc:real
//variables de centroidees  
ax1,ay1,az1:real; 
ax2,ay2,az2:real; 
ax3,ay3,az3:real; 
ax4,ay4,az4:real; 
ax5,ay5,az5:real; 
ax6,ay6,az6:real; 
begin  //Calculo  
//primera figura 
a1:= strtofloat(inputbox('VALOR DE LA PRIMERA AREA','A1=','')); 
x1:= strtofloat(inputbox('CENTROIDE DE LA PRIMERA FIGURA','x1=','')); 
y1:= strtofloat(inputbox('CENTROIDE DE LA PRIMERA FIGURA','y1=','')); 
z1:= strtofloat(inputbox('CENTROIDE DE LA PRIMERA FIGURA','z1=','')); 
ax1:= a1*x1;  
ay1:= a1*y1; 
az1:= a1*z1;  
//figura 2  
a2:= strtofloat(inputbox('VALOR DE LA  AREA','A2=','')); 
x2:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','x2=','')); 
y2:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','y2=','')); 
z2:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','z2=','')); 
ax2:= a2*x2;  
ay2:= a2*y2; 
az2:= a2*z2;  
//figura3  
a3:= strtofloat(inputbox('VALOR DE LA  AREA','A3=','')); 
x3:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','x3=','')); 
y3:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','y3=','')); 
z3:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','z3=','')); 
ax3:= a*x3;  
ay3:= a3*y3; 
az3:= a3*z3;  
//figura 4  
a4:= strtofloat(inputbox('VALOR DE LA  AREA','A4=','')); 
x4:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','x4=','')); 
y4:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','y4=','')); 
z4:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','z4=','')); 
ax4:= a4*x4;  
ay4:= a4*y4; 
az4:= a4*z4;  
//figura5  
a5:= strtofloat(inputbox('VALOR DE LA  AREA','A5=','')); 
x5:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','x5=','')); 
y5:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','y5=','')); 
z5:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','z5=','')); 
ax5:= a5*x5;  
ay5:= a5*y5; 
az5:= a5*z5;  
//figura 6  
a6:= strtofloat(inputbox('VALOR DE LA  AREA','A6=','')); 
x6:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','x6=','')); 
y6:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','y6=','')); 
z6:= strtofloat(inputbox('CENTROIDE DE LA  FIGURA','z6=','')); 
ax6:= a6*x6;  
ay6:= a6*y6; 
az6:= a6*z6;  
areas:= a1+a2+a3+a4+a5+a6; 
xc:= (ax1+ax2+ax3+ax4+ax5+ax16)/areas; 
yc:= (ay1+ay2+ay3+ay4+ay5+ay6)/areas; 
zc:= (az1+az2+az3+az4+az5+az6)/areas;  
//salidas  
showmessage:=(' LA COORDENADA XC:='+ formatfloat('0.00',xc)); 
showmessage:=(' LA COORDENADA YC:='+ formatfloat('0.00',yc)); 
showmessage:=(' LA COORDENADA ZC:='+ formatfloat('0.00',zc));

Last edited by Casimiro Noteví : 02/03/2011 at 01:04. Reason: solucionar etiquetas delphi
Reply With Quote
  #2  
Old 06/03/2011
rastafarey's Avatar
rastafarey rastafarey is offline
Miembro
 
Join Date: Nov 2003
Posts: 927
Poder: 23
rastafarey Va por buen camino
Resp

Hermano ese es tu codigo.
Código Delphi [-]
procedure TForm7.Button1Click(Sender: TObject);
Type
  TNumeroAreas = 1..6;
  TArregloAreas = Array[TNumeroAreas] Of Real;
  TNumeroCoordenadas = 1..3;
  TArregloCoordenadas = Array[TNumeroCoordenadas] Of Real;
  TCoordenadas = Array[TNumeroAreas] Of TArregloCoordenadas;
Const
  __NORDINALES: Array[TNumeroAreas] Of String = ('PRIMERA', 'SEGUNDA', 'TERCERA', 'CUARTA', 'QUINTA', 'SEXTA');
Var
  Area: Real;
  Areas: TArregloAreas;
  CoordenadasXYZ, AX: TCoordenadas;
  CoordenadasC: TArregloCoordenadas;
  I: TNumeroAreas;
  J: TNumeroCoordenadas;
begin
  Area := 0;
  For J := Low(J) To High(J) Do
    CoordenadasC[J] := 0;
  For I := Low(I) To High(I) Do Begin
    Areas[i] := strtofloat(inputbox(Format('VALOR DE LA %s AREA', [__NORDINALES[i]]), Format('A%d=', [i]),''));
    Area := Area + Areas[i];
    For J := Low(J) To High(J) Do Begin
      CoordenadasXYZ[i][J] := strtofloat(inputbox(Format('CENTROIDE DE LA %s FIGURA', [__NORDINALES[i]]), Format('x%d=', [J]),''));
      AX[i][J] := Areas[i] * CoordenadasXYZ[i][J];
      CoordenadasC[J] := CoordenadasC[J] + AX[i][J];
    End;
  End;
  For J := Low(J) To High(J) Do
    CoordenadasC[J] := CoordenadasC[J] / Area;
  showmessage(' LA COORDENADA XC:='+ formatfloat('0.00', CoordenadasC[1]));
  showmessage(' LA COORDENADA YC:='+ formatfloat('0.00', CoordenadasC[2]));
  showmessage(' LA COORDENADA ZC:='+ formatfloat('0.00', CoordenadasC[3]));
end;
Ahora los del foro nos merecemos la explicacion de que es un centroide parq ue sirve y como nos puede ayudar y que uso tiene en lla actualidad.
__________________
Todo se puede, que no exista la tecnología aun, es otra cosa.
Reply With Quote
  #3  
Old 06/03/2011
rastafarey's Avatar
rastafarey rastafarey is offline
Miembro
 
Join Date: Nov 2003
Posts: 927
Poder: 23
rastafarey Va por buen camino
Resp

Una cosa mas te recomiendo que uses compoenetes pare lee los valores.

De igual forma para mostrar.
__________________
Todo se puede, que no exista la tecnología aun, es otra cosa.
Reply With Quote
  #4  
Old 08/03/2011
darnnezt darnnezt is offline
Miembro
 
Join Date: Jul 2010
Posts: 17
Poder: 0
darnnezt Va por buen camino
Smile

Muchas gracias hermano por la ayuda ya pude encontrar solucion, por otra parte Centroide o centro de gravedad, es aquella parte de un cuerpo plano o superficie de revolucion donde se concentrada la mayor cantidad de masa, que a su vez esa masa multiplicada por al gravedad se combierte en Newton y por ende es una fuerza dirijida hacia abajo saludos..

yo codifique de esta manera creo q es igual

Código Delphi [-]
procedure TForm1.BitBtn1Click(Sender: TObject);
var areas,A,xc,yc,zc,x1,y1,z1,x,y,z,x2,y2,z2:real;
 n,i: integer;
begin
//inicializacion
i:=0;
areas:=0;
x:=1; y:=1; z:=1; x2:=0; y2:=0; z2:=0;

//estrutucra

//cantida de figuras
N:= strtoint(inputbox('INGRESE LA CANTIDAD DE FIGURAS','F=',''));


while ido
begin
A:= strtofloat(inputbox('INGRESE EL AREA','A=',''));

x:= strtofloat(inputbox('INGRESE LA COODENADA DEL CENTROIDE','X=',''));
Y:= strtofloat(inputbox('INGRESE LA COODENADA DEL CENTROIDE','Y=',''));
Z:= strtofloat(inputbox('INGRESE LA COODENADA DEL CENTROIDE','Z=',''));
//sumadores
  if x <>0 then
x1:= x*A;
if y<>0 then
y1:=y*A;
if z<>0 then
z1:= z*A;

x2:= x2+x1;
y2:= y2+y1;
z2:= z2+z1;

areas:= areas+a;




I:= i+1;
  end;

xc:= x2/areas;
yc:= y2/areas;
zc:= z2/areas;

showmessage(' LA SUMA DE LAS AREAS ES: ' +  formatfloat('0.0000',areas));
SHOWMESSAGE(' COORDENADA DE CENTROIDE EN X=' + formatfloat('0.0000',xc));
SHOWMESSAGE(' COORDENADA DE CENTROIDE EN Y=' + formatfloat('0.0000',yc));
SHOWMESSAGE(' COORDENADA DE CENTROIDE EN Z=' + formatfloat('0.0000',zc));
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Codificacion seryo Varios 1 08/02/2010 20:55
Ayuda con esta codificacion seryo Varios 3 03/02/2010 13:28
codificacion en IE ebeltete Windows 3 27/02/2008 12:53
Codificacion ean 128 sur-se Varios 0 30/03/2007 11:54
Codificacion... chileno Varios 7 10/06/2006 20:47


All times are GMT +2. The time now is 02:16.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi