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

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

A3_polygonVR.swf

This is the info page for
Flash #41737

(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.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 DrawClosestPoint() { rend.Clear(); vrMC.clear(); var vrCol = 2263074; var p = point0.pos; var _local2 = new Array(); var numInside = 0; var edgeVR = -1; var i = 0; while (i < eList.length) { var _local3 = eList[i]; var delta = p.minus(_local3.p0); var dp = delta.dot(_local3.n); var _local1 = new Object(); _local1.dp = dp; if (dp < 0) { numInside++; } var pp = delta.dot(_local3.d); trace("--------"); trace(" i: " + i); trace(" dp: " + dp); trace(" pp: " + pp); trace("len: " + _local3.len); if (pp < 0) { _local1.linepos = -1; } else { var pp2 = p.minus(_local3.p1).dot(_local3.d); if (0 < pp2) { _local1.linepos = 1; } else { if (0 < dp) { edgeVR = i; break; } _local1.linepos = 0; } } _local2[i] = _local1; i++; } if (0 <= edgeVR) { var edge = eList[edgeVR]; vrMC.beginFill(vrCol, 20); vrMC.lineStyle(0, vrCol, 100); vrMC.moveTo(edge.p0.x + (edge.n.x * 200), edge.p0.y + (edge.n.y * 200)); vrMC.lineTo(edge.p0.x, edge.p0.y); vrMC.lineTo(edge.p1.x, edge.p1.y); vrMC.lineTo(edge.p1.x + (edge.n.x * 200), edge.p1.y + (edge.n.y * 200)); vrMC.endFill(); var delta = p.minus(edge.p0); var dp = delta.dot(edge.n); vrMC.lineStyle(2, vrCol, 100); vrMC.moveTo(p.x, p.y); vrMC.lineTo(p.x - (dp * edge.n.x), p.y - (dp * edge.n.y)); } else if (numInside == eList.length) { var closestE = -1; var maxDP = -100000000; for (var i in _local2) { var _local3 = _local2[i]; if (maxDP < _local3.dp) { closestE = i; maxDP = _local3.dp; } } var edge = eList[closestE]; vrMC.beginFill(vrCol, 30); vrMC.lineStyle(0, vrCol, 100); vrMC.moveTo(edge.p0.x, edge.p0.y); vrMC.lineTo(edge.p1.x, edge.p1.y); vrMC.lineTo(centroid.x, centroid.y); vrMC.lineTo(edge.p0.x, edge.p0.y); vrMC.endFill(); vrMC.lineStyle(2, vrCol, 100); vrMC.moveTo(p.x, p.y); vrMC.lineTo(p.x - (maxDP * edge.n.x), p.y - (maxDP * edge.n.y)); } else { var rootE = -1; for (var i in _local2) { var _local3 = _local2[i]; if (0 <= _local3.dp) { if (_local3.linepos == 1) { rootE = (i + 1) % eList.length; break; } if (_local3.linepos == -1) { rootE = i; break; } trace("WARNING!! FUCKED UP SHIT A"); } } if (0 <= rootE) { var edge = eList[rootE]; var n0 = edge.n; var n1 = eList[(rootE + (eList.length - 1)) % eList.length].n; vrMC.beginFill(vrCol, 20); vrMC.lineStyle(0, vrCol, 100); vrMC.moveTo(edge.p0.x + (300 * n0.x), edge.p0.y + (300 * n0.y)); vrMC.lineTo(edge.p0.x, edge.p0.y); vrMC.lineTo(edge.p0.x + (300 * n1.x), edge.p0.y + (300 * n1.y)); vrMC.endFill(); vrMC.lineStyle(2, vrCol, 100); vrMC.moveTo(p.x, p.y); vrMC.lineTo(edge.p0.x, edge.p0.y); } else { trace("WARNING!! FUCKED UP SHIT B"); } } } function PointDragged() { _root.point0.pos.x = this._x; _root.point0.pos.y = this._y; DrawClosestPoint(); } point0 = new Point(128, 64, "", 2237064, true, PointDragged, 16, 16, 240, 240); vrMC = _root.createEmptyMovieClip("VRmc", 999); vrMC.clear(); triMC = _root.createEmptyMovieClip("trimc", 998); triMC.clear(); p0 = new Vector2(96, 96); p1 = new Vector2(80, 196); p2 = new Vector2(196, 148); vList = new Array(); vList.push(p0); vList.push(p1); vList.push(p2); e01 = new Object(); e01.v = p1.minus(p0); e01.p0 = p0; e01.p1 = p1; e12 = new Object(); e12.v = p2.minus(p1); e12.p0 = p1; e12.p1 = p2; e20 = new Object(); e20.v = p0.minus(p2); e20.p0 = p2; e20.p1 = p0; e01.len = e01.v.len(); e01.d = e01.v.clone(); e01.d.normalize(); e01.n = e01.d.normR(); e12.len = e01.v.len(); e12.d = e12.v.clone(); e12.d.normalize(); e12.n = e12.d.normR(); e20.len = e01.v.len(); e20.d = e20.v.clone(); e20.d.normalize(); e20.n = e20.d.normR(); eList = new Array(); eList.push(e01); eList.push(e12); eList.push(e20); triMC.beginFill(8921634, 10); triMC.lineStyle(0, 8921634, 100); triMC.moveTo(p0.x, p0.y); triMC.lineTo(p1.x, p1.y); triMC.lineTo(p2.x, p2.y); triMC.lineTo(p0.x, p0.y); triMC.endFill(); centroid = p0.plus(p1.plus(p2)); centroid.mult(0.333333333333333); triMC.lineStyle(0, 8921634, 20); triMC.lineTo(centroid.x, centroid.y); triMC.lineTo(p1.x, p1.y); triMC.moveTo(centroid.x, centroid.y); triMC.lineTo(p2.x, p2.y); for (var i in eList) { var e = eList[i]; triMC.moveTo(e.p0.x, e.p0.y); triMC.lineTo(e.p0.x + (e.n.x * 200), e.p0.y + (e.n.y * 200)); triMC.moveTo(e.p1.x, e.p1.y); triMC.lineTo(e.p1.x + (e.n.x * 200), e.p1.y + (e.n.y * 200)); trace("n: " + e.n.ToString()); } DrawClosestPoint();

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

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/41737/info.shtml
Created: 10/5 -2019 05:53:25 Last modified: 10/5 -2019 05:53:25 Server time: 21/12 -2024 14:26:36