/****************************************************************************** * Compilation: javac CameraTest.java * Execution: java CameraTest * * Draws some basic shapes and sets a custom camera viewpoint. * * Keywords: Camera, Basic Shapes ******************************************************************************/ public class CameraTest { public static void main(String[] args) { // Sets the viewing scale StdDraw3D.setScale(-1, 1); // Draws a red translucent cone StdDraw3D.setPenColor(StdDraw3D.RED, 100); StdDraw3D.cone(0, 0.3, 0, .5, 1); // Draws a blue cylinder StdDraw3D.setPenColor(StdDraw3D.BLUE); StdDraw3D.cylinder(0, 0, 0, 0.3, 0.8); // Draws four yellow cubes StdDraw3D.setPenColor(StdDraw3D.YELLOW); StdDraw3D.cube(+0.2, 0.5, +0.2, 0.1); StdDraw3D.cube(-0.2, 0.5, +0.2, 0.1); StdDraw3D.cube(+0.2, 0.5, -0.2, 0.1); StdDraw3D.cube(-0.2, 0.5, -0.2, 0.1); // Sets the camera viewpoint StdDraw3D.setCameraPosition(-0.52, 1.12, 0.92); StdDraw3D.setCameraOrientation(311, 356, 26); // Renders the 3D scene StdDraw3D.finished(); } }