JAL-1807 includes ?j2sdebug flag and DebugJS._(msg)
[jalviewjs.git] / bin / javajs / util / V3d.js
1 Clazz.declarePackage ("javajs.util");
2 Clazz.load (["javajs.util.T3d"], "javajs.util.V3d", null, function () {
3 c$ = Clazz.declareType (javajs.util, "V3d", javajs.util.T3d);
4 Clazz.defineMethod (c$, "cross", 
5 function (v1, v2) {
6 this.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);
7 }, "javajs.util.V3d,javajs.util.V3d");
8 Clazz.defineMethod (c$, "normalize", 
9 function () {
10 var d = this.length ();
11 this.x /= d;
12 this.y /= d;
13 this.z /= d;
14 });
15 Clazz.defineMethod (c$, "dot", 
16 function (v) {
17 return this.x * v.x + this.y * v.y + this.z * v.z;
18 }, "javajs.util.V3d");
19 Clazz.defineMethod (c$, "lengthSquared", 
20 function () {
21 return this.x * this.x + this.y * this.y + this.z * this.z;
22 });
23 Clazz.defineMethod (c$, "length", 
24 function () {
25 return Math.sqrt (this.lengthSquared ());
26 });
27 });