JAL-1807 includes ?j2sdebug flag and DebugJS._(msg)
[jalviewjs.git] / bin / javajs / util / T3.js
1 Clazz.declarePackage ("javajs.util");
2 Clazz.load (["javajs.api.JSONEncodable"], "javajs.util.T3", ["java.lang.Float"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.x = 0;
5 this.y = 0;
6 this.z = 0;
7 Clazz.instantialize (this, arguments);
8 }, javajs.util, "T3", null, [javajs.api.JSONEncodable, java.io.Serializable]);
9 Clazz.defineMethod (c$, "set", 
10 function (x, y, z) {
11 this.x = x;
12 this.y = y;
13 this.z = z;
14 }, "~N,~N,~N");
15 Clazz.defineMethod (c$, "setA", 
16 function (t) {
17 this.x = t[0];
18 this.y = t[1];
19 this.z = t[2];
20 }, "~A");
21 Clazz.defineMethod (c$, "setT", 
22 function (t1) {
23 this.x = t1.x;
24 this.y = t1.y;
25 this.z = t1.z;
26 }, "javajs.util.T3");
27 Clazz.defineMethod (c$, "add2", 
28 function (t1, t2) {
29 this.x = t1.x + t2.x;
30 this.y = t1.y + t2.y;
31 this.z = t1.z + t2.z;
32 }, "javajs.util.T3,javajs.util.T3");
33 Clazz.defineMethod (c$, "add", 
34 function (t1) {
35 this.x += t1.x;
36 this.y += t1.y;
37 this.z += t1.z;
38 }, "javajs.util.T3");
39 Clazz.defineMethod (c$, "distanceSquared", 
40 function (p1) {
41 var dx = this.x - p1.x;
42 var dy = this.y - p1.y;
43 var dz = this.z - p1.z;
44 return (dx * dx + dy * dy + dz * dz);
45 }, "javajs.util.T3");
46 Clazz.defineMethod (c$, "distance", 
47 function (p1) {
48 return Math.sqrt (this.distanceSquared (p1));
49 }, "javajs.util.T3");
50 Clazz.defineMethod (c$, "sub2", 
51 function (t1, t2) {
52 this.x = t1.x - t2.x;
53 this.y = t1.y - t2.y;
54 this.z = t1.z - t2.z;
55 }, "javajs.util.T3,javajs.util.T3");
56 Clazz.defineMethod (c$, "sub", 
57 function (t1) {
58 this.x -= t1.x;
59 this.y -= t1.y;
60 this.z -= t1.z;
61 }, "javajs.util.T3");
62 Clazz.defineMethod (c$, "scale", 
63 function (s) {
64 this.x *= s;
65 this.y *= s;
66 this.z *= s;
67 }, "~N");
68 Clazz.defineMethod (c$, "add3", 
69 function (a, b, c) {
70 this.x += a;
71 this.y += b;
72 this.z += c;
73 }, "~N,~N,~N");
74 Clazz.defineMethod (c$, "scaleT", 
75 function (p) {
76 this.x *= p.x;
77 this.y *= p.y;
78 this.z *= p.z;
79 }, "javajs.util.T3");
80 Clazz.defineMethod (c$, "scaleAdd2", 
81 function (s, t1, t2) {
82 this.x = s * t1.x + t2.x;
83 this.y = s * t1.y + t2.y;
84 this.z = s * t1.z + t2.z;
85 }, "~N,javajs.util.T3,javajs.util.T3");
86 Clazz.defineMethod (c$, "ave", 
87 function (a, b) {
88 this.x = (a.x + b.x) / 2;
89 this.y = (a.y + b.y) / 2;
90 this.z = (a.z + b.z) / 2;
91 }, "javajs.util.T3,javajs.util.T3");
92 Clazz.defineMethod (c$, "dot", 
93 function (v) {
94 return this.x * v.x + this.y * v.y + this.z * v.z;
95 }, "javajs.util.T3");
96 Clazz.defineMethod (c$, "lengthSquared", 
97 function () {
98 return this.x * this.x + this.y * this.y + this.z * this.z;
99 });
100 Clazz.defineMethod (c$, "length", 
101 function () {
102 return Math.sqrt (this.lengthSquared ());
103 });
104 Clazz.defineMethod (c$, "normalize", 
105 function () {
106 var d = this.length ();
107 this.x /= d;
108 this.y /= d;
109 this.z /= d;
110 });
111 Clazz.defineMethod (c$, "cross", 
112 function (v1, v2) {
113 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);
114 }, "javajs.util.T3,javajs.util.T3");
115 Clazz.overrideMethod (c$, "hashCode", 
116 function () {
117 var bits = 1;
118 bits = 31 * bits + javajs.util.T3.floatToIntBits0 (this.x);
119 bits = 31 * bits + javajs.util.T3.floatToIntBits0 (this.y);
120 bits = 31 * bits + javajs.util.T3.floatToIntBits0 (this.z);
121 return (bits ^ (bits >> 32));
122 });
123 c$.floatToIntBits0 = Clazz.defineMethod (c$, "floatToIntBits0", 
124 function (f) {
125 return (f == 0 ? 0 : Float.floatToIntBits (f));
126 }, "~N");
127 Clazz.overrideMethod (c$, "equals", 
128 function (t1) {
129 if (!(Clazz.instanceOf (t1, javajs.util.T3))) return false;
130 var t2 = t1;
131 return (this.x == t2.x && this.y == t2.y && this.z == t2.z);
132 }, "~O");
133 Clazz.overrideMethod (c$, "toString", 
134 function () {
135 return "{" + this.x + ", " + this.y + ", " + this.z + "}";
136 });
137 Clazz.overrideMethod (c$, "toJSON", 
138 function () {
139 return "[" + this.x + "," + this.y + "," + this.z + "]";
140 });
141 });