package nl.tudelft.simulation.examples.dsol.animation; import java.rmi.RemoteException; import javax.media.j3d.BoundingSphere; import javax.media.j3d.Bounds; import javax.vecmath.Point3d; import nl.tudelft.simulation.dsol.animation.Locatable; /** * A Ball
* (c) copyright 2003 Delft University of Technology , the Netherlands. *
* See for project information www.simulation.tudelft.nl
* License of use: General Public License (GPL) , no warranty
* @version 1.0 Mar 3, 2004
* @author Peter Jacobs */ public abstract class Ball implements Locatable { /** the number of created balls. */ private static int number = 0; /** the radius of the ball. */ public static final double RADIUS = 5.0; /** the angle of the ball. */ protected double theta = 0.0; /** the name of the ball. */ private String name = ""; /** * constructs a new Ball. */ public Ball() { super(); this.theta = 2 * Math.PI * Math.random(); Ball.number++; this.name = "" + Ball.number; } /** {@inheritDoc} */ @Override public Bounds getBounds() throws RemoteException { return new BoundingSphere(new Point3d(0, 0, 0), Ball.RADIUS); } /** {@inheritDoc} */ @Override public String toString() { return this.name; } }