From 57d6b3e077f55b63ec98a5fefdbdae50b5335e09 Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Sun, 9 Feb 2020 16:07:56 -0500
Subject: externalized charToTile component of raster
---
utils/raster.js | 2 +-
utils/vec.js | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/utils/raster.js b/utils/raster.js
index 44f4678..1e17838 100644
--- a/utils/raster.js
+++ b/utils/raster.js
@@ -6,7 +6,7 @@ const vec = require('./vec');
module.exports = function(space){
// just use .subsection
let tiles = {};
- dim = ms(space).map(coord => vec.dot(coord,[1/8, 1/16])).map(tile => vec.elem(tile, [], a => Math.floor(a)));
+ dim = ms(space).map(coord => vec.charToTile(coord));
for (let y=dim[0][0]; y<=dim[0][1]; y++) for (let x=dim[1][0]; x<=dim[1][1]; x++){
let tile = tileToChar([y,x]);
tiles[tile] = space.subsection(tile, vec.add(tile, [8,16]));
diff --git a/utils/vec.js b/utils/vec.js
index d595989..57104df 100644
--- a/utils/vec.js
+++ b/utils/vec.js
@@ -33,6 +33,9 @@ exports.dot = function(orig,vec){
exports.tileToChar = function(orig){
return exports.dot(orig, [8,16]);
}
+exports.charToTile = function(orig){
+ return exports.elem(exports.dot(orig, [1/8, 1/16]), [], a => Math.floor(a));
+}
exports.norm = function(orig){
let sum = orig.reduce( (acc, cur) => acc+cur );
return exports.dot(orig, 1/sum);
--
cgit
From 3f124e1abb0979f460c79d95041f1eb23c3b74e8 Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Tue, 11 Feb 2020 20:28:08 +0000
Subject: no longer sends `undefined` char with job pad step
---
tools/schedule.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/schedule.js b/tools/schedule.js
index dfbe854..d8509b8 100644
--- a/tools/schedule.js
+++ b/tools/schedule.js
@@ -104,7 +104,7 @@ exports.Queue = function(delayms, maxExport, call){
// Step 4: Shallow copy job array, and sort by job.wacc.
for (job of jobq.slice().sort((el, ne) => el.wacc-ne.wacc)){
// Step 5: Iterate through array (high->low), and subtract 1 until the length of output is num.
- if (dequeued.length == num) break;
+ if (dequeued.length == num || job.data.length == 0) break;
job.wacc--;
dequeued.push(job.data.pop());
}
--
cgit