BlueCone.java


Below is the syntax highlighted version of BlueCone.java from § Standard Draw 3D.


/******************************************************************************
 *  Compilation:  javac BlueCone.java
 *  Execution:    java BlueCone
 *
 * Draws a blue cone of radius 0.5 and height 1 at the location
 * (0, 0, 0) on an orange background.
 * 
 * Keywords: Cone, Background
 ******************************************************************************/

public class BlueCone {
    public static void main(String[] args) {
        
        // Sets the scale of the drawing window
        StdDraw3D.setScale(-1, 1);
        
        // Sets the background color to orange
        StdDraw3D.clear(StdDraw3D.ORANGE);
        
        // Defines the dimensions of the cone
        double radius = 0.5;
        double height = 1;
        
        // Draws a blue cone
        StdDraw3D.setPenColor(StdDraw3D.BLUE);
        StdDraw3D.cone(0, 0, 0, radius, height);
        
        // Renders the 3D scene
        StdDraw3D.finished();
    }
}


Copyright © 2000–2011, Robert Sedgewick and Kevin Wayne.
Last updated: Thu Aug 25 14:46:50 EDT 2016.