Corner placements of screw conveyors stay separate ends (t62 follow-up)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+43
-19
@@ -97,34 +97,58 @@ with sync_playwright() as p:
|
||||
}''')
|
||||
check('sidewall stays behind the grain colour in pixels and smooth',
|
||||
wall and wall['colors'][0] == wall['colors'][1] and wall['grainClass'] == 2, wall)
|
||||
# All 64 straight/diagonal mouths must have copper casing on both sides of the join.
|
||||
# Edge joins keep closed elbows; corner placements match two isolated free ends.
|
||||
pg.set_viewport_size({"width": 2100, "height": 1300})
|
||||
ev("part.fill(0); blockP.fill(0); occ.fill(0); mach.fill(0); ents=[]; ghostBlocks.clear();")
|
||||
ev("() => {" + (root / "tools/scenes/t62-joins.js").read_text() + "}")
|
||||
mouths = ev('''() => {
|
||||
SET.zoom=6; SET.lighting="off"; SET.glow="off"; resizeRender();
|
||||
bot.x=CAM[0]-bot.w/2;bot.y=CAM[1]-bot.h/2;snapCamera();
|
||||
const out={};
|
||||
for(const look of ["pixel","smooth"]) {
|
||||
SET.look=look;SM.scale=1;drawWorld();
|
||||
const bad=[];
|
||||
for(const j of T62_JOINTS) {
|
||||
const slope=j.v===4 || j.v===6?-1:1;
|
||||
const end=j.end*SCREW_DIRS[j.v][0];
|
||||
const dx=j.vertical?0:end,dy=j.vertical?end*slope:0;
|
||||
const ox=j.corner && j.vertical?end*4:0,oy=j.corner && !j.vertical?end*slope*4:0;
|
||||
for(const side of [-1,1])for(const along of [-0.3,0.3]) {
|
||||
const x=j.bx*4+2+ox+dx*(2+along)-dy*side*1.6;
|
||||
const y=j.by*4+2+oy+dy*(2+along)+dx*side*1.6;
|
||||
const p=worldToScreenPx(x,y),c=R.ctx.getImageData(Math.floor(p.x),Math.floor(p.y),1,1).data;
|
||||
if(!(c[0]>c[1]*1.15 && c[1]>c[2]*1.1))bad.push([j,x,y,Array.from(c)]);
|
||||
const now=performance.now.bind(performance),frozen=now();
|
||||
performance.now=()=>frozen;
|
||||
try {
|
||||
const out={};
|
||||
const draw=()=>{SM.scale=1;drawWorld();};
|
||||
for(const look of ["pixel","smooth"]) {
|
||||
SET.look=look;draw();
|
||||
const bad=[];
|
||||
for(const j of T62_JOINTS) {
|
||||
const slope=j.v===4 || j.v===6?-1:1;
|
||||
const end=j.end*SCREW_DIRS[j.v][0];
|
||||
const dx=j.vertical?0:end,dy=j.vertical?end*slope:0;
|
||||
if(j.corner)continue;
|
||||
for(const side of [-1,1])for(const along of [-0.3,0.3]) {
|
||||
const x=j.bx*4+2+dx*(2+along)-dy*side*1.6;
|
||||
const y=j.by*4+2+dy*(2+along)+dx*side*1.6;
|
||||
const p=worldToScreenPx(x,y),c=R.ctx.getImageData(Math.floor(p.x),Math.floor(p.y),1,1).data;
|
||||
if(!(c[0]>c[1]*1.15 && c[1]>c[2]*1.1))bad.push([j,x,y,Array.from(c)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
out[look]=bad;
|
||||
}return out;
|
||||
const sample=(bx,by)=>{
|
||||
const colors=[];
|
||||
for(let y=0;y<4;y++)for(let x=0;x<4;x++) {
|
||||
const p=worldToScreenPx(bx*4+x+0.5,by*4+y+0.5);
|
||||
colors.push(...R.ctx.getImageData(Math.floor(p.x),Math.floor(p.y),1,1).data);
|
||||
}return colors.join(',');
|
||||
};
|
||||
for(const j of T62_JOINTS.filter(j=>j.corner)) {
|
||||
const [dx,dy]=SCREW_DIRS[j.v],sx=j.bx+j.end*dx,sy=j.by+j.end*dy;
|
||||
const collar=sample(j.bx,j.by),straight=sample(sx,sy);
|
||||
const joins=diagonalScrewJoins(j.bx,j.by,j.v),end=j.end*dx>0?1:0;
|
||||
if(!(joins & (64<<end)) || (joins>>(end*3)&7))bad.push(['missing collar',j]);
|
||||
removeBlock(sx,sy);draw();
|
||||
if(sample(j.bx,j.by)!==collar)bad.push(['diagonal differs from isolated end',j]);
|
||||
placeBlock(BP_SCREW,j.straight,sx,sy,true);
|
||||
removeBlock(j.bx,j.by);draw();
|
||||
if(sample(sx,sy)!==straight)bad.push(['straight differs from normal end',j]);
|
||||
placeBlock(BP_SCREW,j.v,j.bx,j.by,true);draw();
|
||||
}
|
||||
out[look]=bad;
|
||||
}return out;
|
||||
} finally {performance.now=now;}
|
||||
}''')
|
||||
for look, bad in mouths.items():
|
||||
check(f"{look}: all 64 screw joints have closed casing across both mouth edges", not bad, bad[:2])
|
||||
check(f"{look}: edge elbows stay closed and corners show two separate free ends", not bad, bad[:2])
|
||||
# a browser without hardware drawing gets the pixel look and a note
|
||||
pg2 = b.new_page(viewport={'width': 800, 'height': 500})
|
||||
pg2.add_init_script('localStorage.clear();')
|
||||
|
||||
Reference in New Issue
Block a user