public final class StdDraw3D extends Object implements MouseListener, MouseMotionListener, MouseWheelListener, KeyListener, ActionListener, ChangeListener, ComponentListener, WindowFocusListener
Modifier and Type | Class and Description |
---|---|
static class |
StdDraw3D.Camera
The camera can be controlled with the static functions already listed in
this reference.
|
static class |
StdDraw3D.Light
When you create a light in StdDraw3D, it returns a Light object.
|
static class |
StdDraw3D.Shape
Everything three-dimensional you draw in your scene from spheres to
points to 3D text is actually a Shape object.
|
static class |
StdDraw3D.Vector3D
An immutable three-dimensional vector class with useful vector operations.
|
Modifier and Type | Field and Description |
---|---|
static int |
AIRPLANE_MODE |
static Color |
BLACK |
static Color |
BLUE |
static Color |
CYAN |
static Color |
DARK_GRAY |
static int |
FIXED_MODE |
static int |
FPS_MODE |
static Color |
GRAY |
static Color |
GREEN |
static int |
IMMERSIVE_MODE |
static Color |
LIGHT_GRAY |
static int |
LOOK_MODE |
static Color |
MAGENTA |
static Color |
ORANGE |
static int |
ORBIT_MODE |
static Color |
PINK |
static Color |
RED |
static Color |
WHITE |
static Color |
YELLOW |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e)
Deprecated.
|
static void |
addFog(Color col,
double frontDistance,
double backDistance) |
static StdDraw3D.Light |
ambientLight(Color col)
Adds ambient light of color col.
|
static StdDraw3D.Shape |
box(double x,
double y,
double z,
double w,
double h,
double d)
Draws a box at (x, y, z) with dimensions (w, h, d).
|
static StdDraw3D.Shape |
box(double x,
double y,
double z,
double w,
double h,
double d,
double xA,
double yA,
double zA)
Draws a box at (x, y, z) with dimensions (w, h, d) and axial rotations (xA, yA, zA).
|
static StdDraw3D.Shape |
box(double x,
double y,
double z,
double w,
double h,
double d,
double xA,
double yA,
double zA,
String imageURL)
Draws a box at (x, y, z) with dimensions (w, h, d), axial rotations (xA, yA, zA), and a texture from imageURL.
|
static StdDraw3D.Shape |
box(double x,
double y,
double z,
double w,
double h,
double d,
String imageURL)
Draws a box at (x, y, z) with dimensions (w, h, d) and a texture from imageURL.
|
static StdDraw3D.Camera |
camera()
Returns the Camera object.
|
static void |
clear()
Clears the entire on the next call of show().
|
static void |
clear(Color color) |
static void |
clear3D()
Clears the 3D world on the screen for the next call of show();
|
static void |
clearFog() |
static void |
clearLight()
Removes all current lighting from the scene.
|
static void |
clearOverlay()
Clears the 2D overlay for the next call of show();
|
static void |
clearSound() |
static StdDraw3D.Shape |
coloredModel(String filename) |
static StdDraw3D.Shape |
coloredModel(String filename,
boolean resize) |
static StdDraw3D.Shape |
combine(StdDraw3D.Shape... shapes)
Combines any number of shapes into one shape and returns it.
|
void |
componentHidden(ComponentEvent e)
Deprecated.
|
void |
componentMoved(ComponentEvent e)
Deprecated.
|
void |
componentResized(ComponentEvent e)
Deprecated.
|
void |
componentShown(ComponentEvent e)
Deprecated.
|
static StdDraw3D.Shape |
cone(double x,
double y,
double z,
double r,
double h)
Draws a cone at (x, y, z) with radius r and height h.
|
static StdDraw3D.Shape |
cone(double x,
double y,
double z,
double r,
double h,
double xA,
double yA,
double zA)
Draws a cone at (x, y, z) with radius r, height h, and axial rotations (xA, yA, zA).
|
static StdDraw3D.Shape |
cone(double x,
double y,
double z,
double r,
double h,
double xA,
double yA,
double zA,
String imageURL)
Draws a cone at (x, y, z) with radius r, height h, axial rotations (xA, yA, zA), and a texture from imageURL.
|
static StdDraw3D.Shape |
cone(double x,
double y,
double z,
double r,
double h,
String imageURL)
Draws a cone at (x, y, z) with radius r, height h, and a texture from imageURL.
|
static StdDraw3D.Shape |
copy(StdDraw3D.Shape shape)
Returns an identical copy of a Shape that can be controlled independently.
|
static StdDraw3D.Shape |
cube(double x,
double y,
double z,
double r)
Draws a cube at (x, y, z) with radius r.
|
static StdDraw3D.Shape |
cube(double x,
double y,
double z,
double r,
double xA,
double yA,
double zA)
Draws a cube at (x, y, z) with radius r and axial rotations (xA, yA, zA).
|
static StdDraw3D.Shape |
cube(double x,
double y,
double z,
double r,
double xA,
double yA,
double zA,
String imageURL)
Draws a cube at (x, y, z) with radius r, axial rotations (xA, yA, zA), and a texture from imageURL.
|
static StdDraw3D.Shape |
cube(double x,
double y,
double z,
double r,
String imageURL)
Draws a cube at (x, y, z) with radius r and a texture from imageURL.
|
static StdDraw3D.Shape |
cylinder(double x,
double y,
double z,
double r,
double h)
Draws a cylinder at (x, y, z) with radius r and height h.
|
static StdDraw3D.Shape |
cylinder(double x,
double y,
double z,
double r,
double h,
double xA,
double yA,
double zA)
Draws a cylinder at (x, y, z) with radius r, height h, and axial rotations (xA, yA, zA).
|
static StdDraw3D.Shape |
cylinder(double x,
double y,
double z,
double r,
double h,
double xA,
double yA,
double zA,
String imageURL)
Draws a cylinder at (x, y, z) with radius r, height h, axial rotations (xA, yA, zA), and a texture from imageURL.
|
static StdDraw3D.Shape |
cylinder(double x,
double y,
double z,
double r,
double h,
String imageURL)
Draws a cylinder at (x, y, z) with radius r, height h, and a texture from imageURL.
|
static StdDraw3D.Light |
directionalLight(double x,
double y,
double z,
Color col)
Adds a directional light of color col which shines in the direction vector (x, y, z)
|
static StdDraw3D.Light |
directionalLight(StdDraw3D.Vector3D dir,
Color col)
Adds a directional light of color col which appears to come from (x, y, z).
|
static StdDraw3D.Shape |
ellipsoid(double x,
double y,
double z,
double w,
double h,
double d)
Draws an ellipsoid at (x, y, z) with dimensions (w, h, d).
|
static StdDraw3D.Shape |
ellipsoid(double x,
double y,
double z,
double w,
double h,
double d,
double xA,
double yA,
double zA)
Draws an ellipsoid at (x, y, z) with dimensions (w, h, d) and axial rotations (xA, yA, zA).
|
static StdDraw3D.Shape |
ellipsoid(double x,
double y,
double z,
double w,
double h,
double d,
double xA,
double yA,
double zA,
String imageURL)
Draws an ellipsoid at (x, y, z) with dimensions (w, h, d), axial rotations (xA, yA, zA), and a texture from imageURL.
|
static StdDraw3D.Shape |
ellipsoid(double x,
double y,
double z,
double w,
double h,
double d,
String imageURL)
Draws an ellipsoid at (x, y, z) with dimensions (w, h, d) and a texture from imageURL.
|
static void |
finished()
Allows for camera navigation of a scene without redrawing.
|
static void |
fullscreen() |
static boolean |
getAntiAliasing()
Returns true if anti-aliasing is enabled.
|
static StdDraw3D.Vector3D |
getCameraDirection() |
static int |
getCameraMode()
Gets the current camera mode.
|
static StdDraw3D.Vector3D |
getCameraOrientation() |
static StdDraw3D.Vector3D |
getCameraPosition() |
static Font |
getFont()
Gets the current drawing Font.
|
static int |
getNumDivisions()
Gets the number of triangular divisons of curved objects.
|
static StdDraw3D.Vector3D |
getOrbitCenter() |
static Color |
getPenColor()
Returns the current pen color.
|
static float |
getPenRadius()
Gets the current pen radius.
|
static boolean |
hasNextKeyTyped()
Has the user typed a key?
|
static boolean |
isKeyPressed(int key)
Is the given key currently pressed down? The keys correnspond
to physical keys, not characters.
|
void |
keyPressed(KeyEvent e)
Deprecated.
|
void |
keyReleased(KeyEvent e)
Deprecated.
|
void |
keyTyped(KeyEvent e)
Deprecated.
|
static StdDraw3D.Shape |
line(double x1,
double y1,
double z1,
double x2,
double y2,
double z2)
Draws a single line from (x1, y1, z1) to (x2, y2, z2).
|
static StdDraw3D.Shape |
lines(double[] x,
double[] y,
double[] z)
Draws a set of connected lines.
|
static StdDraw3D.Shape |
lines(double[] x,
double[] y,
double[] z,
Color[] colors)
Draws a set of connected lines.
|
static void |
loadScene3D(String filename) |
static void |
main(String[] args) |
static StdDraw3D.Shape |
model(String filename) |
static StdDraw3D.Shape |
model(String filename,
boolean resize) |
static boolean |
mouse1Pressed()
Is the mouse1 button pressed down?
|
static boolean |
mouse2Pressed()
Is the mouse2 button pressed down?
|
static boolean |
mouse3Pressed()
Is the mouse3 button pressed down?
|
void |
mouseClicked(MouseEvent e)
Deprecated.
|
void |
mouseDragged(MouseEvent e)
Deprecated.
|
void |
mouseEntered(MouseEvent e)
Deprecated.
|
void |
mouseExited(MouseEvent e)
Deprecated.
|
void |
mouseMoved(MouseEvent e)
Deprecated.
|
static boolean |
mousePressed()
Is any mouse button pressed?
|
void |
mousePressed(MouseEvent e)
Deprecated.
|
void |
mouseReleased(MouseEvent e)
Deprecated.
|
void |
mouseWheelMoved(MouseWheelEvent e)
Deprecated.
|
static double |
mouseX()
Where is the mouse?
|
static double |
mouseY()
Where is the mouse?
|
static char |
nextKeyTyped()
What is the next key that was typed by the user?
|
static void |
overlayArc(double x,
double y,
double r,
double angle1,
double angle2)
Draws an arc of radius r, centered on (x, y), from angle1 to angle2 (in degrees).
|
static void |
overlayCircle(double x,
double y,
double r)
Draws a circle of radius r, centered on (x, y).
|
static void |
overlayEllipse(double x,
double y,
double semiMajorAxis,
double semiMinorAxis)
Draws an ellipse with given semimajor and semiminor axes, centered on (x, y).
|
static void |
overlayFilledCircle(double x,
double y,
double r)
Draws a filled circle of radius r, centered on (x, y).
|
static void |
overlayFilledEllipse(double x,
double y,
double semiMajorAxis,
double semiMinorAxis)
Draws a filled ellipse with given semimajor and semiminor axes, centered on (x, y).
|
static void |
overlayFilledPolygon(double[] x,
double[] y)
Draws a filled polygon with the given (x[i], y[i]) coordinates.
|
static void |
overlayFilledRectangle(double x,
double y,
double halfWidth,
double halfHeight)
Draws a filled rectangle of given half width and half height, centered on (x, y).
|
static void |
overlayFilledSquare(double x,
double y,
double r)
Draws a filled square of side length 2r, centered on (x, y).
|
static void |
overlayLine(double x0,
double y0,
double x1,
double y1)
Draws a line from (x0, y0) to (x1, y1).
|
static void |
overlayPicture(double x,
double y,
String s)
Draws a picture (gif, jpg, or png) centered on (x, y).
|
static void |
overlayPicture(double x,
double y,
String s,
double degrees)
Draws a picture (gif, jpg, or png) centered on (x, y),
rotated given number of degrees.
|
static void |
overlayPicture(double x,
double y,
String s,
double w,
double h)
Draw picture (gif, jpg, or png) centered on (x, y), rescaled to w-by-h.
|
static void |
overlayPicture(double x,
double y,
String s,
double w,
double h,
double degrees)
Draw picture (gif, jpg, or png) centered on (x, y), rotated
given number of degrees, rescaled to w-by-h.
|
static void |
overlayPixel(double x,
double y)
Draws one pixel at (x, y).
|
static void |
overlayPoint(double x,
double y)
Draws a point at (x, y).
|
static void |
overlayPolygon(double[] x,
double[] y)
Draws a polygon with the given (x[i], y[i]) coordinates.
|
static void |
overlayRectangle(double x,
double y,
double halfWidth,
double halfHeight)
Draws a rectangle of given half width and half height, centered on (x, y).
|
static void |
overlaySquare(double x,
double y,
double r)
Draws a square of side length 2r, centered on (x, y).
|
static void |
overlayText(double x,
double y,
String text)
Draws the given text as stationary on the window at (x, y).
|
static void |
overlayText(double x,
double y,
String text,
double degrees)
Writes the given text string in the current font, centered on (x, y) and
rotated by the specified number of degrees.
|
static void |
overlayTextLeft(double x,
double y,
String text)
Write the given text string in the current font, left-aligned at (x, y).
|
static void |
overlayTextRight(double x,
double y,
String text)
Write the given text string in the current font, right-aligned at (x, y).
|
static void |
pause(int time)
Pauses for a given amount of milliseconds.
|
static void |
playAmbientSound(String filename) |
static void |
playAmbientSound(String filename,
boolean loop) |
static StdDraw3D.Shape |
point(double x,
double y,
double z)
Draws a single point at (x, y, z).
|
static StdDraw3D.Light |
pointLight(double x,
double y,
double z,
Color col) |
static StdDraw3D.Light |
pointLight(double x,
double y,
double z,
Color col,
double power) |
static StdDraw3D.Light |
pointLight(StdDraw3D.Vector3D origin,
Color col) |
static StdDraw3D.Light |
pointLight(StdDraw3D.Vector3D origin,
Color col,
double power) |
static StdDraw3D.Shape |
points(double[] x,
double[] y,
double[] z)
Draws a set of points at the given coordinates.
|
static StdDraw3D.Shape |
points(double[] x,
double[] y,
double[] z,
Color[] colors)
Draws a set of points at the given coordinates with the given colors.
|
static StdDraw3D.Shape |
polygon(double[] x,
double[] y,
double[] z)
Draws a filled polygon with the given vertices.
|
static Color |
randomColor()
Returns a randomly generated color.
|
static StdDraw3D.Vector3D |
randomDirection()
Returns a randomly generated normalized Vector3D.
|
static Color |
randomRainbowColor()
Returns a randomly generated color on the rainbow.
|
static void |
save(String filename)
Saves to file - suffix must be png, jpg, or gif.
|
static void |
saveScene3D(String filename) |
static void |
setAntiAliasing(boolean enabled)
Sets anti-aliasing on or off.
|
static void |
setBackground(Color color)
Sets the background color to the given color.
|
static void |
setBackground(String imageURL)
Sets the background image to the given filename, scaled to fit the window.
|
static void |
setBackgroundSphere(String imageURL)
Sets the background to the given image file.
|
static void |
setCamera(double x,
double y,
double z,
double xAngle,
double yAngle,
double zAngle) |
static void |
setCamera(StdDraw3D.Vector3D position,
StdDraw3D.Vector3D angles) |
static void |
setCameraDirection(double x,
double y,
double z) |
static void |
setCameraDirection(StdDraw3D.Vector3D direction) |
static void |
setCameraMode()
Sets the default camera mode.
|
static void |
setCameraMode(int mode)
Sets the current camera mode.
|
static void |
setCameraOrientation(double xAngle,
double yAngle,
double zAngle) |
static void |
setCameraOrientation(StdDraw3D.Vector3D angles) |
static void |
setCameraPosition(double x,
double y,
double z) |
static void |
setCameraPosition(StdDraw3D.Vector3D position) |
static void |
setCanvasSize(int w,
int h)
Sets the window size to w-by-h pixels.
|
static void |
setDefaultLight()
Adds the default lighting to the scene, called automatically at startup.
|
static void |
setFont()
Sets the default font.
|
static void |
setFont(Font f)
Sets the font to draw text with.
|
static void |
setInfoDisplay(boolean enabled) |
static void |
setNumDivisions(int N)
Sets the number of triangular divisons of curved objects.
|
static void |
setOrbitCenter(double x,
double y,
double z)
Sets the center of rotation for the camera mode ORBIT_MODE.
|
static void |
setOrbitCenter(StdDraw3D.Vector3D v)
Sets the center of rotation for the camera mode ORBIT_MODE.
|
static void |
setParallelProjection()
Sets the projection mode to orthographic projection.
|
static void |
setPenColor()
Sets the pen color to the default.
|
static void |
setPenColor(Color col)
Sets the pen color to the given color.
|
static void |
setPenColor(Color col,
int alpha)
Sets the pen color to the given color and transparency.
|
static void |
setPenColor(int r,
int g,
int b) |
static void |
setPenRadius()
Sets the pen radius to the default value.
|
static void |
setPenRadius(double r)
Sets the pen radius to the given value.
|
static void |
setPerspectiveProjection()
Sets the projection mode to perspective projection with a
default field of view.
|
static void |
setPerspectiveProjection(double fov)
Sets the projection mode to perspective projection with the
given field of view.
|
static void |
setScale()
Sets the default scale for all three dimensions.
|
static void |
setScale(double minimum,
double maximum)
Sets the scale for all three dimensions.
|
static void |
show()
Renders to the screen, but does not pause.
|
static void |
show(int time)
Renders drawn 3D objects to the screen and draws the
2D overlay, then pauses for the given time.
|
static void |
show3D() |
static void |
show3D(int time)
Renders the drawn 3D objects to the screen, but not the overlay.
|
static void |
showOverlay() |
static void |
showOverlay(int time)
Displays the drawn overlay onto the screen.
|
static StdDraw3D.Shape |
sphere(double x,
double y,
double z,
double r)
Draws a sphere at (x, y, z) with radius r.
|
static StdDraw3D.Shape |
sphere(double x,
double y,
double z,
double r,
double xA,
double yA,
double zA)
Draws a sphere at (x, y, z) with radius r and axial rotations (xA, yA, zA).
|
static StdDraw3D.Shape |
sphere(double x,
double y,
double z,
double r,
double xA,
double yA,
double zA,
String imageURL)
Draws a sphere at (x, y, z) with radius r, axial rotations (xA, yA, zA), and a texture from imageURL.
|
static StdDraw3D.Shape |
sphere(double x,
double y,
double z,
double r,
String imageURL)
Draws a sphere at (x, y, z) with radius r and a texture from imageURL.
|
void |
stateChanged(ChangeEvent e) |
static StdDraw3D.Shape |
text3D(double x,
double y,
double z,
String text)
Draws a 3D text object at (x, y, z).
|
static StdDraw3D.Shape |
text3D(double x,
double y,
double z,
String text,
double xA,
double yA,
double zA)
Draws a 3D text object at (x, y, z) with Euler rotation angles (xA, yA, zA).
|
static StdDraw3D.Shape |
triangles(double[][] points)
Draws triangles which are defined by x1=points[i][0], y1=points[i][1], z1=points[i][2], x2=points[i][3], etc.
|
static StdDraw3D.Shape |
triangles(double[][] points,
Color[] colors)
Draws a set of triangles, each with the specified color.
|
static StdDraw3D.Shape |
tube(double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
double r)
Draws a cylindrical tube of radius r from vertex (x1, y1, z1) to vertex (x2, y2, z2).
|
static StdDraw3D.Shape |
tubes(double[] x,
double[] y,
double[] z,
double r)
Draws a series of cylindrical tubes of radius r, with vertices (x, y, z).
|
static StdDraw3D.Shape |
tubes(double[] x,
double[] y,
double[] z,
double r,
Color[] colors)
Draws a series of cylindrical tubes of radius r, with vertices (x, y, z) and the given colors.
|
void |
windowGainedFocus(WindowEvent e)
Deprecated.
|
void |
windowLostFocus(WindowEvent e)
Deprecated.
|
static StdDraw3D.Shape |
wireBox(double x,
double y,
double z,
double w,
double h,
double d)
Draws a wireframe box at (x, y, z) with dimensions (w, h, d).
|
static StdDraw3D.Shape |
wireBox(double x,
double y,
double z,
double w,
double h,
double d,
double xA,
double yA,
double zA)
Draws a wireframe box at (x, y, z) with dimensions (w, h, d) and axial rotations (xA, yA, zA).
|
static StdDraw3D.Shape |
wireCone(double x,
double y,
double z,
double r,
double h)
Draws a wireframe cone at (x, y, z) with radius r and height h.
|
static StdDraw3D.Shape |
wireCone(double x,
double y,
double z,
double r,
double h,
double xA,
double yA,
double zA)
Draws a wireframe cone at (x, y, z) with radius r, height h, and axial rotations (xA, yA, zA).
|
static StdDraw3D.Shape |
wireCube(double x,
double y,
double z,
double r)
Draws a wireframe cube at (x, y, z) with radius r.
|
static StdDraw3D.Shape |
wireCube(double x,
double y,
double z,
double r,
double xA,
double yA,
double zA)
Draws a wireframe cube at (x, y, z) with radius r and axial rotations (xA, yA, zA).
|
static StdDraw3D.Shape |
wireCylinder(double x,
double y,
double z,
double r,
double h)
Draws a wireframe cylinder at (x, y, z) with radius r and height h.
|
static StdDraw3D.Shape |
wireCylinder(double x,
double y,
double z,
double r,
double h,
double xA,
double yA,
double zA)
Draws a wireframe cylinder at (x, y, z) with radius r, height h, and axial rotations (xA, yA, zA).
|
static StdDraw3D.Shape |
wireEllipsoid(double x,
double y,
double z,
double w,
double h,
double d)
Draws a wireframe ellipsoid at (x, y, z) with dimensions (w, h, d).
|
static StdDraw3D.Shape |
wireEllipsoid(double x,
double y,
double z,
double w,
double h,
double d,
double xA,
double yA,
double zA)
Draws a wireframe ellipsoid at (x, y, z) with dimensions (w, h, d) and axial rotations (xA, yA, zA).
|
static StdDraw3D.Shape |
wirePolygon(double[] x,
double[] y,
double[] z)
Draws the triangulated outline of a polygon with the given vertices.
|
static StdDraw3D.Shape |
wireSphere(double x,
double y,
double z,
double r)
Draws a wireframe sphere at (x, y, z) with radius r.
|
static StdDraw3D.Shape |
wireSphere(double x,
double y,
double z,
double r,
double xA,
double yA,
double zA)
Draws a wireframe sphere at (x, y, z) with radius r and axial rotations (xA, yA, zA).
|
static StdDraw3D.Shape |
wireTriangles(double[][] points) |
static StdDraw3D.Shape |
wireTriangles(double[][] points,
Color[] colors)
Draws a set of wireframetriangles, each with the specified color.
|
public static final Color BLACK
public static final Color BLUE
public static final Color CYAN
public static final Color DARK_GRAY
public static final Color GRAY
public static final Color GREEN
public static final Color LIGHT_GRAY
public static final Color MAGENTA
public static final Color ORANGE
public static final Color PINK
public static final Color RED
public static final Color WHITE
public static final Color YELLOW
public static final int ORBIT_MODE
public static final int FPS_MODE
public static final int AIRPLANE_MODE
public static final int LOOK_MODE
public static final int FIXED_MODE
public static final int IMMERSIVE_MODE
public void stateChanged(ChangeEvent e)
stateChanged
in interface ChangeListener
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
public void componentHidden(ComponentEvent e)
componentHidden
in interface ComponentListener
public void componentMoved(ComponentEvent e)
componentMoved
in interface ComponentListener
public void componentShown(ComponentEvent e)
componentShown
in interface ComponentListener
public void componentResized(ComponentEvent e)
componentResized
in interface ComponentListener
public void windowGainedFocus(WindowEvent e)
windowGainedFocus
in interface WindowFocusListener
public void windowLostFocus(WindowEvent e)
windowLostFocus
in interface WindowFocusListener
public static void setCanvasSize(int w, int h)
w
- The width as a number of pixels.h
- The height as a number of pixels.a
- RuntimeException if the width or height is 0 or negative.public static void setScale()
public static void setScale(double minimum, double maximum)
minimum
- The minimum value of each scale.maximum
- The maximum value of each scale.public static void setPenColor(Color col, int alpha)
col
- The given opaque color.alpha
- The transparency value (0-255).public static void setPenColor()
public static void setPenColor(Color col)
col
- The given color.public static void setPenColor(int r, int g, int b)
public static Color getPenColor()
public static void setPenRadius()
public static void setPenRadius(double r)
r
- The pen radius.public static float getPenRadius()
public static void setFont()
public static void setFont(Font f)
f
- The font to set.public static Font getFont()
public static void setInfoDisplay(boolean enabled)
public static void fullscreen()
public static void setAntiAliasing(boolean enabled)
enabled
- The state of anti-aliasing.public static boolean getAntiAliasing()
public static void setNumDivisions(int N)
N
- The number of divisions.public static int getNumDivisions()
public static int getCameraMode()
public static void setCameraMode(int mode)
mode
- The camera mode.public static void setCameraMode()
public static void setOrbitCenter(double x, double y, double z)
public static void setOrbitCenter(StdDraw3D.Vector3D v)
public static StdDraw3D.Vector3D getOrbitCenter()
public static void setPerspectiveProjection()
public static void setPerspectiveProjection(double fov)
fov
- The field of view to use. Try [0.5-3.0].public static void setParallelProjection()
public static boolean mousePressed()
public static boolean mouse1Pressed()
public static boolean mouse2Pressed()
public static boolean mouse3Pressed()
public static double mouseX()
public static double mouseY()
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved
in interface MouseWheelListener
public static boolean hasNextKeyTyped()
public static char nextKeyTyped()
public static boolean isKeyPressed(int key)
key
- The given keypublic void keyTyped(KeyEvent e)
keyTyped
in interface KeyListener
public void keyPressed(KeyEvent e)
keyPressed
in interface KeyListener
public void keyReleased(KeyEvent e)
keyReleased
in interface KeyListener
public static void setBackground(Color color)
color
- The color to set the background as.public static void setBackground(String imageURL)
imageURL
- The filename for the background image.public static void setBackgroundSphere(String imageURL)
imageURL
- The background image to use.public static void clearSound()
public static void playAmbientSound(String filename)
public static void playAmbientSound(String filename, boolean loop)
public static void clearFog()
public static void addFog(Color col, double frontDistance, double backDistance)
public static void clearLight()
public static void setDefaultLight()
public static StdDraw3D.Light directionalLight(StdDraw3D.Vector3D dir, Color col)
public static StdDraw3D.Light directionalLight(double x, double y, double z, Color col)
public static StdDraw3D.Light ambientLight(Color col)
public static StdDraw3D.Light pointLight(StdDraw3D.Vector3D origin, Color col)
public static StdDraw3D.Light pointLight(double x, double y, double z, Color col)
public static StdDraw3D.Light pointLight(StdDraw3D.Vector3D origin, Color col, double power)
public static StdDraw3D.Light pointLight(double x, double y, double z, Color col, double power)
public static Color randomColor()
public static Color randomRainbowColor()
public static StdDraw3D.Vector3D randomDirection()
public static void clear()
public static void clear(Color color)
public static void clear3D()
public static void clearOverlay()
public static void pause(int time)
time
- The number of milliseconds to pause for.public static void finished()
public static void show()
public static void show(int time)
time
- The number of milliseconds to pause for.public static void showOverlay()
public static void showOverlay(int time)
public static void show3D()
public static void show3D(int time)
public static StdDraw3D.Shape sphere(double x, double y, double z, double r)
public static StdDraw3D.Shape sphere(double x, double y, double z, double r, double xA, double yA, double zA)
public static StdDraw3D.Shape sphere(double x, double y, double z, double r, String imageURL)
public static StdDraw3D.Shape sphere(double x, double y, double z, double r, double xA, double yA, double zA, String imageURL)
public static StdDraw3D.Shape wireSphere(double x, double y, double z, double r)
public static StdDraw3D.Shape wireSphere(double x, double y, double z, double r, double xA, double yA, double zA)
public static StdDraw3D.Shape ellipsoid(double x, double y, double z, double w, double h, double d)
public static StdDraw3D.Shape ellipsoid(double x, double y, double z, double w, double h, double d, double xA, double yA, double zA)
public static StdDraw3D.Shape ellipsoid(double x, double y, double z, double w, double h, double d, String imageURL)
public static StdDraw3D.Shape ellipsoid(double x, double y, double z, double w, double h, double d, double xA, double yA, double zA, String imageURL)
public static StdDraw3D.Shape wireEllipsoid(double x, double y, double z, double w, double h, double d)
public static StdDraw3D.Shape wireEllipsoid(double x, double y, double z, double w, double h, double d, double xA, double yA, double zA)
public static StdDraw3D.Shape cube(double x, double y, double z, double r)
public static StdDraw3D.Shape cube(double x, double y, double z, double r, double xA, double yA, double zA)
public static StdDraw3D.Shape cube(double x, double y, double z, double r, String imageURL)
public static StdDraw3D.Shape cube(double x, double y, double z, double r, double xA, double yA, double zA, String imageURL)
public static StdDraw3D.Shape wireCube(double x, double y, double z, double r, double xA, double yA, double zA)
public static StdDraw3D.Shape wireCube(double x, double y, double z, double r)
public static StdDraw3D.Shape box(double x, double y, double z, double w, double h, double d)
public static StdDraw3D.Shape box(double x, double y, double z, double w, double h, double d, double xA, double yA, double zA)
public static StdDraw3D.Shape box(double x, double y, double z, double w, double h, double d, String imageURL)
public static StdDraw3D.Shape box(double x, double y, double z, double w, double h, double d, double xA, double yA, double zA, String imageURL)
public static StdDraw3D.Shape wireBox(double x, double y, double z, double w, double h, double d)
public static StdDraw3D.Shape wireBox(double x, double y, double z, double w, double h, double d, double xA, double yA, double zA)
public static StdDraw3D.Shape cylinder(double x, double y, double z, double r, double h)
public static StdDraw3D.Shape cylinder(double x, double y, double z, double r, double h, double xA, double yA, double zA)
public static StdDraw3D.Shape cylinder(double x, double y, double z, double r, double h, String imageURL)
public static StdDraw3D.Shape cylinder(double x, double y, double z, double r, double h, double xA, double yA, double zA, String imageURL)
public static StdDraw3D.Shape wireCylinder(double x, double y, double z, double r, double h)
public static StdDraw3D.Shape wireCylinder(double x, double y, double z, double r, double h, double xA, double yA, double zA)
public static StdDraw3D.Shape cone(double x, double y, double z, double r, double h)
public static StdDraw3D.Shape cone(double x, double y, double z, double r, double h, double xA, double yA, double zA)
public static StdDraw3D.Shape cone(double x, double y, double z, double r, double h, String imageURL)
public static StdDraw3D.Shape cone(double x, double y, double z, double r, double h, double xA, double yA, double zA, String imageURL)
public static StdDraw3D.Shape wireCone(double x, double y, double z, double r, double h)
public static StdDraw3D.Shape wireCone(double x, double y, double z, double r, double h, double xA, double yA, double zA)
public static StdDraw3D.Shape point(double x, double y, double z)
public static StdDraw3D.Shape points(double[] x, double[] y, double[] z)
public static StdDraw3D.Shape points(double[] x, double[] y, double[] z, Color[] colors)
public static StdDraw3D.Shape line(double x1, double y1, double z1, double x2, double y2, double z2)
public static StdDraw3D.Shape lines(double[] x, double[] y, double[] z)
public static StdDraw3D.Shape lines(double[] x, double[] y, double[] z, Color[] colors)
public static StdDraw3D.Shape tube(double x1, double y1, double z1, double x2, double y2, double z2, double r)
public static StdDraw3D.Shape tubes(double[] x, double[] y, double[] z, double r)
public static StdDraw3D.Shape tubes(double[] x, double[] y, double[] z, double r, Color[] colors)
public static StdDraw3D.Shape polygon(double[] x, double[] y, double[] z)
public static StdDraw3D.Shape wirePolygon(double[] x, double[] y, double[] z)
public static StdDraw3D.Shape triangles(double[][] points)
points
- an array of the points to be connected. The first dimension is
unspecified, but the second dimension should be 9 (the 3-space coordinates of each vertex)public static StdDraw3D.Shape wireTriangles(double[][] points)
public static StdDraw3D.Shape triangles(double[][] points, Color[] colors)
public static StdDraw3D.Shape wireTriangles(double[][] points, Color[] colors)
public static StdDraw3D.Shape text3D(double x, double y, double z, String text)
public static StdDraw3D.Shape text3D(double x, double y, double z, String text, double xA, double yA, double zA)
public static StdDraw3D.Shape model(String filename)
public static StdDraw3D.Shape model(String filename, boolean resize)
public static StdDraw3D.Shape coloredModel(String filename)
public static StdDraw3D.Shape coloredModel(String filename, boolean resize)
public static void overlayPixel(double x, double y)
public static void overlayPoint(double x, double y)
public static void overlayLine(double x0, double y0, double x1, double y1)
public static void overlayCircle(double x, double y, double r)
public static void overlayFilledCircle(double x, double y, double r)
public static void overlayEllipse(double x, double y, double semiMajorAxis, double semiMinorAxis)
public static void overlayFilledEllipse(double x, double y, double semiMajorAxis, double semiMinorAxis)
public static void overlayArc(double x, double y, double r, double angle1, double angle2)
public static void overlaySquare(double x, double y, double r)
public static void overlayFilledSquare(double x, double y, double r)
public static void overlayRectangle(double x, double y, double halfWidth, double halfHeight)
public static void overlayFilledRectangle(double x, double y, double halfWidth, double halfHeight)
public static void overlayPolygon(double[] x, double[] y)
public static void overlayFilledPolygon(double[] x, double[] y)
public static void overlayText(double x, double y, String text)
public static void overlayText(double x, double y, String text, double degrees)
public static void overlayTextLeft(double x, double y, String text)
public static void overlayTextRight(double x, double y, String text)
public static void overlayPicture(double x, double y, String s)
public static void overlayPicture(double x, double y, String s, double degrees)
public static void overlayPicture(double x, double y, String s, double w, double h)
public static void overlayPicture(double x, double y, String s, double w, double h, double degrees)
public static void save(String filename)
filename
- The name of the file with one of the required suffixes.public static void saveScene3D(String filename)
public static void loadScene3D(String filename)
public static StdDraw3D.Shape combine(StdDraw3D.Shape... shapes)
public static StdDraw3D.Shape copy(StdDraw3D.Shape shape)
public static StdDraw3D.Vector3D getCameraPosition()
public static StdDraw3D.Vector3D getCameraOrientation()
public static StdDraw3D.Vector3D getCameraDirection()
public static void setCameraPosition(double x, double y, double z)
public static void setCameraPosition(StdDraw3D.Vector3D position)
public static void setCameraOrientation(double xAngle, double yAngle, double zAngle)
public static void setCameraOrientation(StdDraw3D.Vector3D angles)
public static void setCameraDirection(double x, double y, double z)
public static void setCameraDirection(StdDraw3D.Vector3D direction)
public static void setCamera(double x, double y, double z, double xAngle, double yAngle, double zAngle)
public static void setCamera(StdDraw3D.Vector3D position, StdDraw3D.Vector3D angles)
public static StdDraw3D.Camera camera()
public static void main(String[] args)