feat: searoute - change pathfinding algo

This commit is contained in:
Azgaar 2024-04-27 13:33:33 +02:00
parent dfd80f2c81
commit 22edfb0dec
3 changed files with 64 additions and 281 deletions

View file

@ -1653,11 +1653,11 @@ function drawRoutes() {
};
for (const {i, group, cells} of pack.routes) {
if (group !== "searoutes") straightenPathAngles(cells); // mutates points
// if (group !== "searoutes") straightenPathAngles(cells); // mutates points
const pathPoints = getPathPoints(cells);
// TODO: temporary view for searoutes
if (group === "searoutes2") {
if (group) {
const pathPoints = cells.map(cellId => points[cellId]);
const color = getMixedColor("#000000", 0.6);
const line = "M" + pathPoints.join("L");
@ -1667,9 +1667,9 @@ function drawRoutes() {
if (!routePaths[group]) routePaths[group] = [];
routePaths[group].push(`<path id="route${i}" d="${line}" stroke=${color} />`);
lineGen.curve(curves[group] || curves.default);
const path = round(lineGen(pathPoints), 1);
routePaths[group].push(`<path id="route${i}" d="${path}" stroke-width="0.15"/> `);
// lineGen.curve(curves[group] || curves.default);
// const path = round(lineGen(pathPoints), 1);
// routePaths[group].push(`<path id="route${i}" d="${path}" stroke-width="0.15"/> `);
continue;
}
@ -1685,6 +1685,8 @@ function drawRoutes() {
routes.select("#" + group).html(routePaths[group].join(""));
}
drawCellsValue(pack.cells.i);
TIME && console.timeEnd("drawRoutes");
function adjustBurgPoints() {