/****************************************************************************** * Compilation: javac RotationTest.java * Execution: java RotationTest * * Draws a cone inside a wireframe sphere, and animates them rotating * in different directions. * * Keywords: Cone, Sphere, Wireframe, Rotation ******************************************************************************/ public class RotationTest { public static void main(String[] args) { // Sets the scale StdDraw3D.setScale(-1, 1); // Initializes the angles of rotation double cone_xA = 0; double sphere_yA = 0; while (true) { StdDraw3D.clear(StdDraw3D.WHITE); // Draws a wireframe sphere rotated along the y-axis StdDraw3D.setPenColor(StdDraw3D.BLUE); StdDraw3D.wireSphere(0, 0, 0, 1.0, 0, sphere_yA, 0); // Draws a translucent cone rotated along the x-axis StdDraw3D.setPenColor(StdDraw3D.RED, 100); StdDraw3D.cone(0, 0, 0, .5, 1, cone_xA, 0, 0); // Increments the rotation angles. sphere_yA += 0.4; cone_xA += 0.2; StdDraw3D.show(30); } } }