//import nokta3D;

public class dogru3D
{
public nokta3D P0,P1;
double xi,xj,xk;

//*** kurucu metodlar dogru3D ***

public dogru3D()
{
P0=new nokta3D();
P1=new nokta3D();
xi=0;
xj=0;
xk=0;
}

public dogru3D(double yi0,double yj0,double yk0,double yi1,double yj1,double yk1)
{
P0=new nokta3D(yi0,yj0,yk0);
P1=new nokta3D(yi1,yj1,yk1);
nokta3D P=new nokta3D(P0);
P.fark(P1);
xi=P.xiOku();
xj=P.xjOku();
xk=P.xkOku();
}

public dogru3D(nokta3D y0,nokta3D y1)
{
P0=new nokta3D(y0);
P1=new nokta3D(y1);
nokta3D P=new nokta3D(P0);
P.fark(P1);
xi=P.xiOku();
xj=P.xjOku();
xk=P.xkOku();
}

//***** 


public void P0Gir(double yi,double yj,double yk)
{
P0.noktaGir(yi,yj,yk);
}

public void P0Gir(nokta3D y)
{
P0.noktaGir(y);
}

public void P1Gir(double yi,double yj,double yk)
{
P1.noktaGir(yi,yj,yk);
}

public void P1Gir(nokta3D y)
{
P1.noktaGir(y);
}

//***** 

public double xiOku(int i)
{
if(i==0) return P0.xiOku();
else     return P1.xiOku(); 
}

public double xjOku(int i)
{
if(i==0) return P0.xjOku();
else     return P1.xjOku(); 
}

public double xkOku(int i)
{
if(i==0) return P0.xkOku();
else     return P1.xkOku(); 
}

public double xiOku()
{
return xi;
}

public double xjOku()
{
return xj; 
}

public double xkOku()
{
return xk; 
}
//****sınıf islem metodları

public double R()
{
//iki nokta arasındaki mesafe
return Math.sqrt(xi*xi+xj*xj+xk*xk);
}

public double cosai()
{
//i cos 
return xi/R();
}

public double cosaj()
{
//j cos
return xj/R();
}

public double cosak()
{
//k cos 
return xk/R();
}

//*****sınıf mantıksal karşılaştırma öetodları

public boolean esittir(dogru3D v)
{
boolean b=((xi==v.xi)&&(xj==v.xj)&&(xk==v.xk));
return b;
}

public boolean buyuktur(dogru3D v)
{
  return (this.R()>v.R());
}

public boolean kucuktur(dogru3D v)
{
  return (this.R()<v.R());
}

//****** sınıf string çıktısı metodu toString
public String toString()
{
 String s="P0 = "+P0.toString()+"\n";
 s=s+"P1 = "+P1.toString()+"\n";
 s=s+""+xi+" i + "+xj+" j + "+xk+" k";
 return s;
}

}
