UnBalonFutbol_2011-I - omegacruzV=omega^V;

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//Tiro Parabolico por Euler #include <iostream> #include <cmath> #include "Vector.h" using namespace std; const double g=9.81; const double Deltat=0.01; const double Ca=0.5; //Coeficiente de arrastre const double rhoair=1.2; //Densidad del aire class Cuerpo{ private: vector3D r,V,omega,F,Fdrag,Fmagnus,Ftotal,omegacruzV; ; double Fx,Fy,m,R,A; public: void Inicie(double x0,double y0,double z0,double Vx0, double Vy0,double Vz0,double m0,double R0,double A0,double omegaz0); void CalculeFuerza(void); void Muevase(double dt); double Getx(void){return r.x();}; //Funcion inline double Gety(void){return r.y();}; //Funcion inline double Getz(void){return r.z();}; //Funcion inline }; void Cuerpo::Muevase(double dt){ r+=V*dt; V+=Ftotal/m*dt; //x+=Vx*dt; y+=Vy*dt; //Vx+=Fx/m*dt; Vy+=Fy/m*dt; } void Cuerpo::CalculeFuerza(void){ F[2]=-m*g; Fdrag[0]=-Ca*rhoair*A*0.5*V[0]*V[0]; Fdrag[2]=-Ca*rhoair*A*0.5*V[2]*V[2];
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: omegacruzV=omega^V; Fmagnus=Ca*rhoair*0.5*R*A*omegacruzV; Ftotal=Fdrag+F+Fmagnus; //Fx=0; Fy=-m*g; } void Cuerpo::Inicie(double x0,double y0,double z0,double Vx0, double Vy0,double Vz0,double m0,double R0,double A0,double omegaz0){ r.cargue(x0,y0,z0); V.cargue(Vx0,Vy0,Vz0); omega.cargue(0,0,omegaz0); omegacruzV.cargue(0,0,0); F.cargue(0,0,0); Fdrag.cargue(0,0,0); m=m0; R=R0; A=A0; } int main(){ Cuerpo Balon; double t,vo,theta; theta=M_PI/4; vo=10; //Velocidad inicial //---- Inicie(x0,y0,z0,Vx0,Vy0,Vz0,m0,R0,A0,omegaz0) //for(double i=0.5;i<vo+1;i=+0.5){ Balon.Inicie(0,0,0,vo*cos(theta),8*2*M_PI*0.11,vo*sin(theta),0.47,0.11,M_PI*0.11* 0.11,8*2*M_PI); for(t=0;t<1.51;t+=Deltat){ if(Balon.Gety()>=0) cout<<Balon.Getx()<<" "<<Balon.Gety()<<" "<<Balon.Getz()<<endl; //t=1.51; //} Balon.CalculeFuerza(); Balon.Muevase(Deltat); //} } return 0; }...
View Full Document

This note was uploaded on 08/21/2011 for the course PHYS 101 taught by Professor Daniel during the Spring '11 term at Universidad Nacional de Colombia.

Page1 / 2

UnBalonFutbol_2011-I - omegacruzV=omega^V;

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online