mirror of
https://github.com/MapMakersAndProgrammers/TankiOnline2.0DemoClient.git
synced 2025-10-26 18:09:07 -07:00
Initial commit
This commit is contained in:
300
src/package_46/Matrix3.as
Normal file
300
src/package_46/Matrix3.as
Normal file
@@ -0,0 +1,300 @@
|
||||
package package_46
|
||||
{
|
||||
import flash.geom.Vector3D;
|
||||
|
||||
public class Matrix3
|
||||
{
|
||||
public static const ZERO:Matrix3 = new Matrix3(0,0,0,0,0,0,0,0,0);
|
||||
|
||||
public static const IDENTITY:Matrix3 = new Matrix3();
|
||||
|
||||
public var a:Number;
|
||||
|
||||
public var b:Number;
|
||||
|
||||
public var c:Number;
|
||||
|
||||
public var e:Number;
|
||||
|
||||
public var f:Number;
|
||||
|
||||
public var g:Number;
|
||||
|
||||
public var i:Number;
|
||||
|
||||
public var j:Number;
|
||||
|
||||
public var k:Number;
|
||||
|
||||
public function Matrix3(a:Number = 1, b:Number = 0, c:Number = 0, e:Number = 0, f:Number = 1, g:Number = 0, i:Number = 0, j:Number = 0, k:Number = 1)
|
||||
{
|
||||
super();
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
this.g = g;
|
||||
this.i = i;
|
||||
this.j = j;
|
||||
this.k = k;
|
||||
}
|
||||
|
||||
public function method_347() : Matrix3
|
||||
{
|
||||
this.a = this.f = this.k = 1;
|
||||
this.b = this.c = this.e = this.g = this.i = this.j = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function invert() : Matrix3
|
||||
{
|
||||
var aa:Number = this.a;
|
||||
var bb:Number = this.b;
|
||||
var cc:Number = this.c;
|
||||
var ee:Number = this.e;
|
||||
var ff:Number = this.f;
|
||||
var gg:Number = this.g;
|
||||
var ii:Number = this.i;
|
||||
var jj:Number = this.j;
|
||||
var kk:Number = this.k;
|
||||
var det:Number = 1 / (-cc * ff * ii + bb * gg * ii + cc * ee * jj - aa * gg * jj - bb * ee * kk + aa * ff * kk);
|
||||
this.a = (ff * kk - gg * jj) * det;
|
||||
this.b = (cc * jj - bb * kk) * det;
|
||||
this.c = (bb * gg - cc * ff) * det;
|
||||
this.e = (gg * ii - ee * kk) * det;
|
||||
this.f = (aa * kk - cc * ii) * det;
|
||||
this.g = (cc * ee - aa * gg) * det;
|
||||
this.i = (ee * jj - ff * ii) * det;
|
||||
this.j = (bb * ii - aa * jj) * det;
|
||||
this.k = (aa * ff - bb * ee) * det;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function append(m:Matrix3) : Matrix3
|
||||
{
|
||||
var aa:Number = this.a;
|
||||
var bb:Number = this.b;
|
||||
var cc:Number = this.c;
|
||||
var ee:Number = this.e;
|
||||
var ff:Number = this.f;
|
||||
var gg:Number = this.g;
|
||||
var ii:Number = this.i;
|
||||
var jj:Number = this.j;
|
||||
var kk:Number = this.k;
|
||||
this.a = m.a * aa + m.b * ee + m.c * ii;
|
||||
this.b = m.a * bb + m.b * ff + m.c * jj;
|
||||
this.c = m.a * cc + m.b * gg + m.c * kk;
|
||||
this.e = m.e * aa + m.f * ee + m.g * ii;
|
||||
this.f = m.e * bb + m.f * ff + m.g * jj;
|
||||
this.g = m.e * cc + m.f * gg + m.g * kk;
|
||||
this.i = m.i * aa + m.j * ee + m.k * ii;
|
||||
this.j = m.i * bb + m.j * ff + m.k * jj;
|
||||
this.k = m.i * cc + m.j * gg + m.k * kk;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function prepend(m:Matrix3) : Matrix3
|
||||
{
|
||||
var aa:Number = this.a;
|
||||
var bb:Number = this.b;
|
||||
var cc:Number = this.c;
|
||||
var ee:Number = this.e;
|
||||
var ff:Number = this.f;
|
||||
var gg:Number = this.g;
|
||||
var ii:Number = this.i;
|
||||
var jj:Number = this.j;
|
||||
var kk:Number = this.k;
|
||||
this.a = aa * m.a + bb * m.e + cc * m.i;
|
||||
this.b = aa * m.b + bb * m.f + cc * m.j;
|
||||
this.c = aa * m.c + bb * m.g + cc * m.k;
|
||||
this.e = ee * m.a + ff * m.e + gg * m.i;
|
||||
this.f = ee * m.b + ff * m.f + gg * m.j;
|
||||
this.g = ee * m.c + ff * m.g + gg * m.k;
|
||||
this.i = ii * m.a + jj * m.e + kk * m.i;
|
||||
this.j = ii * m.b + jj * m.f + kk * m.j;
|
||||
this.k = ii * m.c + jj * m.g + kk * m.k;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_348(m:Matrix3) : Matrix3
|
||||
{
|
||||
var aa:Number = this.a;
|
||||
var bb:Number = this.b;
|
||||
var cc:Number = this.c;
|
||||
var ee:Number = this.e;
|
||||
var ff:Number = this.f;
|
||||
var gg:Number = this.g;
|
||||
var ii:Number = this.i;
|
||||
var jj:Number = this.j;
|
||||
var kk:Number = this.k;
|
||||
this.a = aa * m.a + bb * m.b + cc * m.c;
|
||||
this.b = aa * m.e + bb * m.f + cc * m.g;
|
||||
this.c = aa * m.i + bb * m.j + cc * m.k;
|
||||
this.e = ee * m.a + ff * m.b + gg * m.c;
|
||||
this.f = ee * m.e + ff * m.f + gg * m.g;
|
||||
this.g = ee * m.i + ff * m.j + gg * m.k;
|
||||
this.i = ii * m.a + jj * m.b + kk * m.c;
|
||||
this.j = ii * m.e + jj * m.f + kk * m.g;
|
||||
this.k = ii * m.i + jj * m.j + kk * m.k;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function add(m:Matrix3) : Matrix3
|
||||
{
|
||||
this.a += m.a;
|
||||
this.b += m.b;
|
||||
this.c += m.c;
|
||||
this.e += m.e;
|
||||
this.f += m.f;
|
||||
this.g += m.g;
|
||||
this.i += m.i;
|
||||
this.j += m.j;
|
||||
this.k += m.k;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function subtract(m:Matrix3) : Matrix3
|
||||
{
|
||||
this.a -= m.a;
|
||||
this.b -= m.b;
|
||||
this.c -= m.c;
|
||||
this.e -= m.e;
|
||||
this.f -= m.f;
|
||||
this.g -= m.g;
|
||||
this.i -= m.i;
|
||||
this.j -= m.j;
|
||||
this.k -= m.k;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function transpose() : Matrix3
|
||||
{
|
||||
var tmp:Number = this.b;
|
||||
this.b = this.e;
|
||||
this.e = tmp;
|
||||
tmp = this.c;
|
||||
this.c = this.i;
|
||||
this.i = tmp;
|
||||
tmp = this.g;
|
||||
this.g = this.j;
|
||||
this.j = tmp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_345(vin:name_194, vout:name_194) : void
|
||||
{
|
||||
vout.x = this.a * vin.x + this.b * vin.y + this.c * vin.z;
|
||||
vout.y = this.e * vin.x + this.f * vin.y + this.g * vin.z;
|
||||
vout.z = this.i * vin.x + this.j * vin.y + this.k * vin.z;
|
||||
}
|
||||
|
||||
public function method_346(vin:name_194, vout:name_194) : void
|
||||
{
|
||||
vout.x = this.a * vin.x + this.e * vin.y + this.i * vin.z;
|
||||
vout.y = this.b * vin.x + this.f * vin.y + this.j * vin.z;
|
||||
vout.z = this.c * vin.x + this.g * vin.y + this.k * vin.z;
|
||||
}
|
||||
|
||||
public function transformVector3To3D(vin:name_194, vout:Vector3D) : void
|
||||
{
|
||||
vout.x = this.a * vin.x + this.b * vin.y + this.c * vin.z;
|
||||
vout.y = this.e * vin.x + this.f * vin.y + this.g * vin.z;
|
||||
vout.z = this.i * vin.x + this.j * vin.y + this.k * vin.z;
|
||||
}
|
||||
|
||||
public function method_349(v:name_194) : Matrix3
|
||||
{
|
||||
this.a = this.f = this.k = 0;
|
||||
this.b = -v.z;
|
||||
this.c = v.y;
|
||||
this.e = v.z;
|
||||
this.g = -v.x;
|
||||
this.i = -v.y;
|
||||
this.j = v.x;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function copy(m:Matrix3) : Matrix3
|
||||
{
|
||||
this.a = m.a;
|
||||
this.b = m.b;
|
||||
this.c = m.c;
|
||||
this.e = m.e;
|
||||
this.f = m.f;
|
||||
this.g = m.g;
|
||||
this.i = m.i;
|
||||
this.j = m.j;
|
||||
this.k = m.k;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function name_196(rx:Number, ry:Number, rz:Number) : void
|
||||
{
|
||||
var cosX:Number = Number(Math.cos(rx));
|
||||
var sinX:Number = Number(Math.sin(rx));
|
||||
var cosY:Number = Number(Math.cos(ry));
|
||||
var sinY:Number = Number(Math.sin(ry));
|
||||
var cosZ:Number = Number(Math.cos(rz));
|
||||
var sinZ:Number = Number(Math.sin(rz));
|
||||
var cosZsinY:Number = cosZ * sinY;
|
||||
var sinZsinY:Number = sinZ * sinY;
|
||||
this.a = cosZ * cosY;
|
||||
this.b = cosZsinY * sinX - sinZ * cosX;
|
||||
this.c = cosZsinY * cosX + sinZ * sinX;
|
||||
this.e = sinZ * cosY;
|
||||
this.f = sinZsinY * sinX + cosZ * cosX;
|
||||
this.g = sinZsinY * cosX - cosZ * sinX;
|
||||
this.i = -sinY;
|
||||
this.j = cosY * sinX;
|
||||
this.k = cosY * cosX;
|
||||
}
|
||||
|
||||
public function method_344(axis:name_194, angle:Number) : void
|
||||
{
|
||||
var c1:Number = Number(Math.cos(angle));
|
||||
var s:Number = Number(Math.sin(angle));
|
||||
var t:Number = 1 - c1;
|
||||
var x:Number = axis.x;
|
||||
var y:Number = axis.y;
|
||||
var z:Number = axis.z;
|
||||
this.a = t * x * x + c1;
|
||||
this.b = t * x * y - z * s;
|
||||
this.c = t * x * z + y * s;
|
||||
this.e = t * x * y + z * s;
|
||||
this.f = t * y * y + c1;
|
||||
this.g = t * y * z - x * s;
|
||||
this.i = t * x * z - y * s;
|
||||
this.j = t * y * z + x * s;
|
||||
this.k = t * z * z + c1;
|
||||
}
|
||||
|
||||
public function clone() : Matrix3
|
||||
{
|
||||
return new Matrix3(this.a,this.b,this.c,this.e,this.f,this.g,this.i,this.j,this.k);
|
||||
}
|
||||
|
||||
public function toString() : String
|
||||
{
|
||||
return "[Matrix3 (" + this.a + ", " + this.b + ", " + this.c + "), (" + this.e + ", " + this.f + ", " + this.g + "), (" + this.i + ", " + this.j + ", " + this.k + ")]";
|
||||
}
|
||||
|
||||
public function name_341(angles:name_194) : void
|
||||
{
|
||||
if(-1 < this.i && this.i < 1)
|
||||
{
|
||||
angles.x = Math.atan2(this.j,this.k);
|
||||
angles.y = -Math.asin(this.i);
|
||||
angles.z = Math.atan2(this.e,this.a);
|
||||
}
|
||||
else
|
||||
{
|
||||
angles.x = 0;
|
||||
angles.y = this.i <= -1 ? Number(Math.PI) : -Math.PI;
|
||||
angles.y *= 0.5;
|
||||
angles.z = Math.atan2(-this.b,this.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
477
src/package_46/Matrix4.as
Normal file
477
src/package_46/Matrix4.as
Normal file
@@ -0,0 +1,477 @@
|
||||
package package_46
|
||||
{
|
||||
public class Matrix4
|
||||
{
|
||||
public static const IDENTITY:Matrix4 = new Matrix4();
|
||||
|
||||
public var a:Number;
|
||||
|
||||
public var b:Number;
|
||||
|
||||
public var c:Number;
|
||||
|
||||
public var d:Number;
|
||||
|
||||
public var e:Number;
|
||||
|
||||
public var f:Number;
|
||||
|
||||
public var g:Number;
|
||||
|
||||
public var h:Number;
|
||||
|
||||
public var i:Number;
|
||||
|
||||
public var j:Number;
|
||||
|
||||
public var k:Number;
|
||||
|
||||
public var l:Number;
|
||||
|
||||
public function Matrix4(a:Number = 1, b:Number = 0, c:Number = 0, d:Number = 0, e:Number = 0, f:Number = 1, g:Number = 0, h:Number = 0, i:Number = 0, j:Number = 0, k:Number = 1, l:Number = 0)
|
||||
{
|
||||
super();
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
this.g = g;
|
||||
this.h = h;
|
||||
this.i = i;
|
||||
this.j = j;
|
||||
this.k = k;
|
||||
this.l = l;
|
||||
}
|
||||
|
||||
public function method_347() : Matrix4
|
||||
{
|
||||
this.a = this.f = this.k = 1;
|
||||
this.b = this.c = this.e = this.g = this.i = this.j = this.d = this.h = this.l = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function invert() : Matrix4
|
||||
{
|
||||
var aa:Number = this.a;
|
||||
var bb:Number = this.b;
|
||||
var cc:Number = this.c;
|
||||
var dd:Number = this.d;
|
||||
var ee:Number = this.e;
|
||||
var ff:Number = this.f;
|
||||
var gg:Number = this.g;
|
||||
var hh:Number = this.h;
|
||||
var ii:Number = this.i;
|
||||
var jj:Number = this.j;
|
||||
var kk:Number = this.k;
|
||||
var ll:Number = this.l;
|
||||
var det:Number = -cc * ff * ii + bb * gg * ii + cc * ee * jj - aa * gg * jj - bb * ee * kk + aa * ff * kk;
|
||||
this.a = (-gg * jj + ff * kk) / det;
|
||||
this.b = (cc * jj - bb * kk) / det;
|
||||
this.c = (-cc * ff + bb * gg) / det;
|
||||
this.d = (dd * gg * jj - cc * hh * jj - dd * ff * kk + bb * hh * kk + cc * ff * ll - bb * gg * ll) / det;
|
||||
this.e = (gg * ii - ee * kk) / det;
|
||||
this.f = (-cc * ii + aa * kk) / det;
|
||||
this.g = (cc * ee - aa * gg) / det;
|
||||
this.h = (cc * hh * ii - dd * gg * ii + dd * ee * kk - aa * hh * kk - cc * ee * ll + aa * gg * ll) / det;
|
||||
this.i = (-ff * ii + ee * jj) / det;
|
||||
this.j = (bb * ii - aa * jj) / det;
|
||||
this.k = (-bb * ee + aa * ff) / det;
|
||||
this.l = (dd * ff * ii - bb * hh * ii - dd * ee * jj + aa * hh * jj + bb * ee * ll - aa * ff * ll) / det;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function append(m:Matrix4) : Matrix4
|
||||
{
|
||||
var aa:Number = this.a;
|
||||
var bb:Number = this.b;
|
||||
var cc:Number = this.c;
|
||||
var dd:Number = this.d;
|
||||
var ee:Number = this.e;
|
||||
var ff:Number = this.f;
|
||||
var gg:Number = this.g;
|
||||
var hh:Number = this.h;
|
||||
var ii:Number = this.i;
|
||||
var jj:Number = this.j;
|
||||
var kk:Number = this.k;
|
||||
var ll:Number = this.l;
|
||||
this.a = m.a * aa + m.b * ee + m.c * ii;
|
||||
this.b = m.a * bb + m.b * ff + m.c * jj;
|
||||
this.c = m.a * cc + m.b * gg + m.c * kk;
|
||||
this.d = m.a * dd + m.b * hh + m.c * ll + m.d;
|
||||
this.e = m.e * aa + m.f * ee + m.g * ii;
|
||||
this.f = m.e * bb + m.f * ff + m.g * jj;
|
||||
this.g = m.e * cc + m.f * gg + m.g * kk;
|
||||
this.h = m.e * dd + m.f * hh + m.g * ll + m.h;
|
||||
this.i = m.i * aa + m.j * ee + m.k * ii;
|
||||
this.j = m.i * bb + m.j * ff + m.k * jj;
|
||||
this.k = m.i * cc + m.j * gg + m.k * kk;
|
||||
this.l = m.i * dd + m.j * hh + m.k * ll + m.l;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function prepend(m:Matrix4) : Matrix4
|
||||
{
|
||||
var aa:Number = this.a;
|
||||
var bb:Number = this.b;
|
||||
var cc:Number = this.c;
|
||||
var dd:Number = this.d;
|
||||
var ee:Number = this.e;
|
||||
var ff:Number = this.f;
|
||||
var gg:Number = this.g;
|
||||
var hh:Number = this.h;
|
||||
var ii:Number = this.i;
|
||||
var jj:Number = this.j;
|
||||
var kk:Number = this.k;
|
||||
var ll:Number = this.l;
|
||||
this.a = aa * m.a + bb * m.e + cc * m.i;
|
||||
this.b = aa * m.b + bb * m.f + cc * m.j;
|
||||
this.c = aa * m.c + bb * m.g + cc * m.k;
|
||||
this.d = aa * m.d + bb * m.h + cc * m.l + dd;
|
||||
this.e = ee * m.a + ff * m.e + gg * m.i;
|
||||
this.f = ee * m.b + ff * m.f + gg * m.j;
|
||||
this.g = ee * m.c + ff * m.g + gg * m.k;
|
||||
this.h = ee * m.d + ff * m.h + gg * m.l + hh;
|
||||
this.i = ii * m.a + jj * m.e + kk * m.i;
|
||||
this.j = ii * m.b + jj * m.f + kk * m.j;
|
||||
this.k = ii * m.c + jj * m.g + kk * m.k;
|
||||
this.l = ii * m.d + jj * m.h + kk * m.l + ll;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function add(m:Matrix4) : Matrix4
|
||||
{
|
||||
this.a += m.a;
|
||||
this.b += m.b;
|
||||
this.c += m.c;
|
||||
this.d += m.d;
|
||||
this.e += m.e;
|
||||
this.f += m.f;
|
||||
this.g += m.g;
|
||||
this.h += m.h;
|
||||
this.i += m.i;
|
||||
this.j += m.j;
|
||||
this.k += m.k;
|
||||
this.l += m.l;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function subtract(m:Matrix4) : Matrix4
|
||||
{
|
||||
this.a -= m.a;
|
||||
this.b -= m.b;
|
||||
this.c -= m.c;
|
||||
this.d -= m.d;
|
||||
this.e -= m.e;
|
||||
this.f -= m.f;
|
||||
this.g -= m.g;
|
||||
this.h -= m.h;
|
||||
this.i -= m.i;
|
||||
this.j -= m.j;
|
||||
this.k -= m.k;
|
||||
this.l -= m.l;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_353(vin:name_194, vout:name_194) : void
|
||||
{
|
||||
vout.x = this.a * vin.x + this.b * vin.y + this.c * vin.z + this.d;
|
||||
vout.y = this.e * vin.x + this.f * vin.y + this.g * vin.z + this.h;
|
||||
vout.z = this.i * vin.x + this.j * vin.y + this.k * vin.z + this.l;
|
||||
}
|
||||
|
||||
public function transformPointTransposed(vin:name_194, vout:name_194) : void
|
||||
{
|
||||
var xx:Number = vin.x - this.d;
|
||||
var yy:Number = vin.y - this.h;
|
||||
var zz:Number = vin.z - this.l;
|
||||
vout.x = this.a * xx + this.e * yy + this.i * zz;
|
||||
vout.y = this.b * xx + this.f * yy + this.j * zz;
|
||||
vout.z = this.c * xx + this.g * yy + this.k * zz;
|
||||
}
|
||||
|
||||
public function method_354(arrin:Vector.<name_194>, arrout:Vector.<name_194>) : void
|
||||
{
|
||||
var vin:name_194 = null;
|
||||
var vout:name_194 = null;
|
||||
var len:int = int(arrin.length);
|
||||
for(var idx:int = 0; idx < len; idx++)
|
||||
{
|
||||
vin = arrin[idx];
|
||||
vout = arrout[idx];
|
||||
vout.x = this.a * vin.x + this.b * vin.y + this.c * vin.z + this.d;
|
||||
vout.y = this.e * vin.x + this.f * vin.y + this.g * vin.z + this.h;
|
||||
vout.z = this.i * vin.x + this.j * vin.y + this.k * vin.z + this.l;
|
||||
}
|
||||
}
|
||||
|
||||
public function method_357(arrin:Vector.<name_194>, arrout:Vector.<name_194>, len:int) : void
|
||||
{
|
||||
var vin:name_194 = null;
|
||||
var vout:name_194 = null;
|
||||
for(var idx:int = 0; idx < len; idx++)
|
||||
{
|
||||
vin = arrin[idx];
|
||||
vout = arrout[idx];
|
||||
vout.x = this.a * vin.x + this.b * vin.y + this.c * vin.z + this.d;
|
||||
vout.y = this.e * vin.x + this.f * vin.y + this.g * vin.z + this.h;
|
||||
vout.z = this.i * vin.x + this.j * vin.y + this.k * vin.z + this.l;
|
||||
}
|
||||
}
|
||||
|
||||
public function method_351(arrin:Vector.<name_194>, arrout:Vector.<name_194>) : void
|
||||
{
|
||||
var vin:name_194 = null;
|
||||
var vout:name_194 = null;
|
||||
var xx:Number = NaN;
|
||||
var yy:Number = NaN;
|
||||
var zz:Number = NaN;
|
||||
var len:int = int(arrin.length);
|
||||
for(var idx:int = 0; idx < len; idx++)
|
||||
{
|
||||
vin = arrin[idx];
|
||||
vout = arrout[idx];
|
||||
xx = vin.x - this.d;
|
||||
yy = vin.y - this.h;
|
||||
zz = vin.z - this.l;
|
||||
vout.x = this.a * xx + this.e * yy + this.i * zz;
|
||||
vout.y = this.b * xx + this.f * yy + this.j * zz;
|
||||
vout.z = this.c * xx + this.g * yy + this.k * zz;
|
||||
}
|
||||
}
|
||||
|
||||
public function method_352(arrin:Vector.<name_194>, arrout:Vector.<name_194>, len:int) : void
|
||||
{
|
||||
var vin:name_194 = null;
|
||||
var vout:name_194 = null;
|
||||
var xx:Number = NaN;
|
||||
var yy:Number = NaN;
|
||||
var zz:Number = NaN;
|
||||
for(var idx:int = 0; idx < len; idx++)
|
||||
{
|
||||
vin = arrin[idx];
|
||||
vout = arrout[idx];
|
||||
xx = vin.x - this.d;
|
||||
yy = vin.y - this.h;
|
||||
zz = vin.z - this.l;
|
||||
vout.x = this.a * xx + this.e * yy + this.i * zz;
|
||||
vout.y = this.b * xx + this.f * yy + this.j * zz;
|
||||
vout.z = this.c * xx + this.g * yy + this.k * zz;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAxis(idx:int, axis:name_194) : void
|
||||
{
|
||||
switch(idx)
|
||||
{
|
||||
case 0:
|
||||
axis.x = this.a;
|
||||
axis.y = this.e;
|
||||
axis.z = this.i;
|
||||
return;
|
||||
case 1:
|
||||
axis.x = this.b;
|
||||
axis.y = this.f;
|
||||
axis.z = this.j;
|
||||
return;
|
||||
case 2:
|
||||
axis.x = this.c;
|
||||
axis.y = this.g;
|
||||
axis.z = this.k;
|
||||
return;
|
||||
case 3:
|
||||
axis.x = this.d;
|
||||
axis.y = this.h;
|
||||
axis.z = this.l;
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public function method_356(xAxis:name_194, yAxis:name_194, zAxis:name_194, pos:name_194) : void
|
||||
{
|
||||
this.a = xAxis.x;
|
||||
this.e = xAxis.y;
|
||||
this.i = xAxis.z;
|
||||
this.b = yAxis.x;
|
||||
this.f = yAxis.y;
|
||||
this.j = yAxis.z;
|
||||
this.c = zAxis.x;
|
||||
this.g = zAxis.y;
|
||||
this.k = zAxis.z;
|
||||
this.d = pos.x;
|
||||
this.h = pos.y;
|
||||
this.l = pos.z;
|
||||
}
|
||||
|
||||
public function method_345(vin:name_194, vout:name_194) : void
|
||||
{
|
||||
vout.x = this.a * vin.x + this.b * vin.y + this.c * vin.z;
|
||||
vout.y = this.e * vin.x + this.f * vin.y + this.g * vin.z;
|
||||
vout.z = this.i * vin.x + this.j * vin.y + this.k * vin.z;
|
||||
}
|
||||
|
||||
public function method_346(vin:name_194, vout:name_194) : void
|
||||
{
|
||||
vout.x = this.a * vin.x + this.e * vin.y + this.i * vin.z;
|
||||
vout.y = this.b * vin.x + this.f * vin.y + this.j * vin.z;
|
||||
vout.z = this.c * vin.x + this.g * vin.y + this.k * vin.z;
|
||||
}
|
||||
|
||||
public function copy(m:Matrix4) : Matrix4
|
||||
{
|
||||
this.a = m.a;
|
||||
this.b = m.b;
|
||||
this.c = m.c;
|
||||
this.d = m.d;
|
||||
this.e = m.e;
|
||||
this.f = m.f;
|
||||
this.g = m.g;
|
||||
this.h = m.h;
|
||||
this.i = m.i;
|
||||
this.j = m.j;
|
||||
this.k = m.k;
|
||||
this.l = m.l;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_350(m:Matrix3, offset:name_194) : Matrix4
|
||||
{
|
||||
this.a = m.a;
|
||||
this.b = m.b;
|
||||
this.c = m.c;
|
||||
this.d = offset.x;
|
||||
this.e = m.e;
|
||||
this.f = m.f;
|
||||
this.g = m.g;
|
||||
this.h = offset.y;
|
||||
this.i = m.i;
|
||||
this.j = m.j;
|
||||
this.k = m.k;
|
||||
this.l = offset.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_355(m:Matrix3) : Matrix4
|
||||
{
|
||||
this.a = m.a;
|
||||
this.b = m.b;
|
||||
this.c = m.c;
|
||||
this.e = m.e;
|
||||
this.f = m.f;
|
||||
this.g = m.g;
|
||||
this.i = m.i;
|
||||
this.j = m.j;
|
||||
this.k = m.k;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function name_341(angles:name_194) : void
|
||||
{
|
||||
if(-1 < this.i && this.i < 1)
|
||||
{
|
||||
angles.x = Math.atan2(this.j,this.k);
|
||||
angles.y = -Math.asin(this.i);
|
||||
angles.z = Math.atan2(this.e,this.a);
|
||||
}
|
||||
else
|
||||
{
|
||||
angles.x = 0;
|
||||
angles.y = this.i <= -1 ? Number(Math.PI) : -Math.PI;
|
||||
angles.y *= 0.5;
|
||||
angles.z = Math.atan2(-this.b,this.f);
|
||||
}
|
||||
}
|
||||
|
||||
public function name_201(pos:name_194) : void
|
||||
{
|
||||
this.d = pos.x;
|
||||
this.h = pos.y;
|
||||
this.l = pos.z;
|
||||
}
|
||||
|
||||
public function name_75(x:Number, y:Number, z:Number) : void
|
||||
{
|
||||
this.d = x;
|
||||
this.h = y;
|
||||
this.l = z;
|
||||
}
|
||||
|
||||
public function clone() : Matrix4
|
||||
{
|
||||
return new Matrix4(this.a,this.b,this.c,this.d,this.e,this.f,this.g,this.h,this.i,this.j,this.k,this.l);
|
||||
}
|
||||
|
||||
public function toString() : String
|
||||
{
|
||||
return "[Matrix4 [" + this.a.toFixed(3) + " " + this.b.toFixed(3) + " " + this.c.toFixed(3) + " " + this.d.toFixed(3) + "] [" + this.e.toFixed(3) + " " + this.f.toFixed(3) + " " + this.g.toFixed(3) + " " + this.h.toFixed(3) + "] [" + this.i.toFixed(3) + " " + this.j.toFixed(3) + " " + this.k.toFixed(3) + " " + this.l.toFixed(3) + "]]";
|
||||
}
|
||||
|
||||
public function name_196(rx:Number, ry:Number, rz:Number) : void
|
||||
{
|
||||
var cosX:Number = Number(Math.cos(rx));
|
||||
var sinX:Number = Number(Math.sin(rx));
|
||||
var cosY:Number = Number(Math.cos(ry));
|
||||
var sinY:Number = Number(Math.sin(ry));
|
||||
var cosZ:Number = Number(Math.cos(rz));
|
||||
var sinZ:Number = Number(Math.sin(rz));
|
||||
var cosZsinY:Number = cosZ * sinY;
|
||||
var sinZsinY:Number = sinZ * sinY;
|
||||
this.a = cosZ * cosY;
|
||||
this.b = cosZsinY * sinX - sinZ * cosX;
|
||||
this.c = cosZsinY * cosX + sinZ * sinX;
|
||||
this.e = sinZ * cosY;
|
||||
this.f = sinZsinY * sinX + cosZ * cosX;
|
||||
this.g = sinZsinY * cosX - cosZ * sinX;
|
||||
this.i = -sinY;
|
||||
this.j = cosY * sinX;
|
||||
this.k = cosY * cosX;
|
||||
}
|
||||
|
||||
public function setMatrix(x:Number, y:Number, z:Number, rx:Number, ry:Number, rz:Number) : void
|
||||
{
|
||||
this.d = x;
|
||||
this.h = y;
|
||||
this.l = z;
|
||||
var cosX:Number = Number(Math.cos(rx));
|
||||
var sinX:Number = Number(Math.sin(rx));
|
||||
var cosY:Number = Number(Math.cos(ry));
|
||||
var sinY:Number = Number(Math.sin(ry));
|
||||
var cosZ:Number = Number(Math.cos(rz));
|
||||
var sinZ:Number = Number(Math.sin(rz));
|
||||
var cosZsinY:Number = cosZ * sinY;
|
||||
var sinZsinY:Number = sinZ * sinY;
|
||||
this.a = cosZ * cosY;
|
||||
this.b = cosZsinY * sinX - sinZ * cosX;
|
||||
this.c = cosZsinY * cosX + sinZ * sinX;
|
||||
this.e = sinZ * cosY;
|
||||
this.f = sinZsinY * sinX + cosZ * cosX;
|
||||
this.g = sinZsinY * cosX - cosZ * sinX;
|
||||
this.i = -sinY;
|
||||
this.j = cosY * sinX;
|
||||
this.k = cosY * cosX;
|
||||
}
|
||||
|
||||
public function method_344(axis:name_194, angle:Number) : void
|
||||
{
|
||||
var c1:Number = Number(Math.cos(angle));
|
||||
var s:Number = Number(Math.sin(angle));
|
||||
var t:Number = 1 - c1;
|
||||
var x:Number = axis.x;
|
||||
var y:Number = axis.y;
|
||||
var z:Number = axis.z;
|
||||
this.a = t * x * x + c1;
|
||||
this.b = t * x * y - z * s;
|
||||
this.c = t * x * z + y * s;
|
||||
this.e = t * x * y + z * s;
|
||||
this.f = t * y * y + c1;
|
||||
this.g = t * y * z - x * s;
|
||||
this.i = t * x * z - y * s;
|
||||
this.j = t * y * z + x * s;
|
||||
this.k = t * z * z + c1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
272
src/package_46/name_194.as
Normal file
272
src/package_46/name_194.as
Normal file
@@ -0,0 +1,272 @@
|
||||
package package_46
|
||||
{
|
||||
import flash.geom.Vector3D;
|
||||
|
||||
public class name_194
|
||||
{
|
||||
public static const ZERO:name_194 = new name_194(0,0,0);
|
||||
|
||||
public static const X_AXIS:name_194 = new name_194(1,0,0);
|
||||
|
||||
public static const Y_AXIS:name_194 = new name_194(0,1,0);
|
||||
|
||||
public static const Z_AXIS:name_194 = new name_194(0,0,1);
|
||||
|
||||
public static const RIGHT:name_194 = new name_194(1,0,0);
|
||||
|
||||
public static const LEFT:name_194 = new name_194(-1,0,0);
|
||||
|
||||
public static const FORWARD:name_194 = new name_194(0,1,0);
|
||||
|
||||
public static const BACK:name_194 = new name_194(0,-1,0);
|
||||
|
||||
public static const UP:name_194 = new name_194(0,0,1);
|
||||
|
||||
public static const DOWN:name_194 = new name_194(0,0,-1);
|
||||
|
||||
public var x:Number;
|
||||
|
||||
public var y:Number;
|
||||
|
||||
public var z:Number;
|
||||
|
||||
public function name_194(x:Number = 0, y:Number = 0, z:Number = 0)
|
||||
{
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public function length() : Number
|
||||
{
|
||||
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
||||
}
|
||||
|
||||
public function method_365() : Number
|
||||
{
|
||||
return this.x * this.x + this.y * this.y + this.z * this.z;
|
||||
}
|
||||
|
||||
public function method_358(length:Number) : name_194
|
||||
{
|
||||
var k:Number = NaN;
|
||||
var d:Number = this.x * this.x + this.y * this.y + this.z * this.z;
|
||||
if(d == 0)
|
||||
{
|
||||
this.x = length;
|
||||
}
|
||||
else
|
||||
{
|
||||
k = length / Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
||||
this.x *= k;
|
||||
this.y *= k;
|
||||
this.z *= k;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public function normalize() : name_194
|
||||
{
|
||||
var d:Number = this.x * this.x + this.y * this.y + this.z * this.z;
|
||||
if(d == 0)
|
||||
{
|
||||
this.x = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
d = Number(Math.sqrt(d));
|
||||
this.x /= d;
|
||||
this.y /= d;
|
||||
this.z /= d;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public function add(v:name_194) : name_194
|
||||
{
|
||||
this.x += v.x;
|
||||
this.y += v.y;
|
||||
this.z += v.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_362(k:Number, v:name_194) : name_194
|
||||
{
|
||||
this.x += k * v.x;
|
||||
this.y += k * v.y;
|
||||
this.z += k * v.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function subtract(v:name_194) : name_194
|
||||
{
|
||||
this.x -= v.x;
|
||||
this.y -= v.y;
|
||||
this.z -= v.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function sum(a:name_194, b:name_194) : name_194
|
||||
{
|
||||
this.x = a.x + b.x;
|
||||
this.y = a.y + b.y;
|
||||
this.z = a.z + b.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_366(a:name_194, b:name_194) : name_194
|
||||
{
|
||||
this.x = a.x - b.x;
|
||||
this.y = a.y - b.y;
|
||||
this.z = a.z - b.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function scale(k:Number) : name_194
|
||||
{
|
||||
this.x *= k;
|
||||
this.y *= k;
|
||||
this.z *= k;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function reverse() : name_194
|
||||
{
|
||||
this.x = -this.x;
|
||||
this.y = -this.y;
|
||||
this.z = -this.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function dot(v:name_194) : Number
|
||||
{
|
||||
return this.x * v.x + this.y * v.y + this.z * v.z;
|
||||
}
|
||||
|
||||
public function method_360(v:name_194) : name_194
|
||||
{
|
||||
var xx:Number = this.y * v.z - this.z * v.y;
|
||||
var yy:Number = this.z * v.x - this.x * v.z;
|
||||
var zz:Number = this.x * v.y - this.y * v.x;
|
||||
this.x = xx;
|
||||
this.y = yy;
|
||||
this.z = zz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function cross2(a:name_194, b:name_194) : name_194
|
||||
{
|
||||
this.x = a.y * b.z - a.z * b.y;
|
||||
this.y = a.z * b.x - a.x * b.z;
|
||||
this.z = a.x * b.y - a.y * b.x;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function transform3(m:Matrix3) : name_194
|
||||
{
|
||||
var xx:Number = this.x;
|
||||
var yy:Number = this.y;
|
||||
var zz:Number = this.z;
|
||||
this.x = m.a * xx + m.b * yy + m.c * zz;
|
||||
this.y = m.e * xx + m.f * yy + m.g * zz;
|
||||
this.z = m.i * xx + m.j * yy + m.k * zz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function transformTransposed3(m:Matrix3) : name_194
|
||||
{
|
||||
var xx:Number = this.x;
|
||||
var yy:Number = this.y;
|
||||
var zz:Number = this.z;
|
||||
this.x = m.a * xx + m.e * yy + m.i * zz;
|
||||
this.y = m.b * xx + m.f * yy + m.j * zz;
|
||||
this.z = m.c * xx + m.g * yy + m.k * zz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function transform4(m:Matrix4) : name_194
|
||||
{
|
||||
var xx:Number = this.x;
|
||||
var yy:Number = this.y;
|
||||
var zz:Number = this.z;
|
||||
this.x = m.a * xx + m.b * yy + m.c * zz + m.d;
|
||||
this.y = m.e * xx + m.f * yy + m.g * zz + m.h;
|
||||
this.z = m.i * xx + m.j * yy + m.k * zz + m.l;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function transformTransposed4(m:Matrix4) : name_194
|
||||
{
|
||||
var xx:Number = this.x - m.d;
|
||||
var yy:Number = this.y - m.h;
|
||||
var zz:Number = this.z - m.l;
|
||||
this.x = m.a * xx + m.e * yy + m.i * zz;
|
||||
this.y = m.b * xx + m.f * yy + m.j * zz;
|
||||
this.z = m.c * xx + m.g * yy + m.k * zz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_359(m:Matrix4) : name_194
|
||||
{
|
||||
var xx:Number = this.x;
|
||||
var yy:Number = this.y;
|
||||
var zz:Number = this.z;
|
||||
this.x = m.a * xx + m.b * yy + m.c * zz;
|
||||
this.y = m.e * xx + m.f * yy + m.g * zz;
|
||||
this.z = m.i * xx + m.j * yy + m.k * zz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function reset(x:Number = 0, y:Number = 0, z:Number = 0) : name_194
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function copy(v:name_194) : name_194
|
||||
{
|
||||
this.x = v.x;
|
||||
this.y = v.y;
|
||||
this.z = v.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function clone() : name_194
|
||||
{
|
||||
return new name_194(this.x,this.y,this.z);
|
||||
}
|
||||
|
||||
public function method_363(result:Vector3D) : Vector3D
|
||||
{
|
||||
result.x = this.x;
|
||||
result.y = this.y;
|
||||
result.z = this.z;
|
||||
return result;
|
||||
}
|
||||
|
||||
public function method_361(source:Vector3D) : name_194
|
||||
{
|
||||
this.x = source.x;
|
||||
this.y = source.y;
|
||||
this.z = source.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_364(v:name_194) : Number
|
||||
{
|
||||
var dx:Number = this.x - v.x;
|
||||
var dy:Number = this.y - v.y;
|
||||
var dz:Number = this.z - v.z;
|
||||
return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
||||
}
|
||||
|
||||
public function toString() : String
|
||||
{
|
||||
return "Vector3(" + this.x + ", " + this.y + ", " + this.z + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
455
src/package_46/name_566.as
Normal file
455
src/package_46/name_566.as
Normal file
@@ -0,0 +1,455 @@
|
||||
package package_46
|
||||
{
|
||||
import flash.geom.Vector3D;
|
||||
|
||||
public class name_566
|
||||
{
|
||||
public static const IDENTITY:name_566 = new name_566();
|
||||
|
||||
private static var _q:name_566 = new name_566();
|
||||
|
||||
public var w:Number;
|
||||
|
||||
public var x:Number;
|
||||
|
||||
public var y:Number;
|
||||
|
||||
public var z:Number;
|
||||
|
||||
public function name_566(w:Number = 1, x:Number = 0, y:Number = 0, z:Number = 0)
|
||||
{
|
||||
super();
|
||||
this.w = w;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public static function method_552(q1:name_566, q2:name_566, result:name_566) : void
|
||||
{
|
||||
result.w = q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z;
|
||||
result.x = q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y;
|
||||
result.y = q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z;
|
||||
result.z = q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x;
|
||||
}
|
||||
|
||||
public static function method_771(axis:name_194, angle:Number) : name_566
|
||||
{
|
||||
var q:name_566 = new name_566();
|
||||
q.method_764(axis,angle);
|
||||
return q;
|
||||
}
|
||||
|
||||
public static function method_765(x:Number, y:Number, z:Number, angle:Number) : name_566
|
||||
{
|
||||
var q:name_566 = new name_566();
|
||||
q.method_763(x,y,z,angle);
|
||||
return q;
|
||||
}
|
||||
|
||||
public static function method_767(x:Number, y:Number, z:Number) : name_566
|
||||
{
|
||||
var q:name_566 = new name_566();
|
||||
q.method_763(1,0,0,x);
|
||||
_q.method_763(0,1,0,y);
|
||||
q.append(_q);
|
||||
q.normalize();
|
||||
_q.method_763(0,0,1,z);
|
||||
q.append(_q);
|
||||
q.normalize();
|
||||
return q;
|
||||
}
|
||||
|
||||
public function reset(w:Number = 1, x:Number = 0, y:Number = 0, z:Number = 0) : name_566
|
||||
{
|
||||
this.w = w;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function normalize() : name_566
|
||||
{
|
||||
var d:Number = this.w * this.w + this.x * this.x + this.y * this.y + this.z * this.z;
|
||||
if(d == 0)
|
||||
{
|
||||
this.w = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
d = 1 / Math.sqrt(d);
|
||||
this.w *= d;
|
||||
this.x *= d;
|
||||
this.y *= d;
|
||||
this.z *= d;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public function prepend(q:name_566) : name_566
|
||||
{
|
||||
var ww:Number = this.w * q.w - this.x * q.x - this.y * q.y - this.z * q.z;
|
||||
var xx:Number = this.w * q.x + this.x * q.w + this.y * q.z - this.z * q.y;
|
||||
var yy:Number = this.w * q.y + this.y * q.w + this.z * q.x - this.x * q.z;
|
||||
var zz:Number = this.w * q.z + this.z * q.w + this.x * q.y - this.y * q.x;
|
||||
this.w = ww;
|
||||
this.x = xx;
|
||||
this.y = yy;
|
||||
this.z = zz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function append(q:name_566) : name_566
|
||||
{
|
||||
var ww:Number = q.w * this.w - q.x * this.x - q.y * this.y - q.z * this.z;
|
||||
var xx:Number = q.w * this.x + q.x * this.w + q.y * this.z - q.z * this.y;
|
||||
var yy:Number = q.w * this.y + q.y * this.w + q.z * this.x - q.x * this.z;
|
||||
var zz:Number = q.w * this.z + q.z * this.w + q.x * this.y - q.y * this.x;
|
||||
this.w = ww;
|
||||
this.x = xx;
|
||||
this.y = yy;
|
||||
this.z = zz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_772(v:name_194) : name_566
|
||||
{
|
||||
var ww:Number = -v.x * this.x - v.y * this.y - v.z * this.z;
|
||||
var xx:Number = v.x * this.w + v.y * this.z - v.z * this.y;
|
||||
var yy:Number = v.y * this.w + v.z * this.x - v.x * this.z;
|
||||
var zz:Number = v.z * this.w + v.x * this.y - v.y * this.x;
|
||||
this.w = ww;
|
||||
this.x = xx;
|
||||
this.y = yy;
|
||||
this.z = zz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function name_603(v:name_194, scale:Number) : name_566
|
||||
{
|
||||
var vx:Number = v.x * scale;
|
||||
var vy:Number = v.y * scale;
|
||||
var vz:Number = v.z * scale;
|
||||
var ww:Number = -this.x * vx - this.y * vy - this.z * vz;
|
||||
var xx:Number = vx * this.w + vy * this.z - vz * this.y;
|
||||
var yy:Number = vy * this.w + vz * this.x - vx * this.z;
|
||||
var zz:Number = vz * this.w + vx * this.y - vy * this.x;
|
||||
this.w += 0.5 * ww;
|
||||
this.x += 0.5 * xx;
|
||||
this.y += 0.5 * yy;
|
||||
this.z += 0.5 * zz;
|
||||
var d:Number = this.w * this.w + this.x * this.x + this.y * this.y + this.z * this.z;
|
||||
if(d == 0)
|
||||
{
|
||||
this.w = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
d = 1 / Math.sqrt(d);
|
||||
this.w *= d;
|
||||
this.x *= d;
|
||||
this.y *= d;
|
||||
this.z *= d;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public function toMatrix3(m:Matrix3) : name_566
|
||||
{
|
||||
var xx2:Number = NaN;
|
||||
var yy2:Number = NaN;
|
||||
var zz2:Number = NaN;
|
||||
var yz2:Number = NaN;
|
||||
var zx2:Number = NaN;
|
||||
var wx2:Number = NaN;
|
||||
xx2 = 2 * this.x * this.x;
|
||||
yy2 = 2 * this.y * this.y;
|
||||
zz2 = 2 * this.z * this.z;
|
||||
var xy2:Number = 2 * this.x * this.y;
|
||||
yz2 = 2 * this.y * this.z;
|
||||
zx2 = 2 * this.z * this.x;
|
||||
wx2 = 2 * this.w * this.x;
|
||||
var wy2:Number = 2 * this.w * this.y;
|
||||
var wz2:Number = 2 * this.w * this.z;
|
||||
m.a = 1 - yy2 - zz2;
|
||||
m.b = xy2 - wz2;
|
||||
m.c = zx2 + wy2;
|
||||
m.e = xy2 + wz2;
|
||||
m.f = 1 - xx2 - zz2;
|
||||
m.g = yz2 - wx2;
|
||||
m.i = zx2 - wy2;
|
||||
m.j = yz2 + wx2;
|
||||
m.k = 1 - xx2 - yy2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function toMatrix4(m:Matrix4) : name_566
|
||||
{
|
||||
var zz2:Number = NaN;
|
||||
var xy2:Number = NaN;
|
||||
var yz2:Number = NaN;
|
||||
var wx2:Number = NaN;
|
||||
var wy2:Number = NaN;
|
||||
var xx2:Number = 2 * this.x * this.x;
|
||||
var yy2:Number = 2 * this.y * this.y;
|
||||
zz2 = 2 * this.z * this.z;
|
||||
xy2 = 2 * this.x * this.y;
|
||||
yz2 = 2 * this.y * this.z;
|
||||
var zx2:Number = 2 * this.z * this.x;
|
||||
wx2 = 2 * this.w * this.x;
|
||||
wy2 = 2 * this.w * this.y;
|
||||
var wz2:Number = 2 * this.w * this.z;
|
||||
m.a = 1 - yy2 - zz2;
|
||||
m.b = xy2 - wz2;
|
||||
m.c = zx2 + wy2;
|
||||
m.e = xy2 + wz2;
|
||||
m.f = 1 - xx2 - zz2;
|
||||
m.g = yz2 - wx2;
|
||||
m.i = zx2 - wy2;
|
||||
m.j = yz2 + wx2;
|
||||
m.k = 1 - xx2 - yy2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function length() : Number
|
||||
{
|
||||
return Math.sqrt(this.w * this.w + this.x * this.x + this.y * this.y + this.z * this.z);
|
||||
}
|
||||
|
||||
public function method_365() : Number
|
||||
{
|
||||
return this.w * this.w + this.x * this.x + this.y * this.y + this.z * this.z;
|
||||
}
|
||||
|
||||
public function method_764(axis:name_194, angle:Number) : name_566
|
||||
{
|
||||
this.w = Math.cos(0.5 * angle);
|
||||
var k:Number = Math.sin(0.5 * angle) / Math.sqrt(axis.x * axis.x + axis.y * axis.y + axis.z * axis.z);
|
||||
this.x = axis.x * k;
|
||||
this.y = axis.y * k;
|
||||
this.z = axis.z * k;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_763(x:Number, y:Number, z:Number, angle:Number) : name_566
|
||||
{
|
||||
this.w = Math.cos(0.5 * angle);
|
||||
var k:Number = Math.sin(0.5 * angle) / Math.sqrt(x * x + y * y + z * z);
|
||||
this.x = x * k;
|
||||
this.y = y * k;
|
||||
this.z = z * k;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_770(v:name_194 = null) : name_194
|
||||
{
|
||||
var angle:Number = NaN;
|
||||
var coeff:Number = NaN;
|
||||
if(this.w < -1 || this.w > 1)
|
||||
{
|
||||
this.normalize();
|
||||
}
|
||||
if(v == null)
|
||||
{
|
||||
v = new name_194();
|
||||
}
|
||||
if(this.w > -1 && this.w < 1)
|
||||
{
|
||||
if(this.w == 0)
|
||||
{
|
||||
v.x = this.x;
|
||||
v.y = this.y;
|
||||
v.z = this.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle = 2 * Math.acos(this.w);
|
||||
coeff = 1 / Math.sqrt(1 - this.w * this.w);
|
||||
v.x = this.x * coeff * angle;
|
||||
v.y = this.y * coeff * angle;
|
||||
v.z = this.z * coeff * angle;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
v.x = 0;
|
||||
v.y = 0;
|
||||
v.z = 0;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public function name_341(angles:name_194) : name_194
|
||||
{
|
||||
var qi2:Number = 2 * this.x * this.x;
|
||||
var qj2:Number = 2 * this.y * this.y;
|
||||
var qk2:Number = 2 * this.z * this.z;
|
||||
var qij:Number = 2 * this.x * this.y;
|
||||
var qjk:Number = 2 * this.y * this.z;
|
||||
var qki:Number = 2 * this.z * this.x;
|
||||
var qri:Number = 2 * this.w * this.x;
|
||||
var qrj:Number = 2 * this.w * this.y;
|
||||
var qrk:Number = 2 * this.w * this.z;
|
||||
var aa:Number = 1 - qj2 - qk2;
|
||||
var bb:Number = qij - qrk;
|
||||
var ee:Number = qij + qrk;
|
||||
var ff:Number = 1 - qi2 - qk2;
|
||||
var ii:Number = qki - qrj;
|
||||
var jj:Number = qjk + qri;
|
||||
var kk:Number = 1 - qi2 - qj2;
|
||||
if(-1 < ii && ii < 1)
|
||||
{
|
||||
if(angles == null)
|
||||
{
|
||||
angles = new name_194(Math.atan2(jj,kk),-Math.asin(ii),Math.atan2(ee,aa));
|
||||
}
|
||||
else
|
||||
{
|
||||
angles.x = Math.atan2(jj,kk);
|
||||
angles.y = -Math.asin(ii);
|
||||
angles.z = Math.atan2(ee,aa);
|
||||
}
|
||||
}
|
||||
else if(angles == null)
|
||||
{
|
||||
angles = new name_194(0,0.5 * (ii <= -1 ? Math.PI : -Math.PI),Math.atan2(-bb,ff));
|
||||
}
|
||||
else
|
||||
{
|
||||
angles.x = 0;
|
||||
angles.y = ii <= -1 ? Number(Math.PI) : -Math.PI;
|
||||
angles.y *= 0.5;
|
||||
angles.z = Math.atan2(-bb,ff);
|
||||
}
|
||||
return angles;
|
||||
}
|
||||
|
||||
public function method_768(x:Number, y:Number, z:Number) : void
|
||||
{
|
||||
this.method_763(1,0,0,x);
|
||||
_q.method_763(0,1,0,y);
|
||||
this.append(_q);
|
||||
this.normalize();
|
||||
_q.method_763(0,0,1,z);
|
||||
this.append(_q);
|
||||
this.normalize();
|
||||
}
|
||||
|
||||
public function method_769() : void
|
||||
{
|
||||
this.x = -this.x;
|
||||
this.y = -this.y;
|
||||
this.z = -this.z;
|
||||
}
|
||||
|
||||
public function method_766(q1:name_566, q2:name_566, t:Number) : name_566
|
||||
{
|
||||
var d:Number = 1 - t;
|
||||
this.w = q1.w * d + q2.w * t;
|
||||
this.x = q1.x * d + q2.x * t;
|
||||
this.y = q1.y * d + q2.y * t;
|
||||
this.z = q1.z * d + q2.z * t;
|
||||
d = this.w * this.w + this.x * this.x + this.y * this.y + this.z * this.z;
|
||||
if(d == 0)
|
||||
{
|
||||
this.w = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
d = 1 / Math.sqrt(d);
|
||||
this.w *= d;
|
||||
this.x *= d;
|
||||
this.y *= d;
|
||||
this.z *= d;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public function subtract(q:name_566) : name_566
|
||||
{
|
||||
this.w -= q.w;
|
||||
this.x -= q.x;
|
||||
this.y -= q.y;
|
||||
this.z -= q.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_366(q1:name_566, q2:name_566) : name_566
|
||||
{
|
||||
this.w = q2.w - q1.w;
|
||||
this.x = q2.x - q1.x;
|
||||
this.y = q2.y - q1.y;
|
||||
this.z = q2.z - q1.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function copy(q:name_566) : name_566
|
||||
{
|
||||
this.w = q.w;
|
||||
this.x = q.x;
|
||||
this.y = q.y;
|
||||
this.z = q.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public function method_363(result:Vector3D) : Vector3D
|
||||
{
|
||||
result.x = this.x;
|
||||
result.y = this.y;
|
||||
result.z = this.z;
|
||||
result.w = this.w;
|
||||
return result;
|
||||
}
|
||||
|
||||
public function clone() : name_566
|
||||
{
|
||||
return new name_566(this.w,this.x,this.y,this.z);
|
||||
}
|
||||
|
||||
public function toString() : String
|
||||
{
|
||||
return "[" + this.w + ", " + this.x + ", " + this.y + ", " + this.z + "]";
|
||||
}
|
||||
|
||||
public function name_602(a:name_566, b:name_566, t:Number) : name_566
|
||||
{
|
||||
var k1:Number = NaN;
|
||||
var k2:Number = NaN;
|
||||
var theta:Number = NaN;
|
||||
var sine:Number = NaN;
|
||||
var beta:Number = NaN;
|
||||
var alpha:Number = NaN;
|
||||
var flip:Number = 1;
|
||||
var cosine:Number = a.w * b.w + a.x * b.x + a.y * b.y + a.z * b.z;
|
||||
if(cosine < 0)
|
||||
{
|
||||
cosine = -cosine;
|
||||
flip = -1;
|
||||
}
|
||||
if(1 - cosine < 0.001)
|
||||
{
|
||||
k1 = 1 - t;
|
||||
k2 = t * flip;
|
||||
this.w = a.w * k1 + b.w * k2;
|
||||
this.x = a.x * k1 + b.x * k2;
|
||||
this.y = a.y * k1 + b.y * k2;
|
||||
this.z = a.z * k1 + b.z * k2;
|
||||
this.normalize();
|
||||
}
|
||||
else
|
||||
{
|
||||
theta = Number(Math.acos(cosine));
|
||||
sine = Number(Math.sin(theta));
|
||||
beta = Math.sin((1 - t) * theta) / sine;
|
||||
alpha = Math.sin(t * theta) / sine * flip;
|
||||
this.w = a.w * beta + b.w * alpha;
|
||||
this.x = a.x * beta + b.x * alpha;
|
||||
this.y = a.y * beta + b.y * alpha;
|
||||
this.z = a.z * beta + b.z * alpha;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user