STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
229595
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2595 · P5190

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/76665527?noj=FRM76665527-22DC" width="1" height="1"></div>

N_tutorial_diagrams05_boxprojection.swf

This is the info page for
Flash #41776

(Click the ID number above for more basic data on this flash file.)


Text
p0

ActionScript [AS1/AS2]

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.DrawAABB_S2 = function (px, py, xw, yw) { var _local1 = xw; var _local2 = py; var _local3 = px; var v0 = new Vector2(_local3 + _local1, _local2 + yw); var v1 = new Vector2(_local3 - _local1, _local2 + yw); var v2 = new Vector2(_local3 - _local1, _local2 - yw); var v3 = new Vector2(_local3 + _local1, _local2 - yw); this.DrawQuad(v0, v1, v2, v3); }; 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 = this; 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 DrawAABBProjection() { rend.Clear(); var _local1 = point0.pos; var _local3 = box0.pos; var xw0 = box0.xw; var yw0 = box0.yw; var c = new Vector2(128, 128); var _local2 = _local1.minus(c); _local2.normalize(); var a = _local2.normR(); rend.SetStyle(0, 8921634, 30); rend.DrawLine_S(_local1.x + (128 * a.x), _local1.y + (128 * a.y), _local1.x - (128 * a.x), _local1.y - (128 * a.y)); rend.SetStyle(0, 10066329, 30); rend.DrawLine_S(_local1.x - (6 * _local2.x), _local1.y - (6 * _local2.y), (_local1.x - (6 * _local2.x)) + (6 * a.x), (_local1.y - (6 * _local2.y)) + (6 * a.y)); rend.DrawLine_S(_local1.x + (6 * a.x), _local1.y + (6 * a.y), (_local1.x - (6 * _local2.x)) + (6 * a.x), (_local1.y - (6 * _local2.y)) + (6 * a.y)); var delta = _local1.minus(_local3); var signX = 1; var signY = 1; if (delta.x < 0) { signX = -1; } if (delta.y < 0) { signY = -1; } var iw = new Vector2(xw0 * signX, 0); var jw = new Vector2(0, yw0 * signY); rend.SetStyle(0, 2237064, 100); rend.DrawArrow_S(_local3.x, _local3.y, _local3.x + iw.x, _local3.y); rend.DrawArrow_S(_local3.x, _local3.y, _local3.x, _local3.y + jw.y); var pi = iw.proj(a); var pj = jw.proj(a); rend.SetStyle(0, 2263074, 30); rend.DrawLine(_local1, c); rend.DrawLine_S(_local3.x + iw.x, _local3.y, _local1.x + pi.x, _local1.y + pi.y); rend.DrawLine_S(_local3.x, _local3.y + jw.y, _local1.x + pj.x, _local1.y + pj.y); rend.SetStyle(2, 2263074, 100); rend.DrawLine_S((_local1.x + pi.x) + (5 * _local2.x), (_local1.y + pi.y) + (5 * _local2.y), (_local1.x + pj.x) + (5 * _local2.x), (_local1.y + pj.y) + (5 * _local2.y)); var ex = iw.minus(jw); var ey = jw.minus(iw); var p1 = _local3.plus(ex); var p2 = _local3.plus(ey); var proj1 = ex.proj(a); var proj2 = ey.proj(a); rend.SetStyle(0, 2237064, 20); rend.DrawLine(p1, _local1.plus(proj1)); rend.DrawLine(p2, _local1.plus(proj2)); rend.SetStyle(2, 2237064, 100); rend.DrawLine_S((_local1.x + proj1.x) + (10 * _local2.x), (_local1.y + proj1.y) + (10 * _local2.y), (_local1.x + proj2.x) + (10 * _local2.x), (_local1.y + proj2.y) + (10 * _local2.y)); } function PointDragged() { var _local1 = this; _local1._x = _xmouse; _local1._y = _ymouse; var _local3 = 128 - _local1._x; var _local2 = 128 - _local1._y; var len = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); var pen = (120 - len); if (0 != pen) { if (len == 0) { _local1._x = 128; _local1._y = 248; point0.pos.x = _local1._x; point0.pos.y = _local1._y - 20; } else { _local3 = _local3 / len; _local2 = _local2 / len; _local1._x = _local1._x - (_local3 * pen); _local1._y = _local1._y - (_local2 * pen); point0.pos.x = _local1._x + (20 * _local3); point0.pos.y = _local1._y + (20 * _local2); } } else { _local3 = _local3 / len; _local2 = _local2 / len; point0.pos.x = _local1._x + (20 * _local3); point0.pos.y = _local1._y + (20 * _local2); } DrawAABBProjection(); } box0 = new AABB(128, 128, 32, 24, "", 2237064, false, null, 0, 0, 0, 0); point0 = new Point(128, 248, "", 8921634, true, PointDragged, 8, 8, 248, 248); point0.pos.x = 128; point0.pos.y = 228; DrawAABBProjection();

Library Items

Symbol 1 GraphicUsed by:2
Symbol 2 MovieClipUses:1Used by:3
Symbol 3 MovieClip [pointMC]Uses:2
Symbol 4 FontUsed by:5
Symbol 5 EditableTextUses:4Used by:6
Symbol 6 MovieClip [titleMC]Uses:5
Symbol 7 GraphicUsed by:Timeline

Instance Names

"gfx"Symbol 3 MovieClip [pointMC] Frame 1Symbol 2 MovieClip

Special Tags

ExportAssets (56)Timeline Frame 1Symbol 3 as "pointMC"
ExportAssets (56)Timeline Frame 1Symbol 6 as "titleMC"

Dynamic Text Variables

txtSymbol 5 EditableText"p0"




http://swfchan.com/9/41776/info.shtml
Created: 10/5 -2019 05:33:10 Last modified: 10/5 -2019 05:33:10 Server time: 22/12 -2024 21:00:33