예제 #1
0
/**
* Calcula los coeficientes de las pendientes k1, k2, k3 y k4
*/
void calK(double t, double x, double y, double z, double h, double *k1, double *k2, double *k3, double *k4)
{
	k1[0] = functionX(t,x,y,z);
	k1[1] = functionY(t,x,y,z);
	k1[2] = functionZ(t,x,y,z);

	k2[0] = functionX(t+h/2,x+k1[0]*h/2,y+k1[1]*h/2,z+k1[2]*h/2);
	k2[1] = functionY(t+h/2,x+k1[0]*h/2,y+k1[1]*h/2,z+k1[2]*h/2);
	k2[2] = functionZ(t+h/2,x+k1[0]*h/2,y+k1[1]*h/2,z+k1[2]*h/2);

	k3[0] = functionX(t+h/2,x+k2[0]*h/2,y+k2[1]*h/2,z+k2[2]*h/2);
	k3[1] = functionY(t+h/2,x+k2[0]*h/2,y+k2[1]*h/2,z+k2[2]*h/2);
	k3[2] = functionZ(t+h/2,x+k2[0]*h/2,y+k2[1]*h/2,z+k2[2]*h/2);

	k4[0] = functionX(t+h/2,x+k3[0]*h,y+k3[1]*h,z+k3[2]*h);
	k4[1] = functionY(t+h/2,x+k3[0]*h,y+k3[1]*h,z+k3[2]*h);
	k4[2] = functionZ(t+h/2,x+k3[0]*h,y+k3[1]*h,z+k3[2]*h);
}
예제 #2
0
//-------------------------------------------------------------------------
PV3D* MontanaRusa::function(GLfloat t){
        GLfloat x= functionX(t);
		GLfloat y= functionY(t);
        GLfloat z= functionZ(t);
        return new PV3D(x,y,z);
}