For anyone wanting to see the map, this is it, with the corrected math for the segments. I don’ think I have any duplicated pixels with it.
function (pixelCount) {
width = 55
length = 60
height = 30
// generate wireframe of tabletop with backboard
// a 3d adaptation of the 2d line function
// x, y, z is the starting position
// dx, dy, dz is how far each step is, 0=no movement, 1=move in positive direction, -1=move in negative direction
// count is the number of steps
function line (x, y, z, dx, dy, dz, count) {
var line = [];
for (var i = 0; i < count; i++) {
line.push([x + dx * i, y + dy * i, z + dz * i]);
}
return line;
}
var map = []
// start at 0,0, move 1,0 for each pixel, lengthPixels
// first long side of tabletop]
map = map.concat(line(0, 0, 0, 1, 0, 0, length))
//then moving down, assuming 1 pixel from above counts toward the widthPixels
// start at lengthPixel,1, move 0,1 for each pixel, widthPixels
// short, back side of tabletop
map = map.concat(line(length,1, 0, 0, 1, 0, width))
//then from the bottom right to bottom left
//second long side of tabletop
map = map.concat(line(length-1, width, 0, -1, 0, 0, length))
//vertical leg up backboard
map = map.concat(line(0, width, 1, 0, 0, 1, height))
//second short side of tabletop, at higher *height
map = map.concat(line(0, width-1, height, 0, -1, 0, width))
// vertical leg down backboard
map = map.concat(line(0, 0, height-1, 0, 0, -1, height-1))
return map;
}