package T3dobject; import java.awt.*; public class T3DSphere extends T3DPoint{ int size; public T3DSphere(){ super(); } public T3DSphere (double x, double y, double z, int size, int MAX_Z){ super(x, y, z, MAX_Z); this.size = size; } public T3DSphere(double x, double y, double z, int size, int MAX_Z, Color color, boolean correction){ super(x, y, z, MAX_Z, color, correction); this.size = size; } public void paint(Graphics g, int cx, int cy){ g.setColor(color); g.fillOval(cx+(int)getCorrectionX()-(getCorrectionSize()/2), cy+(int)getCorrectionY()-(getCorrectionSize()/2), getCorrectionSize(), getCorrectionSize()); //System.out.println(x + " : " + y+ " : " + z); } protected int getCorrectionSize(){ if (z >= MAX_Z) return size*2; else if (z <= -MAX_Z) return 1; else return (int)((1-(-z/MAX_Z))*size); } }