Skip to content

Commit

Permalink
redown missing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferis committed Jan 26, 2023
1 parent 7153792 commit fa90831
Show file tree
Hide file tree
Showing 26 changed files with 9,683 additions and 0 deletions.

Large diffs are not rendered by default.

901 changes: 901 additions & 0 deletions docs/articles/FAFB-FlyWire_files/htmlwidgets-1.6.1/htmlwidgets.js

Large diffs are not rendered by default.

939 changes: 939 additions & 0 deletions docs/articles/FAFB-FlyWire_files/plotly-binding-4.10.1/plotly.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
just here so that plotly works
correctly with ioslides.
see https://github.com/ropensci/plotly/issues/463
*/

slide:not(.current) .plotly.html-widget{
display: none;
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* el is the div, holding the rgl object as el.rglinstance,
which holds x as el.rglinstance.scene
x is the JSON encoded rglwidget.
*/


HTMLWidgets.widget({

name: 'rglWebGL',

type: 'output',

factory: function(el, width, height) {
el.width = width;
el.height = height;
var rgl = new rglwidgetClass(),
onchangeselection = function(e) {
for (var i = 0; i < rgl.scene.crosstalk.sel_handle.length; i++)
rgl.clearBrush(except = e.rglSubsceneId);
rgl.selection(e, false);
},
onchangefilter = function(e) {
rgl.selection(e, true);
};

return {
renderValue: function(x) {
var i, pel, player, groups,
inShiny = (typeof Shiny !== "undefined");

x.crosstalk.group = groups = [].concat(x.crosstalk.group);
x.crosstalk.id = [].concat(x.crosstalk.id);
x.crosstalk.key = [].concat(x.crosstalk.key);
x.crosstalk.sel_handle = new Array(groups.length);
x.crosstalk.fil_handle = new Array(groups.length);
x.crosstalk.selection = [];
for (i = 0; i < groups.length; i++) {
x.crosstalk.sel_handle[i] = new crosstalk.SelectionHandle(groups[i], {sharedId: x.crosstalk.id[i]});
x.crosstalk.sel_handle[i].on("change", onchangeselection);
x.crosstalk.fil_handle[i] = new crosstalk.FilterHandle(groups[i], {sharedId: x.crosstalk.id[i]});
x.crosstalk.fil_handle[i].on("change", onchangefilter);
}
if (inShiny) {
// Shiny calls this multiple times, so we need extra cleanup
// between
rgl.sphere = undefined;
}
rgl.initialize(el, x);
rgl.initGL();

/* We might have been called after (some of) the players were rendered.
We need to make sure we respond to their initial values. */

if (typeof x.players !== "undefined") {
var players = [].concat(x.players);
for (i = 0; i < players.length; i++) {
pel = document.getElementById(players[i]);
if (pel) {
player = pel.rglPlayer;
if (player && (!player.initialized || inShiny)) {
rgl.Player(pel, player);
player.initialized = true;
}
}
}
}
rgl.drag = 0;
rgl.drawScene();
},

resize: function(width, height) {
el.width = width;
el.height = height;
el.rglinstance.resize(el);
el.rglinstance.drawScene();
}
};
}
});
153 changes: 153 additions & 0 deletions docs/articles/FAFB-FlyWire_files/rglwidgetClass-1.0.1/animation.src.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/**
* Methods related to animations
* @name ___METHODS_FOR_ANIMATION___
* @memberof rglwidgetClass
* @kind function
* @instance
*/
/**
* Binary search
* @param x - x coordinates in increasing order
* @param newx - value to find, assumed to be in the range of x
* @result index of largest x value below newx
*/
rglwidgetClass.bisect = function(x, newx) {
var lo = 0, hi = x.length - 1, mid;
while (lo < hi - 1) {
mid = Math.round((lo + hi)/2);
if (x[mid] < newx)
lo = mid;
else
hi = mid;
}
return lo;
};

/**
* Step interpolation (constant outside bounds)
* @param x - x coordinates in increasing order
* @param v - values at x; either a vector or matrix
* @param newx - value at which to evaluate
*/
rglwidgetClass.step = function(x, v, newx) {
var n, lo;
if (newx <= x[0])
return v[0];
n = x.length;
if (newx >= x[n-1])
return v[n-1];
lo = this.bisect(x, newx);
return v[lo];
};

/**
* Linear interpolation (constant outside bounds)
* @param x - x coordinates in increasing order
* @param v - values at x; either a vector or matrix
* @param newx - value at which to evaluate
*/
rglwidgetClass.lerp = function(x, v, newx) {
var i, n, lo, hi, alpha, result;
if (newx <= x[0])
return v[0];
n = x.length;
if (newx >= x[n-1])
return v[n-1];
lo = this.bisect(x, newx);
if (newx === x[lo])
return v[lo];
hi = lo + 1;
if (newx === x[hi])
return v[hi];
alpha = (newx - x[lo])/(x[hi] - x[lo]);
result = v[lo];
n = result.length;
if (typeof n !== "undefined") {
for (i = 0; i < n; i++)
result[i] = (1 - alpha)*result[i] + alpha*v[hi][i];
} else
result = (1 - alpha)*result + alpha*v[hi];
return result;
};

/**
* Spherical linear interpolation (constant outside bounds)
* @param x - x coordinates in increasing order
* @param v - a matrix of unit quaternions
* @param newx - value at which to evaluate
*/
rglwidgetClass.slerp = function(x, v, newx) {
var n, lo, hi, alpha, result,
p0, p1, dot, Omega, alpha0, alpha1, len;
if (newx <= x[0])
return v[0];
if (newx >= x[n-1])
return v[n-1];
lo = this.bisect(x, newx);
if (newx === x[lo])
return v[lo];
hi = lo + 1;
if (newx === x[hi])
return v[hi];
p0 = v[lo];
p1 = v[hi];
dot = p0[0]*p1[0] +
p0[1]*p1[1] +
p0[2]*p1[2] +
p0[3]*p1[3];
if (dot < 0) {
p1 = [-p1[0], -p1[1], -p1[2], -p1[3]];
dot = -dot;
}
if (dot >= 1)
result = p1;
else {
alpha = (newx - x[lo])/(x[hi] - x[lo]);
Omega = Math.acos(dot);
alpha0 = Math.sin((1 - alpha)*Omega);
alpha1 = Math.sin(alpha*Omega);
result = [alpha0*p0[0] + alpha1*p1[0],
alpha0*p0[1] + alpha1*p1[1],
alpha0*p0[2] + alpha1*p1[2],
alpha0*p0[3] + alpha1*p1[3]];
}
len = Math.sqrt(result[0]*result[0] +
result[1]*result[1] +
result[2]*result[2] +
result[3]*result[3]);
return [result[0]/len,
result[1]/len,
result[2]/len,
result[3]/len];
};

/**
* Rotate using unit quaternion
* @param q - a single unit quaternion
*/
rglwidgetClass.rotateByQuaternion = function(M, q) {

var xx = q[0]*q[0],
xy = q[0]*q[1],
xz = q[0]*q[2],
xw = q[0]*q[3],
yy = q[1]*q[1],
yz = q[1]*q[2],
yw = q[1]*q[3],
zz = q[2]*q[2],
zw = q[2]*q[3],
matrix = new CanvasMatrix4();
matrix.m11 = 1 - 2*(yy + zz);
matrix.m12 = 2*(xy + zw);
matrix.m13 = 2*(xz - yw);

matrix.m21 = 2*(xy - zw);
matrix.m22 = 1 - 2*(xx + zz);
matrix.m23 = 2*(yz + xw);

matrix.m31 = 2*(xz + yw);
matrix.m32 = 2*(yz - xw);
matrix.m33 = 1 - 2*(xx + yy);

M.multRight(matrix);
};
Loading

0 comments on commit fa90831

Please sign in to comment.