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 / Vector4f.class (.txt) < prev   
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 Vector4f extends Tuple4f implements Serializable {
  6.    static final long serialVersionUID = 8749319902347760659L;
  7.  
  8.    public Vector4f(float var1, float var2, float var3, float var4) {
  9.       super(var1, var2, var3, var4);
  10.    }
  11.  
  12.    public Vector4f(float[] var1) {
  13.       super(var1);
  14.    }
  15.  
  16.    public Vector4f(Vector4f var1) {
  17.       super(var1);
  18.    }
  19.  
  20.    public Vector4f(Vector4d var1) {
  21.       super(var1);
  22.    }
  23.  
  24.    public Vector4f(Tuple4f var1) {
  25.       super(var1);
  26.    }
  27.  
  28.    public Vector4f(Tuple4d var1) {
  29.       super(var1);
  30.    }
  31.  
  32.    public Vector4f(Tuple3f var1) {
  33.       super(var1.x, var1.y, var1.z, 0.0F);
  34.    }
  35.  
  36.    public Vector4f() {
  37.    }
  38.  
  39.    public final void set(Tuple3f var1) {
  40.       this.x = var1.x;
  41.       this.y = var1.y;
  42.       this.z = var1.z;
  43.       this.w = 0.0F;
  44.    }
  45.  
  46.    public final float length() {
  47.       return (float)Math.sqrt((double)(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w));
  48.    }
  49.  
  50.    public final float lengthSquared() {
  51.       return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
  52.    }
  53.  
  54.    public final float dot(Vector4f 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(Vector4f var1) {
  59.       float var2 = (float)((double)1.0F / Math.sqrt((double)(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.       float var1 = (float)((double)1.0F / Math.sqrt((double)(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 float angle(Vector4f var1) {
  75.       double var2 = (double)(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 (float)Math.acos(var2);
  85.    }
  86. }
  87.