package nObjectProblem2;
public class Planet {
double a,m,r,thi,phi;
public double l[]=new double[3];
public double w[]=new double[3];
public double o[]=new double[3];
public double i[]=new double[2];
public double e[]=new double[2];
public double p[]=new double[3];
public double[] nowposv(double now) {
double d=now-2451545;
double t=d/36525;//TODO
double pk[]=new double[3];
double ls=this.l[0]+this.l[1]*d+this.l[2]*t*t;
double ws=this.w[0]+this.w[1]*t+this.w[2]*t*t;
double os=this.o[0]+this.o[1]*t+this.o[2]*t*t;
double is=this.i[0]+this.i[1]*t;
double es=this.e[0]+this.e[1]*t;
double q=this.a*(1-es);
if(os<0){
while(true){
os=os+360;
if(os>0){
break;
}
}
}else{
while(true){
os=os-360;
if(os-360<0){
break;
}
}
}
if(ls+os<0){
while(true){
ls=ls+360;
if(ls+os>0){
break;
}
}
}else{
while(true){
ls=ls-360;
if(ls+os-360<0){
break;
}
}
}
if(es!=0){
r=q*(1+1/es)/(Math.cos(Math.toRadians(ls))+1/es);
}else{r=0;}
thi=Math.toDegrees(Math.asin(Math.cos(Math.toRadians(ls-90))*Math.sin(Math.toRadians(is))));//TODO 要修正
phi=ls+os;//TODO 要修正
pk[0]=r*Math.cos(Math.toRadians(thi))*Math.cos(Math.toRadians(phi));
pk[1]=r*Math.cos(Math.toRadians(thi))*Math.sin(Math.toRadians(phi));
pk[2]=r*Math.sin(Math.toRadians(thi));
return pk;
}
}
最終更新:2009年01月10日 23:07