Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / src / javajs / util / V3d.java
index 7fd4f58..9060575 100644 (file)
@@ -1,93 +1,93 @@
-/*\r
-   Copyright (C) 1997,1998,1999\r
-   Kenji Hiranabe, Eiwa System Management, Inc.\r
-\r
-   This program is free software.\r
-   Implemented by Kenji Hiranabe(hiranabe@esm.co.jp),\r
-   conforming to the Java(TM) 3D API specification by Sun Microsystems.\r
-\r
-   Permission to use, copy, modify, distribute and sell this software\r
-   and its documentation for any purpose is hereby granted without fee,\r
-   provided that the above copyright notice appear in all copies and\r
-   that both that copyright notice and this permission notice appear\r
-   in supporting documentation. Kenji Hiranabe and Eiwa System Management,Inc.\r
-   makes no representations about the suitability of this software for any\r
-   purpose.  It is provided "AS IS" with NO WARRANTY.\r
-*/\r
-package javajs.util;\r
-\r
-\r
-\r
-\r
-/**\r
- * A 3 element vector that is represented by double precision floating point\r
- * x,y,z coordinates. If this value represents a normal, then it should be\r
- * normalized.\r
- * \r
- * @version specification 1.1, implementation $Revision: 1.9 $, $Date:\r
- *          2006/07/28 17:01:32 $\r
- * @author Kenji hiranabe\r
- * \r
- * additions by Bob Hanson hansonr@stolaf.edu 9/30/2012\r
- * for unique constructor and method names\r
- * for the optimization of compiled JavaScript using Java2Script\r
- */\r
-public class V3d extends T3d {\r
-\r
-  /**\r
-   * Sets this vector to be the vector cross product of vectors v1 and v2.\r
-   * \r
-   * @param v1\r
-   *        the first vector\r
-   * @param v2\r
-   *        the second vector\r
-   */\r
-  public final void cross(V3d v1, V3d v2) {\r
-    // store on stack once for aliasing-safty\r
-    // i.e. safe when a.cross(a, b)\r
-    set(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y\r
-        - v1.y * v2.x);\r
-  }\r
-\r
-  /**\r
-   * Normalizes this vector in place.\r
-   */\r
-  public final void normalize() {\r
-    double d = length();\r
-\r
-    // zero-div may occur.\r
-    x /= d;\r
-    y /= d;\r
-    z /= d;\r
-  }\r
-\r
-  /**\r
-   * Computes the dot product of the this vector and vector v.\r
-   * \r
-   * @param v\r
-   *        the other vector\r
-   * @return this.dot.v\r
-   */\r
-  public final double dot(V3d v) {\r
-    return x * v.x + y * v.y + z * v.z;\r
-  }\r
-\r
-  /**\r
-   * Returns the squared length of this vector.\r
-   * \r
-   * @return the squared length of this vector\r
-   */\r
-  public final double lengthSquared() {\r
-    return x * x + y * y + z * z;\r
-  }\r
-\r
-  /**\r
-   * Returns the length of this vector.\r
-   * \r
-   * @return the length of this vector\r
-   */\r
-  public final double length() {\r
-    return Math.sqrt(lengthSquared());\r
-  }\r
-\r
-}\r
+/*
+   Copyright (C) 1997,1998,1999
+   Kenji Hiranabe, Eiwa System Management, Inc.
+
+   This program is free software.
+   Implemented by Kenji Hiranabe(hiranabe@esm.co.jp),
+   conforming to the Java(TM) 3D API specification by Sun Microsystems.
+
+   Permission to use, copy, modify, distribute and sell this software
+   and its documentation for any purpose is hereby granted without fee,
+   provided that the above copyright notice appear in all copies and
+   that both that copyright notice and this permission notice appear
+   in supporting documentation. Kenji Hiranabe and Eiwa System Management,Inc.
+   makes no representations about the suitability of this software for any
+   purpose.  It is provided "AS IS" with NO WARRANTY.
+*/
+package javajs.util;
+
+
+
+
+/**
+ * A 3 element vector that is represented by double precision floating point
+ * x,y,z coordinates. If this value represents a normal, then it should be
+ * normalized.
+ * 
+ * @version specification 1.1, implementation $Revision: 1.9 $, $Date:
+ *          2006/07/28 17:01:32 $
+ * @author Kenji hiranabe
+ * 
+ * additions by Bob Hanson hansonr@stolaf.edu 9/30/2012
+ * for unique constructor and method names
+ * for the optimization of compiled JavaScript using Java2Script
+ */
+public class V3d extends T3d {
+
+  /**
+   * Sets this vector to be the vector cross product of vectors v1 and v2.
+   * 
+   * @param v1
+   *        the first vector
+   * @param v2
+   *        the second vector
+   */
+  public final void cross(V3d v1, V3d v2) {
+    // store on stack once for aliasing-safty
+    // i.e. safe when a.cross(a, b)
+    set(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y
+        - v1.y * v2.x);
+  }
+
+  /**
+   * Normalizes this vector in place.
+   */
+  public final void normalize() {
+    double d = length();
+
+    // zero-div may occur.
+    x /= d;
+    y /= d;
+    z /= d;
+  }
+
+  /**
+   * Computes the dot product of the this vector and vector v.
+   * 
+   * @param v
+   *        the other vector
+   * @return this.dot.v
+   */
+  public final double dot(V3d v) {
+    return x * v.x + y * v.y + z * v.z;
+  }
+
+  /**
+   * Returns the squared length of this vector.
+   * 
+   * @return the squared length of this vector
+   */
+  public final double lengthSquared() {
+    return x * x + y * y + z * z;
+  }
+
+  /**
+   * Returns the length of this vector.
+   * 
+   * @return the length of this vector
+   */
+  public final double length() {
+    return Math.sqrt(lengthSquared());
+  }
+
+}