class pro{
double[] x=new double[6];
double[] y=new double[6];
public static void main(String args[]){
pro test=new pro();
}
pro(){
x[1]=3;
x[2]=1;
x[3]=7;
x[4]=4;
x[5]=8;
y[1]=7;
y[2]=3;
y[3]=6;
y[4]=1;
y[5]=2;
System.out.println(tr(1,2,4));
System.out.println(tr(1,4,5));
System.out.println(tr(1,3,5));
}
double tr(int m1,int m2,int m3){
double trx,tx3,tx2,ty3,ty2;
tx2=x[m2]-x[m1];
tx3=x[m3]-x[m1];
ty2=y[m2]-y[m1];
ty3=y[m3]-y[m1];
trx=tx2*ty3-tx3*ty2;
trx=(double)trx/2;
if(trx<0)trx=-trx;
return trx;
}
}
最終更新:2011年06月09日 22:32