streamline aisle filtering logic in PolygonGenerator and enhance navigation error handling
This commit is contained in:
parent
40a32d1497
commit
566fd87526
|
@ -56,7 +56,7 @@ export default function NavMeshDetails({
|
||||||
// scene.add(debugDrawer);
|
// scene.add(debugDrawer);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
echo.error("Failed to initialize navigation")
|
echo.error("Failed to initialize navigation")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
initializeNavigation();
|
initializeNavigation();
|
||||||
|
|
|
@ -19,25 +19,24 @@ export default function PolygonGenerator({
|
||||||
let allLines = arrayLinesToObject(lines.current);
|
let allLines = arrayLinesToObject(lines.current);
|
||||||
const wallLines = allLines?.filter((line) => line?.type === "WallLine");
|
const wallLines = allLines?.filter((line) => line?.type === "WallLine");
|
||||||
const aisleLines = allLines?.filter((line) => line?.type === "AisleLine")
|
const aisleLines = allLines?.filter((line) => line?.type === "AisleLine")
|
||||||
// const aisleLines = allLines?.filter((line) => line?.type === "AisleLine")
|
const result = aisles
|
||||||
console.log('aisles: ', aisles.map((aisle) => aisle.points.map((point) => point.position)));
|
.filter(
|
||||||
const result = aisles.map((aisle) =>
|
(aisle) =>
|
||||||
aisle.points.map((point) => ({
|
aisle.type.aisleType === "dotted-aisle" ||
|
||||||
position: [point.position[0], point.position[2]],
|
aisle.type.aisleType === "solid-aisle" ||
|
||||||
uuid: point.pointUuid,
|
aisle.type.aisleType === "dashed-aisle" ||
|
||||||
}))
|
aisle.type.aisleType === "arc-aisle"
|
||||||
);
|
)
|
||||||
|
.map((aisle) =>
|
||||||
|
aisle.points.map((point) => ({
|
||||||
|
position: [point.position[0], point.position[2]],
|
||||||
|
uuid: point.pointUuid,
|
||||||
|
}))
|
||||||
|
);
|
||||||
const wallPoints = wallLines
|
const wallPoints = wallLines
|
||||||
.map((pair) => pair?.line.map((vals) => vals.position))
|
.map((pair) => pair?.line.map((vals) => vals.position))
|
||||||
.filter((wall): wall is THREE.Vector3[] => !!wall);
|
.filter((wall): wall is THREE.Vector3[] => !!wall);
|
||||||
|
|
||||||
// const result = aisleLines.map((pair) =>
|
|
||||||
// pair?.line.map((point) => ({
|
|
||||||
// position: [point.position.x, point.position.z],
|
|
||||||
// uuid: point.uuid,
|
|
||||||
// }))
|
|
||||||
// );
|
|
||||||
|
|
||||||
|
|
||||||
if (!result || result.some((line) => !line)) {
|
if (!result || result.some((line) => !line)) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue