Frame 1
function Vector2(x, y) {
this.x = x;
this.y = y;
}
Vector2.prototype.ToString = function () {
return(((("(" + this.x) + ",") + this.y) + ")");
};
Vector2.prototype.clone = function () {
var _local1 = new Vector2(this.x, this.y);
return(_local1);
};
Vector2.prototype.plus = function (v2) {
var _local1 = new Vector2(this.x + v2.x, this.y + v2.y);
return(_local1);
};
Vector2.prototype.minus = function (v2) {
var _local1 = new Vector2(this.x - v2.x, this.y - v2.y);
return(_local1);
};
Vector2.prototype.normR = function () {
var _local1 = new Vector2(this.y * -1, this.x);
return(_local1);
};
Vector2.prototype.dir = function () {
var _local1 = this.clone();
_local1.normalize();
return(_local1);
};
Vector2.prototype.proj = function (v2) {
var _local3 = v2;
var _local2 = _local3.dot(_local3);
if (_local2 == 0) {
trace("WARNING! Vector2.proj() was given a zero-length projection vector!");
var _local1 = this.clone();
} else {
var _local1 = _local3.clone();
_local1.mult(this.dot(_local3) / _local2);
}
return(_local1);
};
Vector2.prototype.projLen = function (v2) {
var _local2 = v2;
var _local1 = _local2.dot(_local2);
if (_local1 == 0) {
trace("WARNING! Vector2.projLen() was given a zero-length projection vector!");
return(0);
}
return(Math.abs(this.dot(_local2) / _local1));
};
Vector2.prototype.dot = function (v2) {
return((this.x * v2.x) + (this.y * v2.y));
};
Vector2.prototype.cross = function (v2) {
return((this.x * v2.y) - (this.y * v2.x));
};
Vector2.prototype.len = function () {
var _local1 = this;
return(Math.sqrt((_local1.x * _local1.x) + (_local1.y * _local1.y)));
};
Vector2.prototype.copy = function (v2) {
this.x = v2.x;
this.y = v2.y;
};
Vector2.prototype.mult = function (s) {
this.x = this.x * s;
this.y = this.y * s;
};
Vector2.prototype.normalize = function () {
var _local2 = this;
var _local1 = _local2.len();
if (_local1 != 0) {
_local2.x = _local2.x / _local1;
_local2.y = _local2.y / _local1;
} else {
trace("WARNING! Vector2.normalize() was called on a zero-length vector!");
}
};
Vector2.prototype.pluseq = function (v2) {
this.x = this.x + v2.x;
this.y = this.y + v2.y;
};
Vector2.prototype.minuseq = function (v2) {
this.x = this.x - v2.x;
this.y = this.y - v2.y;
};
function InputManager() {
var _local1 = this;
_local1.vrend = new VectorRenderer();
_local1.mPos = new Vector2(_local1.vrend.buffer._xmouse, _local1.vrend.buffer._ymouse);
_local1.mOldpos = new Vector2(_local1.vrend.buffer._xmouse, _local1.vrend.buffer._ymouse);
_local1.mDelta = new Vector2(0, 0);
_local1.mDownPos = new Vector2(0, 0);
_local1.mUpPos = new Vector2(0, 0);
_local1.onMouseDown = _local1.CaptureMouseDown;
_local1.onMouseUp = _local1.CaptureMouseUp;
Mouse.addListener(_local1);
_local1.mState = false;
_local1.mOldState = false;
_local1.mPressed = false;
_local1.mReleased = false;
_local1.kCode = new Array();
_local1.kState = new Array();
_local1.kOldState = new Array();
_local1.tKey = new Array();
_local1.tState = new Array();
}
InputManager.prototype.RegisterKey = function (knum) {
var _local2 = this;
var _local1 = _local2.kCode.length;
_local2.kCode.push(knum);
_local2.kState[_local1] = false;
_local2.kOldState[_local1] = false;
return(_local1);
};
InputManager.prototype.RegisterToggle = function (knum) {
var _local1 = this;
var _local2 = _local1.tKey.length;
_local1.tKey.push(_local1.RegisterKey(knum));
_local1.tState[_local2] = false;
return(_local2);
};
InputManager.prototype.Update = function () {
var _local1 = this;
_local1.mOldpos.copy(_local1.mPos);
_local1.mPos.x = _local1.vrend.buffer._xmouse;
_local1.mPos.y = _local1.vrend.buffer._ymouse;
_local1.mDelta = _local1.mPos.minus(_local1.mOldpos);
if (_local1.mState && (!_local1.mOldState)) {
_local1.mPressed = true;
_local1.mOldState = true;
_local1.mDownPos.x = _local1.mPos.x;
_local1.mDownPos.y = _local1.mPos.y;
} else {
_local1.mPressed = false;
}
if ((!_local1.mState) && (_local1.mOldState)) {
_local1.mReleased = true;
_local1.mOldState = false;
_local1.mUpPos.x = _local1.mPos.x;
_local1.mUpPos.y = _local1.mPos.y;
} else {
_local1.mReleased = false;
}
if (_local1.mState) {
_local1.mUpPos.x = _local1.mPos.x;
_local1.mUpPos.y = _local1.mPos.y;
}
var _local2 = 0;
while (_local2 < _local1.kCode.length) {
_local1.kOldState[_local2] = Key.isDown(_local1.kCode[_local2]);
_local2++;
}
var _local3 = _local1.kOldState;
_local1.kOldState = _local1.kState;
_local1.kState = _local3;
_local2 = 0;
while (_local2 < _local1.tKey.length) {
if (_local1.Pressed(_local1.tKey[_local2])) {
_local1.tState[_local2] = !_local1.tState[_local2];
}
_local2++;
}
};
InputManager.prototype.CaptureMouseDown = function () {
this.mOldState = false;
this.mState = true;
};
InputManager.prototype.CaptureMouseUp = function () {
this.mOldState = true;
this.mState = false;
};
InputManager.prototype.getMousePos = function () {
return(this.mPos.clone());
};
InputManager.prototype.getMouseDelta = function () {
return(this.mDelta.clone());
};
InputManager.prototype.getMouseDragDelta = function () {
return(this.mUpPos.minus(this.mDownPos));
};
InputManager.prototype.getMouseDownPos = function () {
return(this.mDownPos.clone());
};
InputManager.prototype.getMouseUpPos = function () {
return(this.mUpPos.clone());
};
InputManager.prototype.MousePressed = function () {
return(this.mPressed);
};
InputManager.prototype.MouseReleased = function () {
return(this.mReleased);
};
InputManager.prototype.MouseDown = function () {
return(this.mState);
};
InputManager.prototype.Down = function (knum) {
return(this.kState[knum]);
};
InputManager.prototype.Pressed = function (knum) {
return(this.kState[knum] && (!this.kOldState[knum]));
};
InputManager.prototype.Released = function (knum) {
return((!this.kState[knum]) && (this.kOldState[knum]));
};
InputManager.prototype.Toggled = function (tnum) {
return(this.tState[tnum]);
};
function VectorRenderer() {
var _local1 = this;
_local1.buffer = CreateMC("EMPTY_MC", "rend");
_local1.buffer._x = 0;
_local1.buffer._y = 0;
_local1.thickness = 0;
_local1.rgb = 0;
_local1.alpha = 100;
}
VectorRenderer.prototype.Clear = function () {
var _local1 = this;
_local1.buffer.clear();
_local1.buffer.lineStyle(_local1.thickness, _local1.rgb, _local1.alpha);
};
VectorRenderer.prototype.SetStyle = function (thick, rgb, alpha) {
this.buffer.lineStyle(thick, rgb, alpha);
};
VectorRenderer.prototype.DrawLine = function (va, vb) {
this.buffer.moveTo(va.x, va.y);
this.buffer.lineTo(vb.x, vb.y);
};
VectorRenderer.prototype.DrawLine_S = function (x0, y0, x1, y1) {
this.buffer.moveTo(x0, y0);
this.buffer.lineTo(x1, y1);
};
VectorRenderer.prototype.DrawArrow_S = function (x0, y0, x1, y1) {
this.buffer.moveTo(x0, y0);
this.buffer.lineTo(x1, y1);
var _local3 = x1 - x0;
var _local2 = y1 - y0;
var len = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
if (len == 0) {
} else {
_local3 = _local3 / len;
_local2 = _local2 / len;
var nx = (-_local2);
var ny = _local3;
var _local1 = 2;
this.buffer.moveTo(x1, y1);
this.buffer.lineTo((x1 - (_local1 * _local3)) - (_local1 * nx), (y1 - (_local1 * _local2)) - (_local1 * ny));
this.buffer.moveTo(x1, y1);
this.buffer.lineTo((x1 - (_local1 * _local3)) + (_local1 * nx), (y1 - (_local1 * _local2)) + (_local1 * ny));
}
};
VectorRenderer.prototype.DrawArrow = function (p0, p1) {
var x0 = p0.x;
var y0 = p0.y;
var _local3 = p1.x;
var _local2 = p1.y;
this.buffer.moveTo(x0, y0);
this.buffer.lineTo(_local3, _local2);
var dx = (_local3 - x0);
var dy = (_local2 - y0);
var len = Math.sqrt((dx * dx) + (dy * dy));
if (len == 0) {
} else {
dx = dx / len;
dy = dy / len;
var nx = (-dy);
var ny = dx;
var _local1 = 2;
this.buffer.moveTo(_local3, _local2);
this.buffer.lineTo((_local3 - (_local1 * dx)) - (_local1 * nx), (_local2 - (_local1 * dy)) - (_local1 * ny));
this.buffer.moveTo(_local3, _local2);
this.buffer.lineTo((_local3 - (_local1 * dx)) + (_local1 * nx), (_local2 - (_local1 * dy)) + (_local1 * ny));
}
};
VectorRenderer.prototype.DrawArrowR = function (p0, p1, r) {
var x0 = p0.x;
var y0 = p0.y;
var _local3 = p1.x;
var _local2 = p1.y;
this.buffer.moveTo(x0, y0);
this.buffer.lineTo(_local3, _local2);
var dx = (_local3 - x0);
var dy = (_local2 - y0);
var len = Math.sqrt((dx * dx) + (dy * dy));
if (len == 0) {
} else {
dx = dx / len;
dy = dy / len;
var nx = (-dy);
var ny = dx;
var _local1 = r;
this.buffer.moveTo(_local3, _local2);
this.buffer.lineTo((_local3 - (_local1 * dx)) - (_local1 * nx), (_local2 - (_local1 * dy)) - (_local1 * ny));
this.buffer.moveTo(_local3, _local2);
this.buffer.lineTo((_local3 - (_local1 * dx)) + (_local1 * nx), (_local2 - (_local1 * dy)) + (_local1 * ny));
}
};
VectorRenderer.prototype.DrawLinestrip = function (vList) {
var _local2 = vList;
var _local3 = this;
_local3.buffer.moveTo(_local2[0].x, _local2[0].y);
var _local1 = 0;
while (_local1 < _local2.length) {
_local3.buffer.lineTo(_local2[_local1].x, _local2[_local1].y);
_local1++;
}
};
VectorRenderer.prototype.DrawTri = function (va, vb, vc) {
var _local1 = va;
var _local2 = this;
_local2.buffer.moveTo(_local1.x, _local1.y);
_local2.buffer.lineTo(vb.x, vb.y);
_local2.buffer.lineTo(vc.x, vc.y);
_local2.buffer.lineTo(_local1.x, _local1.y);
};
VectorRenderer.prototype.DrawQuad = function (a, b, c, d) {
var _local1 = this;
var _local2 = a;
_local1.buffer.moveTo(_local2.x, _local2.y);
_local1.buffer.lineTo(b.x, b.y);
_local1.buffer.lineTo(c.x, c.y);
_local1.buffer.lineTo(d.x, d.y);
_local1.buffer.lineTo(_local2.x, _local2.y);
};
VectorRenderer.prototype.DrawPlus = function (v) {
var _local1 = v;
var _local2 = this;
_local2.buffer.moveTo(_local1.x - 1, _local1.y);
_local2.buffer.lineTo(_local1.x + 1, _local1.y);
_local2.buffer.moveTo(_local1.x, _local1.y - 1);
_local2.buffer.lineTo(_local1.x, _local1.y + 1);
};
VectorRenderer.prototype.DrawPlus_S = function (vx, vy) {
var _local1 = vy;
var _local2 = vx;
var _local3 = this;
_local3.buffer.moveTo(_local2 - 1, _local1);
_local3.buffer.lineTo(_local2 + 1, _local1);
_local3.buffer.moveTo(_local2, _local1 - 1);
_local3.buffer.lineTo(_local2, _local1 + 1);
};
VectorRenderer.prototype.DrawPlusR = function (v, r) {
var _local1 = v;
var _local2 = r;
var _local3 = this;
_local3.buffer.moveTo(_local1.x - _local2, _local1.y);
_local3.buffer.lineTo(_local1.x + _local2, _local1.y);
_local3.buffer.moveTo(_local1.x, _local1.y - _local2);
_local3.buffer.lineTo(_local1.x, _local1.y + _local2);
};
VectorRenderer.prototype.DrawCross = function (v) {
var _local1 = v;
var _local2 = this;
_local2.buffer.moveTo(_local1.x - 1, _local1.y - 1);
_local2.buffer.lineTo(_local1.x + 1, _local1.y + 1);
_local2.buffer.moveTo(_local1.x + 1, _local1.y - 1);
_local2.buffer.lineTo(_local1.x - 1, _local1.y + 1);
};
VectorRenderer.prototype.DrawCross_S = function (vx, vy) {
var _local1 = vy;
var _local2 = vx;
var _local3 = this;
_local3.buffer.moveTo(_local2 - 1, _local1 - 1);
_local3.buffer.lineTo(_local2 + 1, _local1 + 1);
_local3.buffer.moveTo(_local2 + 1, _local1 - 1);
_local3.buffer.lineTo(_local2 - 1, _local1 + 1);
};
VectorRenderer.prototype.DrawCrossR = function (v, r) {
var _local1 = v;
var _local2 = r;
var _local3 = this;
_local3.buffer.moveTo(_local1.x - _local2, _local1.y - _local2);
_local3.buffer.lineTo(_local1.x + _local2, _local1.y + _local2);
_local3.buffer.moveTo(_local1.x + _local2, _local1.y - _local2);
_local3.buffer.lineTo(_local1.x - _local2, _local1.y + _local2);
};
VectorRenderer.prototype.DrawCircle = function (v, r) {
var _local1 = r;
var _local3 = v.x;
var _local2 = v.y;
this.buffer.moveTo(_local3 + _local1, _local2);
this.buffer.curveTo(_local1 + _local3, (0.4142 * _local1) + _local2, (0.7071 * _local1) + _local3, (0.7071 * _local1) + _local2);
this.buffer.curveTo((0.4142 * _local1) + _local3, _local1 + _local2, _local3, _local1 + _local2);
this.buffer.curveTo((-0.4142 * _local1) + _local3, _local1 + _local2, (-0.7071 * _local1) + _local3, (0.7071 * _local1) + _local2);
this.buffer.curveTo((-_local1) + _local3, (0.4142 * _local1) + _local2, (-_local1) + _local3, _local2);
this.buffer.curveTo((-_local1) + _local3, (-0.4142 * _local1) + _local2, (-0.7071 * _local1) + _local3, (-0.7071 * _local1) + _local2);
this.buffer.curveTo((-0.4142 * _local1) + _local3, (-_local1) + _local2, _local3, (-_local1) + _local2);
this.buffer.curveTo((0.4142 * _local1) + _local3, (-_local1) + _local2, (0.7071 * _local1) + _local3, (-0.7071 * _local1) + _local2);
this.buffer.curveTo(_local1 + _local3, (-0.4142 * _local1) + _local2, _local1 + _local3, _local2);
};
VectorRenderer.prototype.DrawArc = function (p0, p1, c) {
this.buffer.moveTo(p0.x, p0.y);
this.buffer.curveTo(c.x, c.y, p1.x, p1.y);
};
VectorRenderer.prototype.DrawArc_S = function (x0, y0, x1, y1, xc, yc) {
this.buffer.moveTo(x0, y0);
this.buffer.curveTo(xc, yc, x1, y1);
};
VectorRenderer.prototype.DrawAABB = function (p, xw, yw) {
var _local1 = p;
var _local2 = xw;
var _local3 = yw;
var v0 = new Vector2(_local1.x + _local2, _local1.y + _local3);
var v1 = new Vector2(_local1.x - _local2, _local1.y + _local3);
var v2 = new Vector2(_local1.x - _local2, _local1.y - _local3);
var v3 = new Vector2(_local1.x + _local2, _local1.y - _local3);
this.DrawQuad(v0, v1, v2, v3);
};
VectorRenderer.prototype.DrawAABB_S = function (minx, maxx, miny, maxy) {
var v0 = new Vector2(maxx, maxy);
var _local3 = new Vector2(minx, maxy);
var _local2 = new Vector2(minx, miny);
var _local1 = new Vector2(maxx, miny);
this.DrawQuad(v0, _local3, _local2, _local1);
};
VectorRenderer.prototype.DrawConcaveCCWArc_S = function (cx, cy, px, py) {
var _local1 = cy;
var _local2 = cx;
var p0x = px;
var p0y = py;
var vx = (p0x - _local2);
var vy = (p0y - _local1);
var r = Math.sqrt((vx * vx) + (vy * vy));
var nx = vy;
var ny = (-vx);
var p1x = ((p0x + nx) - _local2);
var _local3 = (p0y + ny) - _local1;
var len = Math.sqrt((p1x * p1x) + (_local3 * _local3));
p1x = p1x / len;
_local3 = _local3 / len;
p1x = p1x * r;
_local3 = _local3 * r;
p1x = p1x + _local2;
_local3 = _local3 + _local1;
var c0x = (((p0x + p1x) * 0.5) - _local2);
var c0y = (((p0y + _local3) * 0.5) - _local1);
var clen = Math.sqrt((c0x * c0x) + (c0y * c0y));
var dlen = (r - clen);
c0x = c0x / clen;
c0y = c0y / clen;
c0x = c0x * (r + dlen);
c0y = c0y * (r + dlen);
c0x = c0x + _local2;
c0y = c0y + _local1;
this.buffer.moveTo(p0x, p0y);
this.buffer.curveTo(c0x, c0y, p1x, _local3);
var p0x = p1x;
var p0y = _local3;
var vx = (p0x - _local2);
var vy = (p0y - _local1);
var r = Math.sqrt((vx * vx) + (vy * vy));
var nx = vy;
var ny = (-vx);
var p1x = ((p0x + nx) - _local2);
_local3 = (p0y + ny) - _local1;
var len = Math.sqrt((p1x * p1x) + (_local3 * _local3));
p1x = p1x / len;
_local3 = _local3 / len;
p1x = p1x * r;
_local3 = _local3 * r;
p1x = p1x + _local2;
_local3 = _local3 + _local1;
var c0x = (((p0x + p1x) * 0.5) - _local2);
var c0y = (((p0y + _local3) * 0.5) - _local1);
var clen = Math.sqrt((c0x * c0x) + (c0y * c0y));
var dlen = (r - clen);
c0x = c0x / clen;
c0y = c0y / clen;
c0x = c0x * (r + dlen);
c0y = c0y * (r + dlen);
c0x = c0x + _local2;
c0y = c0y + _local1;
this.buffer.curveTo(c0x, c0y, p1x, _local3);
};
VectorRenderer.prototype.DrawLinestrip_nrope = function (vList) {
var _local2 = vList;
var _local3 = this;
_local3.buffer.moveTo(_local2[0].x, _local2[0].y);
var _local1 = 1;
while (_local1 < _local2.length) {
_local3.buffer.lineTo(_local2[_local1].x, _local2[_local1].y);
_local1++;
}
};
function GraphicsSystem() {
var _local1 = this;
_local1.front_depth = 1001;
_local1.back_depth = 1000;
_local1.stepsize = 10;
}
GraphicsSystem.prototype.GetNextDepth_Front = function () {
var _local1 = this;
_local1.front_depth = _local1.front_depth + _local1.stepsize;
return(_local1.front_depth);
};
GraphicsSystem.prototype.GetNextDepth_Back = function () {
var _local1 = this;
_local1.back_depth = _local1.back_depth - _local1.stepsize;
return(_local1.back_depth);
};
function CreateMC(linkName, instanceName) {
var _local2 = instanceName;
var _local3 = _root;
var _local1 = gfx.GetNextDepth_Front();
if (linkName == "EMPTY_MC") {
return(_local3.createEmptyMovieClip(_local2, _local1));
}
if (linkName == "TEXT_MC") {
return(_local3.createTextField(_local2, _local1, 0, 0, 100, 100));
}
return(_local3.attachMovie(linkName, _local2 + _local1, _local1));
}
DestroyMC = function (mc) {
mc.swapDepths(1048000);
mc.removeMovieClip();
};
function Point(x, y, title, col, isDraggable, dragFunc, xmin, ymin, xmax, ymax) {
var _local1 = this;
var _local3 = title;
_local1.pos = new Vector2(x, y);
_local1.title = _local3;
_local1.mc = CreateMC("pointMC", "point_" + _local3);
_local1.mc.title = _local1.mc.attachMovie("titleMC", "title_" + _local3, 1);
_local1.mc.title.txt = _local1.title;
_local1.mc.title._x = 4;
_local1.mc.title._y = -4;
var _local2 = new Color(_local1.mc.gfx);
_local2.setRGB(col);
_local1.mc._x = x;
_local1.mc._y = y;
if (isDraggable) {
_local1.mc.hitArea = _local1.mc.gfx;
_local1.mc.onPress = function () {
this.startDrag(false, xmin, ymin, xmax, ymax);
this.onEnterFrame = dragFunc;
};
_local1.mc.onMouseUp = function () {
var _local1 = this;
_local1.stopDrag();
_local1.onEnterFrame();
_local1.onEnterFrame = null;
};
}
}
function AABB(x, y, xw, yw, title, col, isDraggable, dragFunc, xmin, ymin, xmax, ymax) {
var _local1 = this;
var _local2 = title;
_local1.pos = new Vector2(x, y);
_local1.xw = xw;
_local1.yw = yw;
_local1.title = _local2;
_local1.mc = CreateMC("EMPTY_MC", "aabb_" + _local2);
_local1.mc.point = _local1.mc.AttachMovie("pointMC", "aabbcenter_" + _local2, 2);
_local1.mc.point._xscale = 100 / _local1.mc.point._width;
_local1.mc.point._yscale = 100 / _local1.mc.point._height;
var _local3 = new Color(_local1.mc.point);
_local3.setRGB(col);
_local1.mc.title = _local1.mc.attachMovie("titleMC", "title_" + _local2, 3);
_local1.mc.title.txt = _local1.title;
_local1.mc.title._x = xw;
_local1.mc.title._y = -yw;
_local1.mc.extents = _local1.mc.createEmptyMovieClip("aabbextents_" + _local2, 1);
_local1.mc.extents.lineStyle(0, col, 100);
_local1.mc.extents.beginFill(col, 25);
_local1.mc.extents.moveTo(xw, yw);
_local1.mc.extents.lineTo(xw, -yw);
_local1.mc.extents.lineTo(-xw, -yw);
_local1.mc.extents.lineTo(-xw, yw);
_local1.mc.extents.lineTo(xw, yw);
_local1.mc.extents.endFill();
_local1.mc._x = x;
_local1.mc._y = y;
if (isDraggable) {
_local1.mc.hitArea = _local1.mc.extents;
_local1.mc.onPress = function () {
this.startDrag(false, xmin + xw, ymin + yw, xmax - xw, ymax - yw);
this.onEnterFrame = dragFunc;
};
_local1.mc.onRelease = function () {
var _local1 = this;
_local1.stopDrag();
_local1.onEnterFrame();
_local1.onEnterFrame = null;
};
}
}
function Circle(x, y, r, title, col, isDraggable, dragFunc, xmin, ymin, xmax, ymax) {
var _local1 = this;
var _local2 = title;
_local1.pos = new Vector2(x, y);
_local1.r = r;
_local1.title = _local2;
_local1.mc = CreateMC("EMPTY_MC", "circle_" + _local2);
_local1.mc.point = _local1.mc.AttachMovie("pointMC", "circlecenter_" + _local2, 2);
_local1.mc.point._xscale = 100 / _local1.mc.point._width;
_local1.mc.point._yscale = 100 / _local1.mc.point._height;
var _local3 = new Color(_local1.mc.point);
_local3.setRGB(col);
_local1.mc.title = _local1.mc.attachMovie("titleMC", "title_" + _local2, 3);
_local1.mc.title.txt = _local1.title;
_local1.mc.title._x = r;
_local1.mc.title._y = -r;
_local1.mc.extents = _local1.mc.createEmptyMovieClip("circleextents_" + _local2, 1);
_local1.mc.extents.lineStyle(0, col, 100);
_local1.mc.extents.beginFill(col, 25);
_local1.mc.extents.moveTo(r, 0);
_local1.mc.extents.curveTo(r, 0.4142 * r, 0.7071 * r, 0.7071 * r);
_local1.mc.extents.curveTo(0.4142 * r, r, 0, r);
_local1.mc.extents.curveTo(-0.4142 * r, r, -0.7071 * r, 0.7071 * r);
_local1.mc.extents.curveTo(-r, 0.4142 * r, -r, 0);
_local1.mc.extents.curveTo(-r, -0.4142 * r, -0.7071 * r, -0.7071 * r);
_local1.mc.extents.curveTo(-0.4142 * r, -r, 0, -r);
_local1.mc.extents.curveTo(0.4142 * r, -r, 0.7071 * r, -0.7071 * r);
_local1.mc.extents.curveTo(r, -0.4142 * r, r, 0);
_local1.mc.extents.endFill();
_local1.mc._x = x;
_local1.mc._y = y;
if (isDraggable) {
_local1.mc.hitArea = _local1.mc.extents;
_local1.mc.onPress = function () {
this.startDrag(false, xmin + r, ymin + r, xmax - r, ymax - r);
this.onEnterFrame = dragFunc;
};
_local1.mc.onRelease = function () {
var _local1 = this;
_local1.stopDrag();
_local1.onEnterFrame();
_local1.onEnterFrame = null;
};
}
}
function DrawSepAxis(rend, dir, offset, c0, r0, c1, r1) {
var _local1 = dir;
var _local2 = _local1.normR();
var _local3 = new Vector2(c1.x + (_local2.x * offset), c1.y + (_local2.y * offset));
var delta = c1.minus(c0);
var temp = delta.proj(_local1);
var p0 = new Vector2(_local3.x - temp.x, _local3.y - temp.y);
rend.SetStyle(0, 2263074, 20);
rend.DrawLine_S((c1.x + (_local2.x * offset)) - (300 * _local1.x), (c1.y + (_local2.y * offset)) - (300 * _local1.y), (c1.x + (_local2.x * offset)) + (300 * _local1.x), (c1.y + (_local2.y * offset)) + (300 * _local1.y));
rend.SetStyle(2, 8921634, 100);
rend.DrawLine_S(p0.x - (r0 * _local1.x), p0.y - (r0 * _local1.y), p0.x + (r0 * _local1.x), p0.y + (r0 * _local1.y));
rend.SetStyle(4, 2237064, 30);
rend.DrawLine_S(_local3.x - (r1 * _local1.x), _local3.y - (r1 * _local1.y), _local3.x + (r1 * _local1.x), _local3.y + (r1 * _local1.y));
var pen = (0 < ((r0 + r1) - delta.len()));
return(pen);
}
gfx = new GraphicsSystem();
input = new InputManager();
rend = new VectorRenderer();
function DrawSepAxis_AABB_conc() {
rend.Clear();
var _local2 = box0.pos;
var _local3 = box0.xw;
var yw = box0.yw;
var trn = (0.5 * cr);
var px = new Vector2(_local2.x, pax.y);
var py = new Vector2(pay.x, _local2.y);
rend.SetStyle(4, 2237064, 30);
rend.DrawLine_S(px.x + _local3, px.y, px.x - _local3, px.y);
rend.DrawLine_S(py.x, py.y + yw, py.x, py.y - yw);
rend.SetStyle(0, 2237064, 10);
rend.DrawLine_S(_local2.x + _local3, _local2.y + yw, px.x + _local3, px.y);
rend.DrawLine_S(_local2.x - _local3, _local2.y + yw, px.x - _local3, px.y);
rend.DrawLine_S(_local2.x - _local3, _local2.y + yw, py.x, py.y + yw);
rend.DrawLine_S(_local2.x - _local3, _local2.y - yw, py.x, py.y - yw);
var dx = px.minus(pax);
var dy = py.minus(pay);
var penX = ((_local3 + trn) - dx.len());
var penY = ((yw + trn) - dy.len());
var colX = ((colY = (colN = 11184810)));
var temp = new Vector2(_local2.x - _local3, _local2.y + yw);
if ((((temp.x < cp.x) || (cp.y < temp.y)) || (cc.x < temp.x)) || (temp.y < cc.y)) {
if ((0 < penX) && (0 < penY)) {
if (penX < penY) {
colX = 8921736 /* 0x882288 */;
} else {
colY = 8921736 /* 0x882288 */;
}
}
var penN = -1;
} else {
var temp = new Vector2(_local2.x - _local3, _local2.y + yw);
var _local1 = cc.minus(temp);
_local1.normalize();
var temp2 = _local1.normR();
temp2.mult(-1);
var offsetx = ((1.2 * cr) * temp2.x);
var offsety = ((1.2 * cr) * temp2.y);
var brn = (Math.abs(_local3 * _local1.x) + Math.abs(yw * _local1.y));
var pan = new Vector2((cc.x - ((0.5 * cr) * _local1.x)) + offsetx, (cc.y - ((0.5 * cr) * _local1.y)) + offsety);
var pn = new Vector2((temp.x + (brn * _local1.x)) + offsetx, (temp.y + (brn * _local1.y)) + offsety);
rend.SetStyle(4, 2237064, 30);
rend.DrawLine_S(pn.x + (brn * _local1.x), pn.y + (brn * _local1.y), pn.x - (brn * _local1.x), pn.y - (brn * _local1.y));
rend.SetStyle(0, 2237064, 10);
rend.DrawLine_S(_local2.x - _local3, _local2.y + yw, pn.x - (brn * _local1.x), pn.y - (brn * _local1.y));
rend.DrawLine_S(_local2.x + _local3, _local2.y - yw, pn.x + (brn * _local1.x), pn.y + (brn * _local1.y));
rend.SetStyle(0, 8921634, 10);
rend.DrawLine_S(cc.x - (cr * _local1.x), cc.y - (cr * _local1.y), pan.x - (trn * _local1.x), pan.y - (trn * _local1.y));
rend.SetStyle(0, 2263074, 20);
rend.DrawLine_S(pan.x + (300 * _local1.x), pan.y + (300 * _local1.y), pan.x - (150 * _local1.x), pan.y - (150 * _local1.y));
rend.SetStyle(0, 2263074, 20);
rend.DrawLine_S(temp.x, temp.y, cc.x - (cr * _local1.x), cc.y - (cr * _local1.y));
var dn = cc.minus(temp);
var penN = (dn.len() - cr);
if (((0 < penX) && (0 < penY)) && (0 < penN)) {
if (penX < penY) {
if (penX < penN) {
colX = 8921736 /* 0x882288 */;
} else {
colN = 8921736 /* 0x882288 */;
}
} else if (penY < penN) {
colY = 8921736 /* 0x882288 */;
} else {
colN = 8921736 /* 0x882288 */;
}
}
}
if (0 < penX) {
var signX = 1;
if (0 < dx.x) {
signX = -1;
}
rend.SetStyle(2, colX, 100);
rend.DrawArrow_S(px.x + (signX * _local3), (pax.y + (0.5 * dx.y)) + 8, (px.x + (signX * _local3)) - (signX * penX), (pax.y + (0.5 * dx.y)) + 8);
}
if (0 < penY) {
var signY = 1;
if (0 < dy.y) {
signY = -1;
}
rend.SetStyle(2, colY, 100);
rend.DrawArrow_S((pay.x + (0.5 * dy.x)) - 8, py.y + (signY * yw), (pay.x + (0.5 * dy.x)) - 8, (py.y + (signY * yw)) - (signY * penY));
}
if (0 < penN) {
var norm = _local1.normR();
rend.SetStyle(2, colN, 100);
rend.DrawArrow_S((pn.x - (brn * _local1.x)) - (8 * norm.x), (pn.y - (brn * _local1.y)) - (8 * norm.y), ((pn.x - (brn * _local1.x)) - (8 * norm.x)) + (penN * _local1.x), ((pn.y - (brn * _local1.y)) - (8 * norm.y)) + (penN * _local1.y));
}
}
function AABBDragged() {
box0.pos.x = this._x;
box0.pos.y = this._y;
DrawSepAxis_AABB_conc();
}
box0 = new AABB(192, 96, 32, 20, "", 2237064, true, AABBDragged, 8, 8, 248, 248);
var static_rend = new VectorRenderer();
cp = new Vector2(110, 164);
cr = 48;
cc = new Vector2(cp.x + cr, cp.y - cr);
static_rend.SetStyle(0, 8921634, 100);
static_rend.buffer.beginFill(8921634, 30);
static_rend.buffer.moveTo(cp.x, cp.y);
static_rend.buffer.lineTo(cp.x + cr, cp.y);
static_rend.DrawConcaveCCWArc_S(cc.x, cc.y, cc.x - cr, cc.y);
static_rend.buffer.lineTo(cp.x, cp.y);
static_rend.buffer.endFill();
static_rend.SetStyle(2, 8921634, 100);
static_rend.DrawLine_S(26, cp.y, 26, cp.y - cr);
static_rend.DrawLine_S(cp.x, 230, cp.x + cr, 230);
static_rend.SetStyle(0, 8921634, 10);
static_rend.DrawLine_S(cp.x, cp.y, 26, cp.y);
static_rend.DrawLine_S(cp.x, cp.y - cr, 26, cp.y - cr);
static_rend.DrawLine_S(cp.x, cp.y, cp.x, 230);
static_rend.DrawLine_S(cp.x + cr, cp.y, cp.x + cr, 230);
pax = new Vector2(cp.x + (0.5 * cr), 230);
pay = new Vector2(26, cp.y - (0.5 * cr));
static_rend.SetStyle(0, 2263074, 20);
static_rend.DrawLine_S(pax.x - 200, pax.y, pax.x + 200, pax.y);
static_rend.DrawLine_S(pay.x, pay.y - 200, pay.x, pay.y + 200);
DrawSepAxis_AABB_conc();