package packIntrospec;
import java.awt.Color;

/**
 * Mod&eacute;lise une sph&egrave;re dont le centre est un Point3D
 * @author Christian Mascart
 *
 */
@Marque(annee = 2013, message = "Une boule")
public class Sphere extends Point3d
{
	int rayon = 10;
	Color couleur = Color.red;
	
	public Sphere()
	{
		super(0, 0, 0);
	}
	
	public Sphere(int pX, int pY, int pZ, int pRayon)
	{
		super(pX, pY, pZ);
		this.setRayon(pRayon);
	}
	
	public Sphere(int pX, int pY, int pZ, int pRayon, Color pCouleur)
	{
		this(pX, pY, pZ, pRayon);
		this.setCouleur(pCouleur);
	}
	
	/**
	 * Ajoste le rayon
	 * @param pRayon Rayon donn&eacute; &agrave; la sph&egrave;re, jamais n&eacute;gatif.
	 */
	public void setRayon(int pRayon)
	{
		this.rayon = Math.max(0, pRayon);
	}
	
	public int getRayon()
	{
		return (this.rayon);
	}
	
	public void setCouleur (Color pCoul)
	{
		this.couleur = pCoul;
	}
	
	public final Color getCouleur ()
	{
		return (this.couleur);
	}
	
	public double getVolume()
	{
		return(Math.pow(this.rayon, 3) * Math.PI * 4.0d / 3.0d);
	}
}
