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 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

      protected Point3d lightDirection
  • Constructor Details

    • View3d

      public View3d​(Point3d dirn)
      Creates a 3D view given a graphics object to draw in, a viewport within that graphics object, and a background colour
  • Method Details

    • set

      public void set​(View3dInfo v)
      Overrides:
      set in class View3dInfo
    • 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 class View3dInfo
    • 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

      public void setLightDirection​(Point3d dirn)
      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

      public java.awt.Color shade​(int c1, int c2, Point3d n, Point3d p)
      compute shading colour
    • toPoint

      public java.awt.Point toPoint​(Point3d p)
    • clear

      public void clear()
    • drawLine

      public void drawLine​(Point3d p1, Point3d p2)
      Draw a 3D line.
    • drawString

      public void drawString​(java.lang.String s, Point3d p1)
      Place a string at a point in 3D space. Useful for labelling vertices when debugging
    • drawStringBelow

      public void drawStringBelow​(java.lang.String s, Point3d p1)
      Place a string below a point in 3D space. Useful for labelling vertices when debugging
    • clone

      public java.lang.Object clone()
      Overrides:
      clone in class java.lang.Object