@@ 273,7 273,25 @@ function render() {
ctx.clearRect(0, 0, can.width, can.height);
const det = getDet();
if (Math.abs(det) > LOW_DET_THRESH) {
+ // full rank, render a grid
renderGrid(renderOpts, ctx);
+ } else {
+ const distFromOrigin = [state.ihat, state.jhat].map(vec => Math.abs(vec.reduce((a, b) => a + b))).reduce((a, b) => a + b);
+ if (distFromOrigin > 0.1) {
+ // rank 1, render a line
+ // if det is 0 then ihat's tip, jhat's tip, and the origin will all be on a line
+ // but when it's almost 0, do some trickery to get the line to look right
+
+ // TODO: properly extend to screen edges
+ const points = [
+ transformPoint(state.ihat).map(x => x * 100),
+ [0, 0],
+ transformPoint(state.jhat).map(x => x * 100),
+ ];
+
+ renderLine(renderOpts, "black", false, points[0], points[2], ctx, x => x);
+ }
+ // draw nothing repersenting the transformation for rank 0
}
// unit vectors