/***
P R O C E S S I N G . J S - 1.4.1
a port of the Processing visualization language
Processing.js is licensed under the MIT License, see LICENSE.
For a list of copyright holders, please refer to AUTHORS.
http://processingjs.org
***/
(function(D, d, q, t) {
var G = function() {};
var s = function() {
if ("console" in D) {
return function(N) {
D.console.log("Processing.js: " + N)
}
}
return G
}();
var w = function(N) {
var O = new XMLHttpRequest;
O.open("GET", N, false);
if (O.overrideMimeType) {
O.overrideMimeType("text/plain")
}
O.setRequestHeader("If-Modified-Since", "Fri, 01 Jan 1960 00:00:00 GMT");
O.send(null);
if (O.status !== 200 && O.status !== 0) {
throw "XMLHttpRequest failed, status code " + O.status
}
return O.responseText
};
var n = "document" in this && !("fake" in this.document);
d.head = d.head || d.getElementsByTagName("head")[0];
function C(N, O) {
if (N in D) {
return D[N]
}
if (typeof D[O] === "function") {
return D[O]
}
return function(Q) {
if (Q instanceof Array) {
return Q
}
if (typeof Q === "number") {
var P = [];
P.length = Q;
return P
}
}
}
if (d.documentMode >= 9 && !d.doctype) {
throw "The doctype directive is missing. The recommended doctype in Internet Explorer is the HTML5 doctype: "
}
var e = C("Float32Array", "WebGLFloatArray"),
K = C("Int32Array", "WebGLIntArray"),
y = C("Uint16Array", "WebGLUnsignedShortArray"),
b = C("Uint8Array", "WebGLUnsignedByteArray");
var B = {
X: 0,
Y: 1,
Z: 2,
R: 3,
G: 4,
B: 5,
A: 6,
U: 7,
V: 8,
NX: 9,
NY: 10,
NZ: 11,
EDGE: 12,
SR: 13,
SG: 14,
SB: 15,
SA: 16,
SW: 17,
TX: 18,
TY: 19,
TZ: 20,
VX: 21,
VY: 22,
VZ: 23,
VW: 24,
AR: 25,
AG: 26,
AB: 27,
DR: 3,
DG: 4,
DB: 5,
DA: 6,
SPR: 28,
SPG: 29,
SPB: 30,
SHINE: 31,
ER: 32,
EG: 33,
EB: 34,
BEEN_LIT: 35,
VERTEX_FIELD_COUNT: 36,
P2D: 1,
JAVA2D: 1,
WEBGL: 2,
P3D: 2,
OPENGL: 2,
PDF: 0,
DXF: 0,
OTHER: 0,
WINDOWS: 1,
MAXOSX: 2,
LINUX: 3,
EPSILON: 0.0001,
MAX_FLOAT: 3.4028235e+38,
MIN_FLOAT: -3.4028235e+38,
MAX_INT: 2147483647,
MIN_INT: -2147483648,
PI: q.PI,
TWO_PI: 2 * q.PI,
HALF_PI: q.PI / 2,
THIRD_PI: q.PI / 3,
QUARTER_PI: q.PI / 4,
DEG_TO_RAD: q.PI / 180,
RAD_TO_DEG: 180 / q.PI,
WHITESPACE: " \t\n\r\u000c\u00a0",
RGB: 1,
ARGB: 2,
HSB: 3,
ALPHA: 4,
CMYK: 5,
TIFF: 0,
TARGA: 1,
JPEG: 2,
GIF: 3,
BLUR: 11,
GRAY: 12,
INVERT: 13,
OPAQUE: 14,
POSTERIZE: 15,
THRESHOLD: 16,
ERODE: 17,
DILATE: 18,
REPLACE: 0,
BLEND: 1 << 0,
ADD: 1 << 1,
SUBTRACT: 1 << 2,
LIGHTEST: 1 << 3,
DARKEST: 1 << 4,
DIFFERENCE: 1 << 5,
EXCLUSION: 1 << 6,
MULTIPLY: 1 << 7,
SCREEN: 1 << 8,
OVERLAY: 1 << 9,
HARD_LIGHT: 1 << 10,
SOFT_LIGHT: 1 << 11,
DODGE: 1 << 12,
BURN: 1 << 13,
ALPHA_MASK: 4278190080,
RED_MASK: 16711680,
GREEN_MASK: 65280,
BLUE_MASK: 255,
CUSTOM: 0,
ORTHOGRAPHIC: 2,
PERSPECTIVE: 3,
POINT: 2,
POINTS: 2,
LINE: 4,
LINES: 4,
TRIANGLE: 8,
TRIANGLES: 9,
TRIANGLE_STRIP: 10,
TRIANGLE_FAN: 11,
QUAD: 16,
QUADS: 16,
QUAD_STRIP: 17,
POLYGON: 20,
PATH: 21,
RECT: 30,
ELLIPSE: 31,
ARC: 32,
SPHERE: 40,
BOX: 41,
GROUP: 0,
PRIMITIVE: 1,
GEOMETRY: 3,
VERTEX: 0,
BEZIER_VERTEX: 1,
CURVE_VERTEX: 2,
BREAK: 3,
CLOSESHAPE: 4,
OPEN: 1,
CLOSE: 2,
CORNER: 0,
CORNERS: 1,
RADIUS: 2,
CENTER_RADIUS: 2,
CENTER: 3,
DIAMETER: 3,
CENTER_DIAMETER: 3,
BASELINE: 0,
TOP: 101,
BOTTOM: 102,
NORMAL: 1,
NORMALIZED: 1,
IMAGE: 2,
MODEL: 4,
SHAPE: 5,
SQUARE: "butt",
ROUND: "round",
PROJECT: "square",
MITER: "miter",
BEVEL: "bevel",
AMBIENT: 0,
DIRECTIONAL: 1,
SPOT: 3,
BACKSPACE: 8,
TAB: 9,
ENTER: 10,
RETURN: 13,
ESC: 27,
DELETE: 127,
CODED: 65535,
SHIFT: 16,
CONTROL: 17,
ALT: 18,
CAPSLK: 20,
PGUP: 33,
PGDN: 34,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
F1: 112,
F2: 113,
F3: 114,
F4: 115,
F5: 116,
F6: 117,
F7: 118,
F8: 119,
F9: 120,
F10: 121,
F11: 122,
F12: 123,
NUMLK: 144,
META: 157,
INSERT: 155,
ARROW: "default",
CROSS: "crosshair",
HAND: "pointer",
MOVE: "move",
TEXT: "text",
WAIT: "wait",
NOCURSOR: "url('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), auto",
DISABLE_OPENGL_2X_SMOOTH: 1,
ENABLE_OPENGL_2X_SMOOTH: -1,
ENABLE_OPENGL_4X_SMOOTH: 2,
ENABLE_NATIVE_FONTS: 3,
DISABLE_DEPTH_TEST: 4,
ENABLE_DEPTH_TEST: -4,
ENABLE_DEPTH_SORT: 5,
DISABLE_DEPTH_SORT: -5,
DISABLE_OPENGL_ERROR_REPORT: 6,
ENABLE_OPENGL_ERROR_REPORT: -6,
ENABLE_ACCURATE_TEXTURES: 7,
DISABLE_ACCURATE_TEXTURES: -7,
HINT_COUNT: 10,
SINCOS_LENGTH: 720,
PRECISIONB: 15,
PRECISIONF: 1 << 15,
PREC_MAXVAL: (1 << 15) - 1,
PREC_ALPHA_SHIFT: 24 - 15,
PREC_RED_SHIFT: 16 - 15,
NORMAL_MODE_AUTO: 0,
NORMAL_MODE_SHAPE: 1,
NORMAL_MODE_VERTEX: 2,
MAX_LIGHTS: 8
};
function h(P) {
if (typeof P === "string") {
var O = 0;
for (var N = 0; N < P.length; ++N) {
O = O * 31 + P.charCodeAt(N) & 4294967295
}
return O
}
if (typeof P !== "object") {
return P & 4294967295
}
if (P.hashCode instanceof Function) {
return P.hashCode()
}
if (P.$id === t) {
P.$id = q.floor(q.random() * 65536) - 32768 << 16 | q.floor(q.random() * 65536)
}
return P.$id
}
function r(O, N) {
if (O === null || N === null) {
return O === null && N === null
}
if (typeof O === "string") {
return O === N
}
if (typeof O !== "object") {
return O === N
}
if (O.equals instanceof Function) {
return O.equals(N)
}
return O === N
}
var o = function(O) {
if (O.iterator instanceof Function) {
return O.iterator()
}
if (O instanceof Array) {
var N = -1;
this.hasNext = function() {
return ++N < O.length
};
this.next = function() {
return O[N]
}
} else {
throw "Unable to iterate: " + O
}
};
var f = function() {
function O(Q) {
var P = 0;
this.hasNext = function() {
return P < Q.length
};
this.next = function() {
return Q[P++]
};
this.remove = function() {
Q.splice(P, 1)
}
}
function N(P) {
var Q;
if (P instanceof N) {
Q = P.toArray()
} else {
Q = [];
if (typeof P === "number") {
Q.length = P > 0 ? P : 0
}
}
this.get = function(R) {
return Q[R]
};
this.contains = function(R) {
return this.indexOf(R) > -1
};
this.indexOf = function(T) {
for (var S = 0, R = Q.length; S < R; ++S) {
if (r(T, Q[S])) {
return S
}
}
return -1
};
this.lastIndexOf = function(S) {
for (var R = Q.length - 1; R >= 0; --R) {
if (r(S, Q[R])) {
return R
}
}
return -1
};
this.add = function() {
if (arguments.length === 1) {
Q.push(arguments[0])
} else {
if (arguments.length === 2) {
var R = arguments[0];
if (typeof R === "number") {
if (R >= 0 && R <= Q.length) {
Q.splice(R, 0, arguments[1])
} else {
throw R + " is not a valid index"
}
} else {
throw typeof R + " is not a number"
}
} else {
throw "Please use the proper number of parameters."
}
}
};
this.addAll = function(S, R) {
var T;
if (typeof S === "number") {
if (S < 0 || S > Q.length) {
throw "Index out of bounds for addAll: " + S + " greater or equal than " + Q.length
}
T = new o(R);
while (T.hasNext()) {
Q.splice(S++, 0, T.next())
}
} else {
T = new o(S);
while (T.hasNext()) {
Q.push(T.next())
}
}
};
this.set = function() {
if (arguments.length === 2) {
var R = arguments[0];
if (typeof R === "number") {
if (R >= 0 && R < Q.length) {
Q.splice(R, 1, arguments[1])
} else {
throw R + " is not a valid index."
}
} else {
throw typeof R + " is not a number"
}
} else {
throw "Please use the proper number of parameters."
}
};
this.size = function() {
return Q.length
};
this.clear = function() {
Q.length = 0
};
this.remove = function(R) {
if (typeof R === "number") {
return Q.splice(R, 1)[0]
}
R = this.indexOf(R);
if (R > -1) {
Q.splice(R, 1);
return true
}
return false
};
this.removeAll = function(V) {
var S, R, U, T = new N;
T.addAll(this);
this.clear();
for (S = 0, R = 0; S < T.size(); S++) {
U = T.get(S);
if (!V.contains(U)) {
this.add(R++, U)
}
}
if (this.size() < T.size()) {
return true
}
return false
};
this.isEmpty = function() {
return !Q.length
};
this.clone = function() {
return new N(this)
};
this.toArray = function() {
return Q.slice(0)
};
this.iterator = function() {
return new O(Q)
}
}
return N
}();
var x = function() {
function N() {
if (arguments.length === 1 && arguments[0] instanceof N) {
return arguments[0].clone()
}
var W = arguments.length > 0 ? arguments[0] : 16;
var X = arguments.length > 1 ? arguments[1] : 0.75;
var Q = [];
Q.length = W;
var S = 0;
var O = this;
function U(Z) {
var Y = h(Z) % Q.length;
return Y < 0 ? Q.length + Y : Y
}
function R() {
if (S <= X * Q.length) {
return
}
var ab = [];
for (var aa = 0; aa < Q.length; ++aa) {
if (Q[aa] !== t) {
ab = ab.concat(Q[aa])
}
}
var ac = Q.length * 2;
Q = [];
Q.length = ac;
for (var Z = 0; Z < ab.length; ++Z) {
var Y = U(ab[Z].key);
var ad = Q[Y];
if (ad === t) {
Q[Y] = ad = []
}
ad.push(ab[Z])
}
}
function P(ad, ae) {
var Y = 0;
var ac = -1;
var ab = false;
var aa;
function Z() {
while (!ab) {
++ac;
if (Y >= Q.length) {
ab = true
} else {
if (Q[Y] === t || ac >= Q[Y].length) {
ac = -1;
++Y
} else {
return
}
}
}
}
this.hasNext = function() {
return !ab
};
this.next = function() {
aa = ad(Q[Y][ac]);
Z();
return aa
};
this.remove = function() {
if (aa !== t) {
ae(aa);
--ac;
Z()
}
};
Z()
}
function V(Y, Z, aa) {
this.clear = function() {
O.clear()
};
this.contains = function(ab) {
return Z(ab)
};
this.containsAll = function(ac) {
var ab = ac.iterator();
while (ab.hasNext()) {
if (!this.contains(ab.next())) {
return false
}
}
return true
};
this.isEmpty = function() {
return O.isEmpty()
};
this.iterator = function() {
return new P(Y, aa)
};
this.remove = function(ab) {
if (this.contains(ab)) {
aa(ab);
return true
}
return false
};
this.removeAll = function(ae) {
var ab = ae.iterator();
var ad = false;
while (ab.hasNext()) {
var ac = ab.next();
if (this.contains(ac)) {
aa(ac);
ad = true
}
}
return true
};
this.retainAll = function(af) {
var ad = this.iterator();
var ac = [];
while (ad.hasNext()) {
var ae = ad.next();
if (!af.contains(ae)) {
ac.push(ae)
}
}
for (var ab = 0; ab < ac.length; ++ab) {
aa(ac[ab])
}
return ac.length > 0
};
this.size = function() {
return O.size()
};
this.toArray = function() {
var ab = [];
var ac = this.iterator();
while (ac.hasNext()) {
ab.push(ac.next())
}
return ab
}
}
function T(Y) {
this._isIn = function(Z) {
return Z === O && Y.removed === t
};
this.equals = function(Z) {
return r(Y.key, Z.getKey())
};
this.getKey = function() {
return Y.key
};
this.getValue = function() {
return Y.value
};
this.hashCode = function(Z) {
return h(Y.key)
};
this.setValue = function(aa) {
var Z = Y.value;
Y.value = aa;
return Z
}
}
this.clear = function() {
S = 0;
Q = [];
Q.length = W
};
this.clone = function() {
var Y = new N;
Y.putAll(this);
return Y
};
this.containsKey = function(aa) {
var Y = U(aa);
var ab = Q[Y];
if (ab === t) {
return false
}
for (var Z = 0; Z < ab.length; ++Z) {
if (r(ab[Z].key, aa)) {
return true
}
}
return false
};
this.containsValue = function(aa) {
for (var Z = 0; Z < Q.length; ++Z) {
var ab = Q[Z];
if (ab === t) {
continue
}
for (var Y = 0; Y < ab.length; ++Y) {
if (r(ab[Y].value, aa)) {
return true
}
}
}
return false
};
this.entrySet = function() {
return new V(function(Y) {
return new T(Y)
}, function(Y) {
return Y instanceof T && Y._isIn(O)
}, function(Y) {
return O.remove(Y.getKey())
})
};
this.get = function(aa) {
var Y = U(aa);
var ab = Q[Y];
if (ab === t) {
return null
}
for (var Z = 0; Z < ab.length; ++Z) {
if (r(ab[Z].key, aa)) {
return ab[Z].value
}
}
return null
};
this.isEmpty = function() {
return S === 0
};
this.keySet = function() {
return new V(function(Y) {
return Y.key
}, function(Y) {
return O.containsKey(Y)
}, function(Y) {
return O.remove(Y)
})
};
this.values = function() {
return new V(function(Y) {
return Y.value
}, function(Y) {
return O.containsValue(Y)
}, function(Y) {
return O.removeByValue(Y)
})
};
this.put = function(aa, ac) {
var Y = U(aa);
var ad = Q[Y];
if (ad === t) {
++S;
Q[Y] = [{
key: aa,
value: ac
}];
R();
return null
}
for (var Z = 0; Z < ad.length; ++Z) {
if (r(ad[Z].key, aa)) {
var ab = ad[Z].value;
ad[Z].value = ac;
return ab
}
}++S;
ad.push({
key: aa,
value: ac
});
R();
return null
};
this.putAll = function(Y) {
var Z = Y.entrySet().iterator();
while (Z.hasNext()) {
var aa = Z.next();
this.put(aa.getKey(), aa.getValue())
}
};
this.remove = function(aa) {
var Y = U(aa);
var ac = Q[Y];
if (ac === t) {
return null
}
for (var Z = 0; Z < ac.length; ++Z) {
if (r(ac[Z].key, aa)) {
--S;
var ab = ac[Z].value;
ac[Z].removed = true;
if (ac.length > 1) {
ac.splice(Z, 1)
} else {
Q[Y] = t
}
return ab
}
}
return null
};
this.removeByValue = function(aa) {
var ac, Z, Y, ab;
for (ac in Q) {
if (Q.hasOwnProperty(ac)) {
for (Z = 0, Y = Q[ac].length; Z < Y; Z++) {
ab = Q[ac][Z];
if (ab.value === aa) {
Q[ac].splice(Z, 1);
return true
}
}
}
}
return false
};
this.size = function() {
return S
}
}
return N
}();
var A = function() {
function N(Q, S, R) {
this.x = Q || 0;
this.y = S || 0;
this.z = R || 0
}
N.dist = function(R, Q) {
return R.dist(Q)
};
N.dot = function(R, Q) {
return R.dot(Q)
};
N.cross = function(R, Q) {
return R.cross(Q)
};
N.angleBetween = function(R, Q) {
return q.acos(R.dot(Q) / (R.mag() * Q.mag()))
};
N.prototype = {
set: function(Q, S, R) {
if (arguments.length === 1) {
this.set(Q.x || Q[0] || 0, Q.y || Q[1] || 0, Q.z || Q[2] || 0)
} else {
this.x = Q;
this.y = S;
this.z = R
}
},
get: function() {
return new N(this.x, this.y, this.z)
},
mag: function() {
var Q = this.x,
S = this.y,
R = this.z;
return q.sqrt(Q * Q + S * S + R * R)
},
add: function(Q, S, R) {
if (arguments.length === 1) {
this.x += Q.x;
this.y += Q.y;
this.z += Q.z
} else {
this.x += Q;
this.y += S;
this.z += R
}
},
sub: function(Q, S, R) {
if (arguments.length === 1) {
this.x -= Q.x;
this.y -= Q.y;
this.z -= Q.z
} else {
this.x -= Q;
this.y -= S;
this.z -= R
}
},
mult: function(Q) {
if (typeof Q === "number") {
this.x *= Q;
this.y *= Q;
this.z *= Q
} else {
this.x *= Q.x;
this.y *= Q.y;
this.z *= Q.z
}
},
div: function(Q) {
if (typeof Q === "number") {
this.x /= Q;
this.y /= Q;
this.z /= Q
} else {
this.x /= Q.x;
this.y /= Q.y;
this.z /= Q.z
}
},
dist: function(T) {
var S = this.x - T.x,
R = this.y - T.y,
Q = this.z - T.z;
return q.sqrt(S * S + R * R + Q * Q)
},
dot: function(Q, S, R) {
if (arguments.length === 1) {
return this.x * Q.x + this.y * Q.y + this.z * Q.z
}
return this.x * Q + this.y * S + this.z * R
},
cross: function(R) {
var Q = this.x,
T = this.y,
S = this.z;
return new N(T * R.z - R.y * S, S * R.x - R.z * Q, Q * R.y - R.x * T)
},
normalize: function() {
var Q = this.mag();
if (Q > 0) {
this.div(Q)
}
},
limit: function(Q) {
if (this.mag() > Q) {
this.normalize();
this.mult(Q)
}
},
heading2D: function() {
return -q.atan2(-this.y, this.x)
},
toString: function() {
return "[" + this.x + ", " + this.y + ", " + this.z + "]"
},
array: function() {
return [this.x, this.y, this.z]
}
};
function O(Q) {
return function(T, S) {
var R = T.get();
R[Q](S);
return R
}
}
for (var P in N.prototype) {
if (N.prototype.hasOwnProperty(P) && !N.hasOwnProperty(P)) {
N[P] = O(P)
}
}
return N
}();
function M() {}
M.prototype = B;
var g = new M;
g.ArrayList = f;
g.HashMap = x;
g.PVector = A;
g.ObjectIterator = o;
g.PConstants = B;
g.defineProperty = function(O, N, P) {
if ("defineProperty" in Object) {
Object.defineProperty(O, N, P)
} else {
if (P.hasOwnProperty("get")) {
O.__defineGetter__(N, P.get)
}
if (P.hasOwnProperty("set")) {
O.__defineSetter__(N, P.set)
}
}
};
function m(O, N, R) {
if (!O.hasOwnProperty(N) || typeof O[N] !== "function") {
O[N] = R;
return
}
var Q = O[N];
if ("$overloads" in Q) {
Q.$defaultOverload = R;
return
}
if (!("$overloads" in R) && Q.length === R.length) {
return
}
var T, P;
if ("$overloads" in R) {
T = R.$overloads.slice(0);
T[Q.length] = Q;
P = R.$defaultOverload
} else {
T = [];
T[R.length] = R;
T[Q.length] = Q;
P = Q
}
var S = function() {
var U = S.$overloads[arguments.length] || ("$methodArgsIndex" in S && arguments.length > S.$methodArgsIndex ? S.$overloads[S.$methodArgsIndex] : null) || S.$defaultOverload;
return U.apply(this, arguments)
};
S.$overloads = T;
if ("$methodArgsIndex" in R) {
S.$methodArgsIndex = R.$methodArgsIndex
}
S.$defaultOverload = P;
S.name = N;
O[N] = S
}
function i(Q, P) {
function R(S) {
g.defineProperty(Q, S, {
get: function() {
return P[S]
},
set: function(T) {
P[S] = T
},
enumerable: true
})
}
var O = [];
for (var N in P) {
if (typeof P[N] === "function") {
m(Q, N, P[N])
} else {
if (N.charAt(0) !== "$" && !(N in Q)) {
O.push(N)
}
}
}
while (O.length > 0) {
R(O.shift())
}
Q.$super = P
}
g.extendClassChain = function(O) {
var P = [O];
for (var N = O.$upcast; N; N = N.$upcast) {
i(N, O);
P.push(N);
O = N
}
while (P.length > 0) {
P.pop().$self = O
}
};
g.extendStaticMembers = function(N, O) {
i(N, O)
};
g.extendInterfaceMembers = function(N, O) {
i(N, O)
};
g.addMethod = function(Q, P, S, R) {
var N = Q[P];
if (N || R) {
var O = S.length;
if ("$overloads" in N) {
N.$overloads[O] = S
} else {
var T = function() {
var V = T.$overloads[arguments.length] || ("$methodArgsIndex" in T && arguments.length > T.$methodArgsIndex ? T.$overloads[T.$methodArgsIndex] : null) || T.$defaultOverload;
return V.apply(this, arguments)
};
var U = [];
if (N) {
U[N.length] = N
}
U[O] = S;
T.$overloads = U;
T.$defaultOverload = N || S;
if (R) {
T.$methodArgsIndex = O
}
T.name = P;
Q[P] = T
}
} else {
Q[P] = S
}
};
function l(N) {
if (typeof N !== "string") {
return false
}
return ["byte", "int", "char", "color", "float", "long", "double"].indexOf(N) !== -1
}
g.createJavaArray = function(S, T) {
var O = null,
P = null;
if (typeof S === "string") {
if (S === "boolean") {
P = false
} else {
if (l(S)) {
P = 0
}
}
}
if (typeof T[0] === "number") {
var N = 0 | T[0];
if (T.length <= 1) {
O = [];
O.length = N;
for (var R = 0; R < N; ++R) {
O[R] = P
}
} else {
O = [];
var U = T.slice(1);
for (var Q = 0; Q < N; ++Q) {
O.push(g.createJavaArray(S, U))
}
}
}
return O
};
var E = {
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
gold: "#ffd700",
goldenrod: "#daa520",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
indianred: "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavender: "#e6e6fa",
lavenderblush: "#fff0f5",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgrey: "#d3d3d3",
lightgreen: "#90ee90",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370d8",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#d87093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
};
(function(O) {
var R = ("open() createOutput() createInput() BufferedReader selectFolder() dataPath() createWriter() selectOutput() beginRecord() saveStream() endRecord() selectInput() saveBytes() createReader() beginRaw() endRaw() PrintWriter delay()").split(" "),
Q = R.length,
N, S;
function P(T) {
return function() {
throw "Processing.js does not support " + T + "."
}
}
while (Q--) {
N = R[Q];
S = N.replace("()", "");
O[S] = P(N)
}
})(g);
g.defineProperty(g, "screenWidth", {
get: function() {
return D.innerWidth
}
});
g.defineProperty(g, "screenHeight", {
get: function() {
return D.innerHeight
}
});
g.defineProperty(g, "online", {
get: function() {
return true
}
});
var k = [];
var J = {};
var L = function(N) {
k.splice(J[N], 1);
delete J[N]
};
var a = function(N) {
if (N.externals.canvas.id === t || !N.externals.canvas.id.length) {
N.externals.canvas.id = "__processing" + k.length
}
J[N.externals.canvas.id] = k.length;
k.push(N)
};
function p(X) {
var Q = 250,
ae = X.size / Q,
N = d.createElement("canvas");
N.width = 2 * Q;
N.height = 2 * Q;
N.style.opacity = 0;
var W = X.getCSSDefinition(Q + "px", "normal"),
Y = N.getContext("2d");
Y.font = W;
var ac = "dbflkhyjqpg";
N.width = Y.measureText(ac).width;
Y.font = W;
var T = d.createElement("div");
T.style.position = "absolute";
T.style.opacity = 0;
T.style.fontFamily = '"' + X.name + '"';
T.style.fontSize = Q + "px";
T.innerHTML = ac + "
" + ac;
d.body.appendChild(T);
var U = N.width,
ab = N.height,
V = ab / 2;
Y.fillStyle = "white";
Y.fillRect(0, 0, U, ab);
Y.fillStyle = "black";
Y.fillText(ac, 0, V);
var P = Y.getImageData(0, 0, U, ab).data;
var Z = 0,
S = U * 4,
aa = P.length;
while (++Z < aa && P[Z] === 255) {
G()
}
var R = q.round(Z / S);
Z = aa - 1;
while (--Z > 0 && P[Z] === 255) {
G()
}
var ad = q.round(Z / S);
X.ascent = ae * (V - R);
X.descent = ae * (ad - V);
if (d.defaultView.getComputedStyle) {
var O = d.defaultView.getComputedStyle(T, null).getPropertyValue("height");
O = ae * O.replace("px", "");
if (O >= X.size * 2) {
X.leading = q.round(O / 2)
}
}
d.body.removeChild(T);
if (X.caching) {
return Y
}
}
function H(N, O) {
if (N === t) {
N = ""
}
this.name = N;
if (O === t) {
O = 0
}
this.size = O;
this.glyph = false;
this.ascent = 0;
this.descent = 0;
this.leading = 1.2 * O;
var R = N.indexOf(" Italic Bold");
if (R !== -1) {
N = N.substring(0, R)
}
this.style = "normal";
var Q = N.indexOf(" Italic");
if (Q !== -1) {
N = N.substring(0, Q);
this.style = "italic"
}
this.weight = "normal";
var P = N.indexOf(" Bold");
if (P !== -1) {
N = N.substring(0, P);
this.weight = "bold"
}
this.family = "sans-serif";
if (N !== t) {
switch (N) {
case "sans-serif":
case "serif":
case "monospace":
case "fantasy":
case "cursive":
this.family = N;
break;
default:
this.family = '"' + N + '", sans-serif';
break
}
}
this.context2d = p(this);
this.css = this.getCSSDefinition();
if (this.context2d) {
this.context2d.font = this.css
}
}
H.prototype.caching = true;
H.prototype.getCSSDefinition = function(P, N) {
if (P === t) {
P = this.size + "px"
}
if (N === t) {
N = this.leading + "px"
}
var O = [this.style, "normal", this.weight, P + "/" + N, this.family];
return O.join(" ")
};
H.prototype.measureTextWidth = function(N) {
return this.context2d.measureText(N).width
};
H.prototype.measureTextWidthFallback = function(P) {
var O = d.createElement("canvas"),
N = O.getContext("2d");
N.font = this.css;
return N.measureText(P).width
};
H.PFontCache = {
length: 0
};
H.get = function(Q, R) {
R = (R * 10 + 0.5 | 0) / 10;
var O = H.PFontCache,
N = Q + "/" + R;
if (!O[N]) {
O[N] = new H(Q, R);
O.length++;
if (O.length === 50) {
H.prototype.measureTextWidth = H.prototype.measureTextWidthFallback;
H.prototype.caching = false;
var P;
for (P in O) {
if (P !== "length") {
O[P].context2d = null
}
}
return new H(Q, R)
}
if (O.length === 400) {
H.PFontCache = {};
H.get = H.getFallback;
return new H(Q, R)
}
}
return O[N]
};
H.getFallback = function(N, O) {
return new H(N, O)
};
H.list = function() {
return ["sans-serif", "serif", "monospace", "fantasy", "cursive"]
};
H.preloading = {
template: {},
initialized: false,
initialize: function() {
var P = function() {
var R = "#E3KAI2wAgT1MvMg7Eo3VmNtYX7ABi3CxnbHlm7Abw3kaGVhZ7ACs3OGhoZWE7A53CRobXR47AY3AGbG9jYQ7G03Bm1heH7ABC3CBuYW1l7Ae3AgcG9zd7AI3AE#B3AQ2kgTY18PPPUACwAg3ALSRoo3#yld0xg32QAB77#E777773B#E3C#I#Q77773E#Q7777777772CMAIw7AB77732B#M#Q3wAB#g3B#E#E2BB//82BB////w#B7#gAEg3E77x2B32B#E#Q#MTcBAQ32gAe#M#QQJ#E32M#QQJ#I#g32Q77#";
var Q = function(S) {
return "AAAAAAAA".substr(~~S ? 7 - S : 6)
};
return R.replace(/[#237]/g, Q)
};
var N = d.createElement("style");
N.setAttribute("type", "text/css");
N.innerHTML = '@font-face {\n font-family: "PjsEmptyFont";\n src: url(\'data:application/x-font-ttf;base64,' + P() + "')\n format('truetype');\n}";
d.head.appendChild(N);
var O = d.createElement("span");
O.style.cssText = 'position: absolute; top: 0; left: 0; opacity: 0; font-family: "PjsEmptyFont", fantasy;';
O.innerHTML = "AAAAAAAA";
d.body.appendChild(O);
this.template = O;
this.initialized = true
},
getElementWidth: function(N) {
return d.defaultView.getComputedStyle(N, "").getPropertyValue("width")
},
timeAttempted: 0,
pending: function(R) {
if (!this.initialized) {
this.initialize()
}
var P, N, Q = this.getElementWidth(this.template);
for (var O = 0; O < this.fontList.length; O++) {
P = this.fontList[O];
N = this.getElementWidth(P);
if (this.timeAttempted < 4000 && N === Q) {
this.timeAttempted += R;
return true
} else {
d.body.removeChild(P);
this.fontList.splice(O--, 1);
this.timeAttempted = 0
}
}
if (this.fontList.length === 0) {
return false
}
return true
},
fontList: [],
addedList: {},
add: function(N) {
if (!this.initialized) {
this.initialize()
}
var R = typeof N === "object" ? N.fontFace : N,
Q = typeof N === "object" ? N.url : N;
if (this.addedList[R]) {
return
}
var P = d.createElement("style");
P.setAttribute("type", "text/css");
P.innerHTML = "@font-face{\n font-family: '" + R + "';\n src: url('" + Q + "');\n}\n";
d.head.appendChild(P);
this.addedList[R] = true;
var O = d.createElement("span");
O.style.cssText = "position: absolute; top: 0; left: 0; opacity: 0;";
O.style.fontFamily = '"' + R + '", "PjsEmptyFont", fantasy';
O.innerHTML = "AAAAAAAA";
d.body.appendChild(O);
this.fontList.push(O)
}
};
g.PFont = H;
var F = this.Processing = function(be, ba) {
if (!(this instanceof F)) {
throw "called Processing constructor as if it were a function: missing 'new'."
}
var ae, cV = be === t && ba === t;
if (cV) {
ae = d.createElement("canvas")
} else {
ae = typeof be === "string" ? d.getElementById(be) : be
} if (!(ae instanceof HTMLCanvasElement)) {
throw "called Processing constructor without passing canvas element reference or id."
}
function dw(ea) {
F.debug("Unimplemented - " + ea)
}
var cW = this;
cW.externals = {
canvas: ae,
context: t,
sketch: t
};
cW.name = "Processing.js Instance";
cW.use3DContext = false;
cW.focused = false;
cW.breakShape = false;
cW.glyphTable = {};
cW.pmouseX = 0;
cW.pmouseY = 0;
cW.mouseX = 0;
cW.mouseY = 0;
cW.mouseButton = 0;
cW.mouseScroll = 0;
cW.mouseClicked = t;
cW.mouseDragged = t;
cW.mouseMoved = t;
cW.mousePressed = t;
cW.mouseReleased = t;
cW.mouseScrolled = t;
cW.mouseOver = t;
cW.mouseOut = t;
cW.touchStart = t;
cW.touchEnd = t;
cW.touchMove = t;
cW.touchCancel = t;
cW.key = t;
cW.keyCode = t;
cW.keyPressed = G;
cW.keyReleased = G;
cW.keyTyped = G;
cW.draw = t;
cW.setup = t;
cW.__mousePressed = false;
cW.__keyPressed = false;
cW.__frameRate = 60;
cW.frameCount = 0;
cW.width = 100;
cW.height = 100;
var d8, cQ, dY, bD = true,
aH = true,
bo = [1, 1, 1, 1],
a1 = 4294967295,
aq = true,
ce = true,
c0 = [0, 0, 0, 1],
cv = 4278190080,
b3 = true,
dW = 1,
ax = false,
dO = false,
aC = true,
b4 = 0,
bK = 0,
cN = 3,
a8 = 0,
a7 = 0,
a6 = 0,
a2 = 0,
dU = 60,
az = 1000 / dU,
Z = "default",
ck = ae.style.cursor,
dR = 20,
cj = 0,
d6 = [],
aJ = 0,
Q = 20,
cM = false,
a4 = -3355444,
cy = 20,
bU = 255,
bJ = 255,
bI = 255,
bG = 255,
cZ = false,
aK = false,
dN = 0,
d5 = 0,
cY = 1,
bf = null,
bw = null,
a5 = false,
dq = Date.now(),
dt = dq,
P = 0,
cE, c3, aQ, aL, bz, cd, U, dC = {
attributes: {},
locations: {}
},
dx, dQ, bT, bh, cJ, dk, aB, b2, bg, b8, at, aG, bC, aw, af, c7, bS, cs = {
width: 0,
height: 0
},
d4 = 2,
dT = false,
cH, ac, R, N = 37,
c1 = 0,
cI = 4,
Y = "Arial",
d0 = 12,
a3 = 9,
dA = 2,
d7 = 14,
W = H.get(Y, d0),
aj, cn = null,
dV = false,
d3, bZ = 1000,
ag = [],
dI = null,
dX = [16, 17, 18, 20, 33, 34, 35, 36, 37, 38, 39, 40, 144, 155, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 157];
var ad, dp, aU, bX;
if (d.defaultView && d.defaultView.getComputedStyle) {
ad = parseInt(d.defaultView.getComputedStyle(ae, null)["paddingLeft"], 10) || 0;
dp = parseInt(d.defaultView.getComputedStyle(ae, null)["paddingTop"], 10) || 0;
aU = parseInt(d.defaultView.getComputedStyle(ae, null)["borderLeftWidth"], 10) || 0;
bX = parseInt(d.defaultView.getComputedStyle(ae, null)["borderTopWidth"], 10) || 0
}
var dL = 0;
var bL = 0,
bM = 0,
bt = [],
bs = [],
br = [],
ah = new e(720),
bl = new e(720),
cF, cA;
var bV, ch, dJ, aT, am, da, ab, db, ap = false,
ci = false,
cK = 60 * (q.PI / 180),
dl = cW.width / 2,
dj = cW.height / 2,
di = dj / q.tan(cK / 2),
a0 = di / 10,
av = di * 10,
b5 = cW.width / cW.height;
var bb = [],
cb = [],
c2 = 0,
dP = false,
aa = false,
du = true;
var S = 0;
var bm = [];
var dh = new e([0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5]);
var bH = new e([0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5]);
var df = new e([0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]);
var ak = new e([0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0]);
var ai = new e([0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]);
var aO = "varying vec4 vFrontColor;attribute vec3 aVertex;attribute vec4 aColor;uniform mat4 uView;uniform mat4 uProjection;uniform float uPointSize;void main(void) { vFrontColor = aColor; gl_PointSize = uPointSize; gl_Position = uProjection * uView * vec4(aVertex, 1.0);}";
var bQ = "#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 vFrontColor;uniform bool uSmooth;void main(void){ if(uSmooth == true){ float dist = distance(gl_PointCoord, vec2(0.5)); if(dist > 0.5){ discard; } } gl_FragColor = vFrontColor;}";
var dE = "varying vec4 vFrontColor;attribute vec3 aVertex;attribute vec2 aTextureCoord;uniform vec4 uColor;uniform mat4 uModel;uniform mat4 uView;uniform mat4 uProjection;uniform float uPointSize;varying vec2 vTextureCoord;void main(void) { gl_PointSize = uPointSize; vFrontColor = uColor; gl_Position = uProjection * uView * uModel * vec4(aVertex, 1.0); vTextureCoord = aTextureCoord;}";
var aW = "#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 vFrontColor;varying vec2 vTextureCoord;uniform sampler2D uSampler;uniform int uIsDrawingText;uniform bool uSmooth;void main(void){ if(uSmooth == true){ float dist = distance(gl_PointCoord, vec2(0.5)); if(dist > 0.5){ discard; } } if(uIsDrawingText == 1){ float alpha = texture2D(uSampler, vTextureCoord).a; gl_FragColor = vec4(vFrontColor.rgb * alpha, alpha); } else{ gl_FragColor = vFrontColor; }}";
var bA = /Windows/.test(navigator.userAgent);
var dn = "varying vec4 vFrontColor;attribute vec3 aVertex;attribute vec3 aNormal;attribute vec4 aColor;attribute vec2 aTexture;varying vec2 vTexture;uniform vec4 uColor;uniform bool uUsingMat;uniform vec3 uSpecular;uniform vec3 uMaterialEmissive;uniform vec3 uMaterialAmbient;uniform vec3 uMaterialSpecular;uniform float uShininess;uniform mat4 uModel;uniform mat4 uView;uniform mat4 uProjection;uniform mat4 uNormalTransform;uniform int uLightCount;uniform vec3 uFalloff;struct Light { int type; vec3 color; vec3 position; vec3 direction; float angle; vec3 halfVector; float concentration;};uniform Light uLights0;uniform Light uLights1;uniform Light uLights2;uniform Light uLights3;uniform Light uLights4;uniform Light uLights5;uniform Light uLights6;uniform Light uLights7;Light getLight(int index){ if(index == 0) return uLights0; if(index == 1) return uLights1; if(index == 2) return uLights2; if(index == 3) return uLights3; if(index == 4) return uLights4; if(index == 5) return uLights5; if(index == 6) return uLights6; return uLights7;}void AmbientLight( inout vec3 totalAmbient, in vec3 ecPos, in Light light ) { float d = length( light.position - ecPos ); float attenuation = 1.0 / ( uFalloff[0] + ( uFalloff[1] * d ) + ( uFalloff[2] * d * d )); totalAmbient += light.color * attenuation;}void DirectionalLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float powerFactor = 0.0; float nDotVP = max(0.0, dot( vertNormal, normalize(-light.position) )); float nDotVH = max(0.0, dot( vertNormal, normalize(-light.position-normalize(ecPos) ))); if( nDotVP != 0.0 ){ powerFactor = pow( nDotVH, uShininess ); } col += light.color * nDotVP; spec += uSpecular * powerFactor;}void PointLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float powerFactor; vec3 VP = light.position - ecPos; float d = length( VP ); VP = normalize( VP ); float attenuation = 1.0 / ( uFalloff[0] + ( uFalloff[1] * d ) + ( uFalloff[2] * d * d )); float nDotVP = max( 0.0, dot( vertNormal, VP )); vec3 halfVector = normalize( VP - normalize(ecPos) ); float nDotHV = max( 0.0, dot( vertNormal, halfVector )); if( nDotVP == 0.0 ) { powerFactor = 0.0; } else { powerFactor = pow( nDotHV, uShininess ); } spec += uSpecular * powerFactor * attenuation; col += light.color * nDotVP * attenuation;}void SpotLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float spotAttenuation; float powerFactor = 0.0; vec3 VP = light.position - ecPos; vec3 ldir = normalize( -light.direction ); float d = length( VP ); VP = normalize( VP ); float attenuation = 1.0 / ( uFalloff[0] + ( uFalloff[1] * d ) + ( uFalloff[2] * d * d ) ); float spotDot = dot( VP, ldir );" + (bA ? " spotAttenuation = 1.0; " : " if( spotDot > cos( light.angle ) ) { spotAttenuation = pow( spotDot, light.concentration ); } else{ spotAttenuation = 0.0; } attenuation *= spotAttenuation;") + " float nDotVP = max( 0.0, dot( vertNormal, VP ) ); vec3 halfVector = normalize( VP - normalize(ecPos) ); float nDotHV = max( 0.0, dot( vertNormal, halfVector ) ); if( nDotVP != 0.0 ) { powerFactor = pow( nDotHV, uShininess ); } spec += uSpecular * powerFactor * attenuation; col += light.color * nDotVP * attenuation;}void main(void) { vec3 finalAmbient = vec3( 0.0 ); vec3 finalDiffuse = vec3( 0.0 ); vec3 finalSpecular = vec3( 0.0 ); vec4 col = uColor; if ( uColor[0] == -1.0 ){ col = aColor; } vec3 norm = normalize(vec3( uNormalTransform * vec4( aNormal, 0.0 ) )); vec4 ecPos4 = uView * uModel * vec4(aVertex, 1.0); vec3 ecPos = (vec3(ecPos4))/ecPos4.w; if( uLightCount == 0 ) { vFrontColor = col + vec4(uMaterialSpecular, 1.0); } else { for( int i = 0; i < 8; i++ ) { Light l = getLight(i); if( i >= uLightCount ){ break; } if( l.type == 0 ) { AmbientLight( finalAmbient, ecPos, l ); } else if( l.type == 1 ) { DirectionalLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } else if( l.type == 2 ) { PointLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } else { SpotLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } } if( uUsingMat == false ) { vFrontColor = vec4( vec3( col ) * finalAmbient + vec3( col ) * finalDiffuse + vec3( col ) * finalSpecular, col[3] ); } else{ vFrontColor = vec4( uMaterialEmissive + (vec3(col) * uMaterialAmbient * finalAmbient ) + (vec3(col) * finalDiffuse) + (uMaterialSpecular * finalSpecular), col[3] ); } } vTexture.xy = aTexture.xy; gl_Position = uProjection * uView * uModel * vec4( aVertex, 1.0 );}";
var aF = "#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 vFrontColor;uniform sampler2D uSampler;uniform bool uUsingTexture;varying vec2 vTexture;void main(void){ if( uUsingTexture ){ gl_FragColor = vec4(texture2D(uSampler, vTexture.xy)) * vFrontColor; } else{ gl_FragColor = vFrontColor; }}";
function d2(ec, eb, ee, ed) {
var ea = dC.locations[ec];
if (ea === t) {
ea = d8.getUniformLocation(eb, ee);
dC.locations[ec] = ea
}
if (ea !== null) {
if (ed.length === 4) {
d8.uniform4fv(ea, ed)
} else {
if (ed.length === 3) {
d8.uniform3fv(ea, ed)
} else {
if (ed.length === 2) {
d8.uniform2fv(ea, ed)
} else {
d8.uniform1f(ea, ed)
}
}
}
}
}
function dZ(ec, eb, ee, ed) {
var ea = dC.locations[ec];
if (ea === t) {
ea = d8.getUniformLocation(eb, ee);
dC.locations[ec] = ea
}
if (ea !== null) {
if (ed.length === 4) {
d8.uniform4iv(ea, ed)
} else {
if (ed.length === 3) {
d8.uniform3iv(ea, ed)
} else {
if (ed.length === 2) {
d8.uniform2iv(ea, ed)
} else {
d8.uniform1i(ea, ed)
}
}
}
}
}
function a9(ee, ec, ef, ed, eb) {
var ea = dC.locations[ee];
if (ea === t) {
ea = d8.getUniformLocation(ec, ef);
dC.locations[ee] = ea
}
if (ea !== -1) {
if (eb.length === 16) {
d8.uniformMatrix4fv(ea, ed, eb)
} else {
if (eb.length === 9) {
d8.uniformMatrix3fv(ea, ed, eb)
} else {
d8.uniformMatrix2fv(ea, ed, eb)
}
}
}
}
function dc(ee, ec, ef, eb, ed) {
var ea = dC.attributes[ee];
if (ea === t) {
ea = d8.getAttribLocation(ec, ef);
dC.attributes[ee] = ea
}
if (ea !== -1) {
d8.bindBuffer(d8.ARRAY_BUFFER, ed);
d8.vertexAttribPointer(ea, eb, d8.FLOAT, false, 0, 0);
d8.enableVertexAttribArray(ea)
}
}
function cg(ec, eb, ed) {
var ea = dC.attributes[ec];
if (ea === t) {
ea = d8.getAttribLocation(eb, ed);
dC.attributes[ec] = ea
}
if (ea !== -1) {
d8.disableVertexAttribArray(ea)
}
}
var bF = function(ec, ee, eb) {
var ef = ec.createShader(ec.VERTEX_SHADER);
ec.shaderSource(ef, ee);
ec.compileShader(ef);
if (!ec.getShaderParameter(ef, ec.COMPILE_STATUS)) {
throw ec.getShaderInfoLog(ef)
}
var ed = ec.createShader(ec.FRAGMENT_SHADER);
ec.shaderSource(ed, eb);
ec.compileShader(ed);
if (!ec.getShaderParameter(ed, ec.COMPILE_STATUS)) {
throw ec.getShaderInfoLog(ed)
}
var ea = ec.createProgram();
ec.attachShader(ea, ef);
ec.attachShader(ea, ed);
ec.linkProgram(ea);
if (!ec.getProgramParameter(ea, ec.LINK_STATUS)) {
throw "Error linking shaders."
}
return ea
};
var aZ = function(ea, ee, eb, ed, ec) {
return {
x: ea,
y: ee,
w: eb,
h: ed
}
};
var bk = aZ;
var b1 = function(ea, ee, eb, ed, ec) {
return {
x: ea,
y: ee,
w: ec ? eb : eb - ea,
h: ec ? ed : ed - ee
}
};
var aN = function(ea, ee, eb, ed, ec) {
return {
x: ea - eb / 2,
y: ee - ed / 2,
w: eb,
h: ed
}
};
var ds = function() {};
var bR = function() {};
var bB = function() {};
var ca = function() {};
bR.prototype = new ds;
bR.prototype.constructor = bR;
bB.prototype = new ds;
bB.prototype.constructor = bB;
ca.prototype = new ds;
ca.prototype.constructor = ca;
ds.prototype.a3DOnlyFunction = G;
var cl = {};
var bP = cW.Character = function(ea) {
if (typeof ea === "string" && ea.length === 1) {
this.code = ea.charCodeAt(0)
} else {
if (typeof ea === "number") {
this.code = ea
} else {
if (ea instanceof bP) {
this.code = ea
} else {
this.code = NaN
}
}
}
return cl[this.code] === t ? cl[this.code] = this : cl[this.code]
};
bP.prototype.toString = function() {
return String.fromCharCode(this.code)
};
bP.prototype.valueOf = function() {
return this.code
};
var O = cW.PShape = function(ea) {
this.family = ea || 0;
this.visible = true;
this.style = true;
this.children = [];
this.nameTable = [];
this.params = [];
this.name = "";
this.image = null;
this.matrix = null;
this.kind = null;
this.close = null;
this.width = null;
this.height = null;
this.parent = null
};
O.prototype = {
isVisible: function() {
return this.visible
},
setVisible: function(ea) {
this.visible = ea
},
disableStyle: function() {
this.style = false;
for (var eb = 0, ea = this.children.length; eb < ea; eb++) {
this.children[eb].disableStyle()
}
},
enableStyle: function() {
this.style = true;
for (var eb = 0, ea = this.children.length; eb < ea; eb++) {
this.children[eb].enableStyle()
}
},
getFamily: function() {
return this.family
},
getWidth: function() {
return this.width
},
getHeight: function() {
return this.height
},
setName: function(ea) {
this.name = ea
},
getName: function() {
return this.name
},
draw: function(ea) {
ea = ea || cW;
if (this.visible) {
this.pre(ea);
this.drawImpl(ea);
this.post(ea)
}
},
drawImpl: function(ea) {
if (this.family === 0) {
this.drawGroup(ea)
} else {
if (this.family === 1) {
this.drawPrimitive(ea)
} else {
if (this.family === 3) {
this.drawGeometry(ea)
} else {
if (this.family === 21) {
this.drawPath(ea)
}
}
}
}
},
drawPath: function(ec) {
var ed, eb;
if (this.vertices.length === 0) {
return
}
ec.beginShape();
if (this.vertexCodes.length === 0) {
if (this.vertices[0].length === 2) {
for (ed = 0, eb = this.vertices.length; ed < eb; ed++) {
ec.vertex(this.vertices[ed][0], this.vertices[ed][1])
}
} else {
for (ed = 0, eb = this.vertices.length; ed < eb; ed++) {
ec.vertex(this.vertices[ed][0], this.vertices[ed][1], this.vertices[ed][2])
}
}
} else {
var ea = 0;
if (this.vertices[0].length === 2) {
for (ed = 0, eb = this.vertexCodes.length; ed < eb; ed++) {
if (this.vertexCodes[ed] === 0) {
ec.vertex(this.vertices[ea][0], this.vertices[ea][1], this.vertices[ea]["moveTo"]);
ec.breakShape = false;
ea++
} else {
if (this.vertexCodes[ed] === 1) {
ec.bezierVertex(this.vertices[ea + 0][0], this.vertices[ea + 0][1], this.vertices[ea + 1][0], this.vertices[ea + 1][1], this.vertices[ea + 2][0], this.vertices[ea + 2][1]);
ea += 3
} else {
if (this.vertexCodes[ed] === 2) {
ec.curveVertex(this.vertices[ea][0], this.vertices[ea][1]);
ea++
} else {
if (this.vertexCodes[ed] === 3) {
ec.breakShape = true
}
}
}
}
}
} else {
for (ed = 0, eb = this.vertexCodes.length; ed < eb; ed++) {
if (this.vertexCodes[ed] === 0) {
ec.vertex(this.vertices[ea][0], this.vertices[ea][1], this.vertices[ea][2]);
if (this.vertices[ea]["moveTo"] === true) {
bb[bb.length - 1]["moveTo"] = true
} else {
if (this.vertices[ea]["moveTo"] === false) {
bb[bb.length - 1]["moveTo"] = false
}
}
ec.breakShape = false
} else {
if (this.vertexCodes[ed] === 1) {
ec.bezierVertex(this.vertices[ea + 0][0], this.vertices[ea + 0][1], this.vertices[ea + 0][2], this.vertices[ea + 1][0], this.vertices[ea + 1][1], this.vertices[ea + 1][2], this.vertices[ea + 2][0], this.vertices[ea + 2][1], this.vertices[ea + 2][2]);
ea += 3
} else {
if (this.vertexCodes[ed] === 2) {
ec.curveVertex(this.vertices[ea][0], this.vertices[ea][1], this.vertices[ea][2]);
ea++
} else {
if (this.vertexCodes[ed] === 3) {
ec.breakShape = true
}
}
}
}
}
}
}
ec.endShape(this.close ? 2 : 1)
},
drawGeometry: function(ec) {
var ed, eb;
ec.beginShape(this.kind);
if (this.style) {
for (ed = 0, eb = this.vertices.length; ed < eb; ed++) {
ec.vertex(this.vertices[ed])
}
} else {
for (ed = 0, eb = this.vertices.length; ed < eb; ed++) {
var ea = this.vertices[ed];
if (ea[2] === 0) {
ec.vertex(ea[0], ea[1])
} else {
ec.vertex(ea[0], ea[1], ea[2])
}
}
}
ec.endShape()
},
drawGroup: function(eb) {
for (var ec = 0, ea = this.children.length; ec < ea; ec++) {
this.children[ec].draw(eb)
}
},
drawPrimitive: function(ea) {
if (this.kind === 2) {
ea.point(this.params[0], this.params[1])
} else {
if (this.kind === 4) {
if (this.params.length === 4) {
ea.line(this.params[0], this.params[1], this.params[2], this.params[3])
} else {
ea.line(this.params[0], this.params[1], this.params[2], this.params[3], this.params[4], this.params[5])
}
} else {
if (this.kind === 8) {
ea.triangle(this.params[0], this.params[1], this.params[2], this.params[3], this.params[4], this.params[5])
} else {
if (this.kind === 16) {
ea.quad(this.params[0], this.params[1], this.params[2], this.params[3], this.params[4], this.params[5], this.params[6], this.params[7])
} else {
if (this.kind === 30) {
if (this.image !== null) {
var ee = bk;
ea.imageMode(0);
ea.image(this.image, this.params[0], this.params[1], this.params[2], this.params[3]);
bk = ee
} else {
var eb = bK;
ea.rectMode(0);
ea.rect(this.params[0], this.params[1], this.params[2], this.params[3]);
bK = eb
}
} else {
if (this.kind === 31) {
var ec = cN;
ea.ellipseMode(0);
ea.ellipse(this.params[0], this.params[1], this.params[2], this.params[3]);
cN = ec
} else {
if (this.kind === 32) {
var ed = cN;
ea.ellipseMode(0);
ea.arc(this.params[0], this.params[1], this.params[2], this.params[3], this.params[4], this.params[5]);
cN = ed
} else {
if (this.kind === 41) {
if (this.params.length === 1) {
ea.box(this.params[0])
} else {
ea.box(this.params[0], this.params[1], this.params[2])
}
} else {
if (this.kind === 40) {
ea.sphere(this.params[0])
}
}
}
}
}
}
}
}
}
},
pre: function(ea) {
if (this.matrix) {
ea.pushMatrix();
ea.transform(this.matrix)
}
if (this.style) {
ea.pushStyle();
this.styles(ea)
}
},
post: function(ea) {
if (this.matrix) {
ea.popMatrix()
}
if (this.style) {
ea.popStyle()
}
},
styles: function(ea) {
if (this.stroke) {
ea.stroke(this.strokeColor);
ea.strokeWeight(this.strokeWeight);
ea.strokeCap(this.strokeCap);
ea.strokeJoin(this.strokeJoin)
} else {
ea.noStroke()
} if (this.fill) {
ea.fill(this.fillColor)
} else {
ea.noFill()
}
},
getChild: function(ed) {
var eb, ea;
if (typeof ed === "number") {
return this.children[ed]
}
var ec;
if (ed === "" || this.name === ed) {
return this
}
if (this.nameTable.length > 0) {
for (eb = 0, ea = this.nameTable.length; eb < ea || ec; eb++) {
if (this.nameTable[eb].getName === ed) {
ec = this.nameTable[eb];
break
}
}
if (ec) {
return ec
}
}
for (eb = 0, ea = this.children.length; eb < ea; eb++) {
ec = this.children[eb].getChild(ed);
if (ec) {
return ec
}
}
return null
},
getChildCount: function() {
return this.children.length
},
addChild: function(ea) {
this.children.push(ea);
ea.parent = this;
if (ea.getName() !== null) {
this.addName(ea.getName(), ea)
}
},
addName: function(eb, ea) {
if (this.parent !== null) {
this.parent.addName(eb, ea)
} else {
this.nameTable.push([eb, ea])
}
},
translate: function() {
if (arguments.length === 2) {
this.checkMatrix(2);
this.matrix.translate(arguments[0], arguments[1])
} else {
this.checkMatrix(3);
this.matrix.translate(arguments[0], arguments[1], 0)
}
},
checkMatrix: function(ea) {
if (this.matrix === null) {
if (ea === 2) {
this.matrix = new cW.PMatrix2D
} else {
this.matrix = new cW.PMatrix3D
}
} else {
if (ea === 3 && this.matrix instanceof cW.PMatrix2D) {
this.matrix = new cW.PMatrix3D
}
}
},
rotateX: function(ea) {
this.rotate(ea, 1, 0, 0)
},
rotateY: function(ea) {
this.rotate(ea, 0, 1, 0)
},
rotateZ: function(ea) {
this.rotate(ea, 0, 0, 1)
},
rotate: function() {
if (arguments.length === 1) {
this.checkMatrix(2);
this.matrix.rotate(arguments[0])
} else {
this.checkMatrix(3);
this.matrix.rotate(arguments[0], arguments[1], arguments[2], arguments[3])
}
},
scale: function() {
if (arguments.length === 2) {
this.checkMatrix(2);
this.matrix.scale(arguments[0], arguments[1])
} else {
if (arguments.length === 3) {
this.checkMatrix(2);
this.matrix.scale(arguments[0], arguments[1], arguments[2])
} else {
this.checkMatrix(2);
this.matrix.scale(arguments[0])
}
}
},
resetMatrix: function() {
this.checkMatrix(2);
this.matrix.reset()
},
applyMatrix: function(ea) {
if (arguments.length === 1) {
this.applyMatrix(ea.elements[0], ea.elements[1], 0, ea.elements[2], ea.elements[3], ea.elements[4], 0, ea.elements[5], 0, 0, 1, 0, 0, 0, 0, 1)
} else {
if (arguments.length === 6) {
this.checkMatrix(2);
this.matrix.apply(arguments[0], arguments[1], arguments[2], 0, arguments[3], arguments[4], arguments[5], 0, 0, 0, 1, 0, 0, 0, 0, 1)
} else {
if (arguments.length === 16) {
this.checkMatrix(3);
this.matrix.apply(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7], arguments[8], arguments[9], arguments[10], arguments[11], arguments[12], arguments[13], arguments[14], arguments[15])
}
}
}
}
};
var cr = cW.PShapeSVG = function() {
cW.PShape.call(this);
if (arguments.length === 1) {
this.element = arguments[0];
this.vertexCodes = [];
this.vertices = [];
this.opacity = 1;
this.stroke = false;
this.strokeColor = 4278190080;
this.strokeWeight = 1;
this.strokeCap = "butt";
this.strokeJoin = "miter";
this.strokeGradient = null;
this.strokeGradientPaint = null;
this.strokeName = null;
this.strokeOpacity = 1;
this.fill = true;
this.fillColor = 4278190080;
this.fillGradient = null;
this.fillGradientPaint = null;
this.fillName = null;
this.fillOpacity = 1;
if (this.element.getName() !== "svg") {
throw "root is not