home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / ext / vecmath.jar / javax / vecmath / Vector4d.class (.txt) < prev    next >
Encoding:
Java Class File  |  2002-06-19  |  2.1 KB  |  87 lines

  1. package javax.vecmath;
  2.  
  3. import java.io.Serializable;
  4.  
  5. public class Vector4d extends Tuple4d implements Serializable {
  6.    static final long serialVersionUID = 3938123424117448700L;
  7.  
  8.    public Vector4d(double var1, double var3, double var5, double var7) {
  9.       super(var1, var3, var5, var7);
  10.    }
  11.  
  12.    public Vector4d(double[] var1) {
  13.       super(var1);
  14.    }
  15.  
  16.    public Vector4d(Vector4d var1) {
  17.       super(var1);
  18.    }
  19.  
  20.    public Vector4d(Vector4f var1) {
  21.       super(var1);
  22.    }
  23.  
  24.    public Vector4d(Tuple4f var1) {
  25.       super(var1);
  26.    }
  27.  
  28.    public Vector4d(Tuple4d var1) {
  29.       super(var1);
  30.    }
  31.  
  32.    public Vector4d(Tuple3d var1) {
  33.       super(var1.x, var1.y, var1.z, (double)0.0F);
  34.    }
  35.  
  36.    public Vector4d() {
  37.    }
  38.  
  39.    public final void set(Tuple3d var1) {
  40.       this.x = var1.x;
  41.       this.y = var1.y;
  42.       this.z = var1.z;
  43.       this.w = (double)0.0F;
  44.    }
  45.  
  46.    public final double length() {
  47.       return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
  48.    }
  49.  
  50.    public final double lengthSquared() {
  51.       return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
  52.    }
  53.  
  54.    public final double dot(Vector4d var1) {
  55.       return this.x * var1.x + this.y * var1.y + this.z * var1.z + this.w * var1.w;
  56.    }
  57.  
  58.    public final void normalize(Vector4d var1) {
  59.       double var2 = (double)1.0F / Math.sqrt(var1.x * var1.x + var1.y * var1.y + var1.z * var1.z + var1.w * var1.w);
  60.       this.x = var1.x * var2;
  61.       this.y = var1.y * var2;
  62.       this.z = var1.z * var2;
  63.       this.w = var1.w * var2;
  64.    }
  65.  
  66.    public final void normalize() {
  67.       double var1 = (double)1.0F / Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
  68.       this.x *= var1;
  69.       this.y *= var1;
  70.       this.z *= var1;
  71.       this.w *= var1;
  72.    }
  73.  
  74.    public final double angle(Vector4d var1) {
  75.       double var2 = this.dot(var1) / (this.length() * var1.length());
  76.       if (var2 < (double)-1.0F) {
  77.          var2 = (double)-1.0F;
  78.       }
  79.  
  80.       if (var2 > (double)1.0F) {
  81.          var2 = (double)1.0F;
  82.       }
  83.  
  84.       return Math.acos(var2);
  85.    }
  86. }
  87.