package packIntrospec;

/**
 * Mod&eacute;lise un point dans un espace tridimensionnel
 * @author Christian Mascart
 *
 */
public class Point3d
{
	private int x = 0;
	private int y = 0;
	private int z = 0;
	
	public Point3d ()
	{
		this.x = 0;
		this.y = 0;
		this.z = 0;
	}
	
	public Point3d (int pX, int pY, int pZ)
	{
		this.setX (pX);
		this.setY (pY);
		this.setZ (pZ);
	}
	
	public void positionner(int pX, int pY, int pZ)
	{
		this.setX(pX);
		this.setY(pY);
		this.setZ(pZ);
	}
	
	public void setX (int pVal)
	{
		this.x = pVal;
	}
	
	public void setY (int pVal)
	{
		this.y = pVal;
	}
	
	public void setZ (int pVal)
	{
		this.z = 0;
	}
	
	
	public int getX()
	{
		return (this.x);
	}
	
	public int getY()
	{
		return (this.y);
	}
	
	public int getZ()
	{
		return (this.z);
	}
	
	/**
	 * Pythagore
	 * @param autrePoint Autre point dont on veut calculer la distance
	 * @return Distance d'avec ce point.
	 */
	public double getDistance (Point3d autrePoint)
	{
		return(Math.sqrt(Math.pow(this.x - autrePoint.getX(), 2) + Math.pow(this.y - autrePoint.getY(), 2) ) + Math.pow(this.z - autrePoint.getZ(), 2) );
	}
}

