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.Color
ambient
static java.awt.Color
bgcolor
protected java.awt.Color[]
colors
protected int
defaultColor
protected int
frameNo
java.awt.Graphics
g
protected int
lastFrame
protected java.awt.Color
lightColor
protected Point3d
lightDirection
double
xscale
double
yscale
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
adjustCamera(double deltax, double deltay)
Adjust the position of the camera, given a displacement of the view position relative to U and V vectorsvoid
clear()
java.lang.Object
clone()
void
drawLine(Point3d p1, Point3d p2)
Draw a 3D line.void
drawString(java.lang.String s, Point3d p1)
Place a string at a point in 3D space.void
drawStringBelow(java.lang.String s, Point3d p1)
Place a string below a point in 3D space.java.awt.Color
getColor(int i)
get a colour for objectsint
getColorIndex(int i)
get a colour index - translating -1 to default colourint
getFrameNo()
get the frame noint
getLastFrame()
get the last frame nojava.lang.String
getVRMLColor(int i)
get a colour for VRML objectsvoid
pan(int deltax, int deltay)
void
set(View3dInfo v)
void
setColor(int i, java.awt.Color c)
set a colour for objectsint
setDefaultColor(int i)
set a default colour for objectsvoid
setFrameNo(int frameNo)
set the frame novoid
setGraphics(java.awt.Graphics g, int width, int height)
set Graphics object to draw invoid
setLastFrame(int frame)
set the last frame novoid
setLightDirection(Point3d dirn)
set direction of light sourcevoid
setWindow(double wx, double wy, double wwidth, double wheight)
Set the window on the UV planejava.awt.Color
shade(int c1, int c2, Point3d n, Point3d p)
compute shading colourjava.awt.Point
toPoint(Point3d p)
Methods inherited from class au.edu.unsw.cse.View3dInfo
adjustCameraDI, depth, dolly, fromString, frontFace, orthographic, panDI, setCamera, setCamera, setPerspective, toString, toVRML, zoom
Methods 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:
set
in 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:
setWindow
in 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:
clone
in classjava.lang.Object
-