Package au.edu.unsw.cse
Class View3d
java.lang.Object
au.edu.unsw.cse.View3dInfo
au.edu.unsw.cse.View3d
- All Implemented Interfaces:
java.lang.Cloneable
public class View3d extends View3dInfo implements java.lang.Cloneable
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.Colorambientstatic java.awt.Colorbgcolorprotected java.awt.Color[]colorsprotected intdefaultColorprotected intframeNojava.awt.Graphicsgprotected intlastFrameprotected java.awt.ColorlightColorprotected Point3dlightDirectiondoublexscaledoubleyscale -
Constructor Summary
-
Method Summary
Modifier and Type Method Description voidadjustCamera(double deltax, double deltay)Adjust the position of the camera, given a displacement of the view position relative to U and V vectorsvoidclear()java.lang.Objectclone()voiddrawLine(Point3d p1, Point3d p2)Draw a 3D line.voiddrawString(java.lang.String s, Point3d p1)Place a string at a point in 3D space.voiddrawStringBelow(java.lang.String s, Point3d p1)Place a string below a point in 3D space.java.awt.ColorgetColor(int i)get a colour for objectsintgetColorIndex(int i)get a colour index - translating -1 to default colourintgetFrameNo()get the frame nointgetLastFrame()get the last frame nojava.lang.StringgetVRMLColor(int i)get a colour for VRML objectsvoidpan(int deltax, int deltay)voidset(View3dInfo v)voidsetColor(int i, java.awt.Color c)set a colour for objectsintsetDefaultColor(int i)set a default colour for objectsvoidsetFrameNo(int frameNo)set the frame novoidsetGraphics(java.awt.Graphics g, int width, int height)set Graphics object to draw invoidsetLastFrame(int frame)set the last frame novoidsetLightDirection(Point3d dirn)set direction of light sourcevoidsetWindow(double wx, double wy, double wwidth, double wheight)Set the window on the UV planejava.awt.Colorshade(int c1, int c2, Point3d n, Point3d p)compute shading colourjava.awt.PointtoPoint(Point3d p)Methods inherited from class au.edu.unsw.cse.View3dInfo
adjustCameraDI, depth, dolly, fromString, frontFace, orthographic, panDI, setCamera, setCamera, setPerspective, toString, toVRML, zoomMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
g
public java.awt.Graphics g -
frameNo
protected int frameNo -
lastFrame
protected int lastFrame -
xscale
public double xscale -
yscale
public double yscale -
bgcolor
public static java.awt.Color bgcolor -
ambient
protected java.awt.Color ambient -
lightColor
protected java.awt.Color lightColor -
colors
protected java.awt.Color[] colors -
defaultColor
protected int defaultColor -
lightDirection
-
-
Constructor Details
-
View3d
Creates a 3D view given a graphics object to draw in, a viewport within that graphics object, and a background colour
-
-
Method Details
-
set
- Overrides:
setin classView3dInfo
-
setGraphics
public void setGraphics(java.awt.Graphics g, int width, int height)set Graphics object to draw in -
setWindow
public void setWindow(double wx, double wy, double wwidth, double wheight)Set the window on the UV plane- Overrides:
setWindowin classView3dInfo
-
adjustCamera
public void adjustCamera(double deltax, double deltay)Adjust the position of the camera, given a displacement of the view position relative to U and V vectors -
pan
public void pan(int deltax, int deltay) -
setFrameNo
public void setFrameNo(int frameNo)set the frame no -
getFrameNo
public int getFrameNo()get the frame no -
setLastFrame
public void setLastFrame(int frame)set the last frame no -
getLastFrame
public int getLastFrame()get the last frame no -
setLightDirection
set direction of light source -
setColor
public void setColor(int i, java.awt.Color c)set a colour for objects -
getColorIndex
public int getColorIndex(int i)get a colour index - translating -1 to default colour -
getColor
public java.awt.Color getColor(int i)get a colour for objects -
getVRMLColor
public java.lang.String getVRMLColor(int i)get a colour for VRML objects -
setDefaultColor
public int setDefaultColor(int i)set a default colour for objects -
shade
compute shading colour -
toPoint
-
clear
public void clear() -
drawLine
Draw a 3D line. -
drawString
Place a string at a point in 3D space. Useful for labelling vertices when debugging -
drawStringBelow
Place a string below a point in 3D space. Useful for labelling vertices when debugging -
clone
public java.lang.Object clone()- Overrides:
clonein classjava.lang.Object
-