I’ve had this weird error in my pattern renderer with my 1192 pixel Cloud Ceiling. Some pixels are just ‘missing’ in the render, always showing as black. It all looks fine in-person, and the mapper render is also fine. It seems like only the pattern renderer is struggling.
The LED layout is a bit janky so the map is weird and the only thing I can see being the cause (map below)
This happens with every pattern.
//Cloud Ceiling Multiple Matrix Normalized
//1192 pixels, GRB
function (pixelCount) {
//set zigzag to true if every other LED row travels in reverse
//if they are all straight across, set it to false
zigzag = true
//rotate a point (x, y), along a center (cx, cy), by an angle in degrees
function rotate(cx, cy, x, y, angle) {
var radians = (Math.PI / 180) * angle,
cos = Math.cos(radians),
sin = Math.sin(radians),
nx = (cos * (x - cx)) + (sin * (y - cy)) + cx,
ny = (cos * (y - cy)) - (sin * (x - cx)) + cy;
return [nx, ny];
}
//create a set of coordinates for a matrix panel
//sized (w, h), rotated by an angle, and offset by (sx, sy)
function panel(w, h, sx, sy, angle, xinv, normalize) {
var x, x2, y, p, map =
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {
//for zigzag, flip direction every other row
if (zigzag && y % 2 == xinv)
x2 = w - 1 - x
else
x2 = x
p = rotate((w-1)/2, (h-1)/2, x2, y, angle);
if(normalize){
if(angle == 90 || angle == 270){
p[0] = (0.48+p[0])/h
p[1] = (-0.45+p[1])/w
} else {
p[0] = p[0]/w
p[1] = p[1]/h
}
} else if(h = 6) {
p[0] = p[0]/11
p[1] = p[1]/12
}
p[0] += sx
p[1] += sy
map.push(p)
}
}
return map;
}
//assemble one or more panels
var map = ;
map = map.concat(panel( 3, 6, 8/11, 2.5, 180, 1, 0))
map = map.concat(panel(11, 6, 0, 2, 180, 1, 0))
map = map.concat(panel(11, 13, 1, 2, 0, 1, 1))
map = map.concat(panel(11, 12, 2, 2, 180, 0, 1))
map = map.concat(panel(11, 12, 2, 1, 180, 0, 1))
map = map.concat(panel(11, 12, 2, 0, 180, 0, 1))
map = map.concat(panel(11, 13, 1, 0, 0, 0, 1))
map = map.concat(panel(11, 12, 0, 0, 270, 0, 1))
map = map.concat(panel(11, 13, 0, 1, 0, 1, 1))
map = map.concat(panel(11, 12, 1, 1, 90, 1, 1))
return map
}