home *** CD-ROM | disk | FTP | other *** search
/ Late Night VRML 2.0 with Java CD-ROM / code.zip / Ch18 / multi / Rotation.java < prev    next >
Encoding:
Java Source  |  1997-02-21  |  814 b   |  37 lines

  1. // A simple Rotationr class
  2.  
  3. // Written by Bernie Roehl, December 1996
  4.  
  5. package multi;
  6.  
  7. import java.io.*;
  8.  
  9. public class Rotation {
  10.     protected float x = 0, y = 0, z = 1, a = 0;
  11.  
  12.     public float getX() { return x; }
  13.     public float getY() { return y; }
  14.     public float getZ() { return z; }
  15.     public float getAngle() { return a; }
  16.  
  17.     public Rotation() { x = y = a = 0;  z = 1; }
  18.  
  19.     public Rotation(float xv, float yv, float zv, float av) {
  20.         x = xv;
  21.         y = yv;
  22.         z = zv;
  23.         a = av;
  24.     }
  25.  
  26.     public void read(DataInputStream in) throws IOException {
  27.         x = in.readFloat();
  28.         y = in.readFloat();
  29.         z = in.readFloat();
  30.         a = in.readFloat();
  31.     }
  32.  
  33.     public String toString() { return x + " " + y + " " + z + " " + a; }
  34.  
  35. }
  36.  
  37.