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:
@@ -5,7 +5,7 @@ for (let p = P_SCREW_UR; p <= P_SCREW_UL; p++) SCREW_CLASS[p] = 19 + p - P_SCREW
|
||||
// Drawing only: the four transport lanes remain in the square block.
|
||||
let diagonalJoins = new Uint8Array(0);
|
||||
function diagonalScrewJoins(bx, by, v, planned = null) {
|
||||
// Three bits per end: 1..4 edge exits, 5/6 corner horizontal/vertical; bits 6/7 are collars.
|
||||
// Three bits per end: 1..4 edge exits; bits 6/7 are collars.
|
||||
const dy = v === 4 || v === 6 ? -1 : 1;
|
||||
let joins = 0;
|
||||
for (let end = 0; end < 2; end++) {
|
||||
@@ -23,7 +23,6 @@ function diagonalScrewJoins(bx, by, v, planned = null) {
|
||||
if ((code === BP_SCREW && nv < 4 && (nv & 1) === (dir & 1)) ||
|
||||
((code === BP_BELT || code === BP_FILTER) && (dir & 1))) { join = dir + 1; break; }
|
||||
}
|
||||
if (!join && nx >= 0 && ny >= 0 && nx < BW && ny < BH && nc === BP_SCREW && nv < 4) join = nv & 1 ? 5 : 6;
|
||||
joins |= join << (end * 3);
|
||||
if (!join) joins |= 64 << end;
|
||||
}
|
||||
@@ -37,15 +36,10 @@ function diagonalScrewShape(x, y, b, v, joins) {
|
||||
for (let end = 0; end < 2; end++) {
|
||||
const join = (joins >> (end * 3)) & 7, side = end ? 1 : -1;
|
||||
const slope = v === 4 || v === 6 ? -1 : 1;
|
||||
const dx = join >= 5 ? (join === 5 ? side : 0) : join ? SCREW_DIRS[join - 1][0] : side * Math.SQRT1_2;
|
||||
const dy = join >= 5 ? (join === 6 ? side * slope : 0) : join ? SCREW_DIRS[join - 1][1] : side * slope * Math.SQRT1_2;
|
||||
const ox = join === 6 ? side * BS : 0, oy = join === 5 ? side * slope * BS : 0;
|
||||
const along = (lx - ox) * dx + (ly - oy) * dy, across = -(lx - ox) * dy + (ly - oy) * dx;
|
||||
let radius = Math.hypot(across, Math.min(0, along));
|
||||
if (join >= 5) {
|
||||
const t = Math.max(0, Math.min(1, (lx * ox + ly * oy) / (BS * BS)));
|
||||
radius = Math.min(radius, Math.hypot(lx - ox * t, ly - oy * t));
|
||||
}
|
||||
const dx = join ? SCREW_DIRS[join - 1][0] : side * Math.SQRT1_2;
|
||||
const dy = join ? SCREW_DIRS[join - 1][1] : side * slope * Math.SQRT1_2;
|
||||
const along = lx * dx + ly * dy, across = -lx * dy + ly * dx;
|
||||
const radius = Math.hypot(across, Math.min(0, along));
|
||||
const cap = along - (join ? 2 : 2 * Math.SQRT2);
|
||||
const sd = Math.max(radius - 2, join || (joins & (64 << end)) ? cap : -10);
|
||||
if (sd < best) {
|
||||
|
||||
@@ -265,12 +265,9 @@ ${SM_SLOPE_DRAW}
|
||||
int join = (joins >> (end * 3)) & 7;
|
||||
float side = end == 0 ? -1.0 : 1.0;
|
||||
vec2 ray = join == 0 ? vec2(side, side * (nc == 19 || nc == 21 ? -1.0 : 1.0)) * 0.70710678 :
|
||||
join == 5 ? vec2(side, 0) : join == 6 ? vec2(0, side * d.y) :
|
||||
join == 1 ? vec2(0, -1) : join == 2 ? vec2(1, 0) : join == 3 ? vec2(0, 1) : vec2(-1, 0);
|
||||
vec2 offset = join == 5 ? vec2(0, side * d.y * 4.0) : join == 6 ? vec2(side * 4.0, 0) : vec2(0);
|
||||
float t = dot(local - offset, ray), cross2 = dot(local - offset, vec2(-ray.y, ray.x));
|
||||
float t = dot(local, ray), cross2 = dot(local, vec2(-ray.y, ray.x));
|
||||
float radius = length(vec2(cross2, min(0.0, t))), cap = t - (join == 0 ? 2.82842712 : 2.0);
|
||||
if (join >= 5) radius = min(radius, length(local - offset * clamp(dot(local, offset) / 16.0, 0.0, 1.0)));
|
||||
// A connected mouth meets another opaque pipe; fading its edge leaves a seam.
|
||||
float sd = max(radius - 2.0, (joins & (64 << end)) != 0 ? cap : -10.0);
|
||||
if (sd < screwSD) {
|
||||
|
||||
Reference in New Issue
Block a user