Try add wals and split

This commit is contained in:
Халимов Рустам
2026-01-10 22:51:47 +03:00
parent 9249b424fe
commit 81d9e8e920
3 changed files with 188 additions and 114 deletions

View File

@@ -99,28 +99,40 @@ export const createBinGeometry = (
geometries.push(wallGeo);
partitions.forEach(p => {
let pWidth = 0, pDepth = 0, pX = 0, pY = 0;
// Поддержка T-junctions: учитываем min и max
const pMin = p.min ?? 0;
const pMax = p.max ?? 1;
const lengthRatio = pMax - pMin;
const midRatio = pMin + (lengthRatio / 2);
let pWidth = 0, pDepth = 0, pX = 0, pY = 0;
if (p.axis === 'x') {
// Вертикальная стенка
// Вертикальная перегородка
pWidth = thickness;
pDepth = lengthRatio * innerDepth;
// Длина зависит от max-min
const length = (pMax - pMin) * innerDepth;
pDepth = length;
pX = (-innerWidth / 2) + (innerWidth * p.offset);
// Центр по Z (Y в 2D) зависит от min/max
// innerTop = -innerDepth/2. Позиция = innerTop + (innerDepth * midRatio)
pY = (-innerDepth / 2) + (innerDepth * midRatio);
// Центр перегородки по Y (Z в 3D) смещен
// Полный диапазон от -innerDepth/2 до +innerDepth/2
// Начало: -innerDepth/2 + (innerDepth * pMin)
// Конец: -innerDepth/2 + (innerDepth * pMax)
// Центр: (Начало + Конец) / 2
const startY = (-innerDepth / 2) + (innerDepth * pMin);
const endY = (-innerDepth / 2) + (innerDepth * pMax);
pY = (startY + endY) / 2;
} else {
// Горизонтальная стенка
pWidth = lengthRatio * innerWidth;
// Горизонтальная перегородка
const length = (pMax - pMin) * innerWidth;
pWidth = length;
pDepth = thickness;
pX = (-innerWidth / 2) + (innerWidth * midRatio);
const startX = (-innerWidth / 2) + (innerWidth * pMin);
const endX = (-innerWidth / 2) + (innerWidth * pMax);
pX = (startX + endX) / 2;
pY = (-innerDepth / 2) + (innerDepth * p.offset);
}