feat: stroke class, residue per artwork, mixed strokes, sheets split by class
All checks were successful
Build and deploy / Validate source (push) Successful in 1m25s
Build and deploy / Integration suite on a real stack (push) Successful in 4m40s
Build and deploy / Secret scan and release gate (push) Successful in 12s
Build and deploy / Publish images (push) Successful in 1m38s
All checks were successful
Build and deploy / Validate source (push) Successful in 1m25s
Build and deploy / Integration suite on a real stack (push) Successful in 4m40s
Build and deploy / Secret scan and release gate (push) Successful in 12s
Build and deploy / Publish images (push) Successful in 1m38s
Round 3, items 9, 4, 16 and 17 (Dropstar, 2026-10-30).
- 9: the Site measures the thinnest stroke of each sheet and loose artwork
(alpha > 40, chamfer distance in strips, width at local maxima, 1st
percentile, at 300 DPI) and sends stroke_px and C1/C2/C3 with the item.
The Kanban shows the class prefilled in the approve step; Produção may
change it (POST /orders/{id}/contraction, who and when recorded), and the
manifest carries it.
- 4: the residue check runs on each loose artwork, accepted per artwork; the
sheet inherits what was accepted.
- 16: fine lines and solid areas in one file. Loose art: a pop-up with
[Subir separado] [Continuar assim]. Ready sheet: protect the fine lines
(default), protect the solid areas (stroke_choice client_c3, starts at C3)
or go back and send two sheets, which holds the order.
- 17: loose art of fine (C1, C2) and solid (C3) strokes goes on separate
sheets, each its own order item (split group/part/of) with its own file
and class. Each sheet rounds to 10 cm and the 1 m minimum is charged once
per group, since the customer did not choose the split. Cart, payment
summary, portal, receipt and mail show it as such.
- The board loads quote views in two queries instead of two per quote.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -60,10 +60,101 @@ function novoMapa(wPx,hPx,larguraCm){
|
||||
const colDe=new Uint32Array(wPx);
|
||||
for(let x=0;x<wPx;x++) colDe[x]=Math.min(cw-1,Math.floor(x/pxCel));
|
||||
return {wPx,hPx,larguraCm,pxPorCm,passo,pxCel,cw,ch,colDe,bits:new Uint8Array(n),
|
||||
x0:new Uint32Array(n),x1:new Uint32Array(n),y0:new Uint32Array(n),y1:new Uint32Array(n),tinta:0};
|
||||
x0:new Uint32Array(n),x1:new Uint32Array(n),y0:new Uint32Array(n),y1:new Uint32Array(n),tinta:0,
|
||||
traco:novoTraco(wPx,wPx/(larguraCm/2.54))};
|
||||
}
|
||||
// ── Traço mais fino (Dropstar, 30/10/2026): a contração do Flexi vem dele.
|
||||
// Tinta é alfa acima de 40; a distância de cada pixel de tinta ao fundo sai de
|
||||
// um chanfro 10/14, e no eixo do traço a largura é o dobro da distância (menos
|
||||
// um quando a largura é ímpar). O mais fino da folha é o 1º percentil dessas
|
||||
// larguras, em pixels a 300 DPI: até 4 é C1, de 5 a 19 é C2, 20 ou mais é C3.
|
||||
// A folha passa em faixas, linha a linha: cada faixa guarda 20 linhas antes e
|
||||
// depois, o alcance da distância, e nada maior que uma faixa fica na memória.
|
||||
const ALFA_TRACO=40, TRACO_D=20, TRACO_FAIXA=256;
|
||||
function novoTraco(wPx,dpi){
|
||||
const linhas=TRACO_FAIXA+2*TRACO_D;
|
||||
return {w:wPx,dpi,linhas,tinta:new Uint8Array(wPx*linhas),dist:new Uint16Array(wPx*linhas),
|
||||
n:0,inicio:0,hist:new Float64Array(2*TRACO_D+2),total:0,tintaPx:0,largosPx:0};
|
||||
}
|
||||
function tracoLinha(t,alfa,inicio,de){
|
||||
const o=t.n*t.w, ink=t.tinta;
|
||||
for(let x=0,i=inicio;x<t.w;x++,i+=de) ink[o+x]=alfa[i]>ALFA_TRACO?1:0;
|
||||
t.n++;
|
||||
if(t.n===t.linhas) tracoFaixa(t,false);
|
||||
}
|
||||
// A distância na faixa, e as larguras das linhas que ela já mede inteiras.
|
||||
function tracoFaixa(t,fim){
|
||||
const {w,n,tinta,dist}=t, CAP=TRACO_D*10+10, topo=t.inicio===0;
|
||||
if(!n) return;
|
||||
for(let p=0;p<w*n;p++) dist[p]=tinta[p]?CAP:0;
|
||||
// ida: de cima para baixo; fora da folha é fundo
|
||||
for(let y=0;y<n;y++){ const o=y*w, a=o-w;
|
||||
for(let x=0;x<w;x++){ const p=o+x; if(!dist[p]) continue;
|
||||
let d=dist[p];
|
||||
const l=x>0?dist[p-1]:0; if(l+10<d) d=l+10;
|
||||
if(y>0){ const u=dist[a+x]; if(u+10<d) d=u+10;
|
||||
const ul=x>0?dist[a+x-1]:0; if(ul+14<d) d=ul+14;
|
||||
const ur=x<w-1?dist[a+x+1]:0; if(ur+14<d) d=ur+14; }
|
||||
else if(topo) d=10;
|
||||
dist[p]=d; } }
|
||||
// volta: de baixo para cima
|
||||
for(let y=n-1;y>=0;y--){ const o=y*w, b=o+w;
|
||||
for(let x=w-1;x>=0;x--){ const p=o+x; if(!dist[p]) continue;
|
||||
let d=dist[p];
|
||||
const r=x<w-1?dist[p+1]:0; if(r+10<d) d=r+10;
|
||||
if(y<n-1){ const dn=dist[b+x]; if(dn+10<d) d=dn+10;
|
||||
const dl=x>0?dist[b+x-1]:0; if(dl+14<d) d=dl+14;
|
||||
const dr=x<w-1?dist[b+x+1]:0; if(dr+14<d) d=dr+14; }
|
||||
else if(fim) d=Math.min(d,10);
|
||||
dist[p]=d; } }
|
||||
// As linhas medidas por inteiro: longe das bordas da faixa, salvo as da folha.
|
||||
const de=topo?0:TRACO_D, ate=fim?n:n-TRACO_D;
|
||||
const escala=300/t.dpi, hist=t.hist, max=hist.length-1;
|
||||
const at=(x,y)=>(x<0||x>=w||y<0||y>=n)?0:dist[y*w+x];
|
||||
// Item 16: tinta em áreas de 20 px ou mais (a 300 DPI) é a que fica a 10 px
|
||||
// ou mais do fundo; a conta é da tinta das linhas medidas.
|
||||
const largo=100/escala;
|
||||
for(let y=de;y<ate;y++){ const o=y*w; for(let x=0;x<w;x++){ const d=dist[o+x]; if(!d) continue; t.tintaPx++; if(d>=largo) t.largosPx++; } }
|
||||
for(let y=de;y<ate;y++) for(let x=0;x<w;x++){
|
||||
const d=dist[y*w+x]; if(!d||d>=CAP) continue;
|
||||
// No eixo do traço a distância não é menor que a de nenhum vizinho; perto
|
||||
// de um canto sempre há um vizinho mais fundo, e o canto não conta.
|
||||
let iguais=0, eixo=true;
|
||||
for(let dy=-1;dy<=1&&eixo;dy++) for(let dx=-1;dx<=1;dx++){
|
||||
if(!dx&&!dy) continue;
|
||||
const v=at(x+dx,y+dy);
|
||||
if(v>d){ eixo=false; break; }
|
||||
if(v===d) iguais++;
|
||||
}
|
||||
if(!eixo) continue;
|
||||
// Largura par: o eixo tem dois pixels, e os iguais passam de dois.
|
||||
const larg=iguais>=4?2*d/10:2*d/10-1;
|
||||
const i=Math.max(1,Math.min(max,Math.round(larg*escala)));
|
||||
hist[i]++;t.total++;
|
||||
}
|
||||
// As últimas linhas ficam como contexto da próxima faixa.
|
||||
if(!fim){
|
||||
const fica=2*TRACO_D;
|
||||
tinta.copyWithin(0,(n-fica)*w,n*w);
|
||||
t.inicio+=n-fica; t.n=fica;
|
||||
}
|
||||
}
|
||||
// O 1º percentil das larguras, em pixels a 300 DPI, e a classe de contração.
|
||||
// Uma vez só: depois a faixa não existe mais, e a resposta fica guardada,
|
||||
// também quando é null (uma folha sem tinta).
|
||||
function tracoFim(t){
|
||||
if(t.lido!==undefined) return t.lido;
|
||||
tracoFaixa(t,true);
|
||||
t.tinta=t.dist=null; // a faixa não serve mais
|
||||
if(!t.total) return t.lido=null;
|
||||
let soma=0, px=1;
|
||||
for(let i=1;i<t.hist.length;i++){ soma+=t.hist[i]; if(soma>=t.total*0.01){ px=i; break; } }
|
||||
// largos: a parte da tinta em áreas chapadas, de 20 px ou mais (item 16)
|
||||
return t.lido={px, classe:px<=4?'C1':px<=19?'C2':'C3', largos:t.tintaPx?t.largosPx/t.tintaPx:0};
|
||||
}
|
||||
// A linha y da folha: o alfa de cada pixel em alfa[inicio + x*de].
|
||||
function mapaLinha(m,y,alfa,inicio,de){
|
||||
if(m.traco) tracoLinha(m.traco,alfa,inicio,de);
|
||||
const base=Math.min(m.ch-1,Math.floor(y/m.pxCel))*m.cw;
|
||||
const {bits,x0,x1,y0,y1,colDe}=m;
|
||||
let tinta=0;
|
||||
@@ -144,7 +235,8 @@ function analisarMapa(m){
|
||||
fundoChapado: (total-m.tinta)/total < 0.015,
|
||||
aproveitamento: Math.max(1,Math.min(100,Math.round(m.tinta/total*100))),
|
||||
alturaCm: m.hPx/m.pxPorCm,
|
||||
grade: +(m.passo*10).toFixed(1) // mm por célula que agrupa
|
||||
grade: +(m.passo*10).toFixed(1), // mm por célula que agrupa
|
||||
traco: m.traco ? tracoFim(m.traco) : null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user