Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Simplify Path Fixes #106

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
remove logging lines
seveibar committed Jan 9, 2025
commit 7f1a762d7790a85c81b83e19a737f910864777bf
25 changes: 0 additions & 25 deletions algos/infinite-grid-ijump-astar/v2/lib/shortenPathWithShortcuts.ts
Original file line number Diff line number Diff line change
@@ -74,20 +74,13 @@ export function shortenPathWithShortcuts(

if (futureTMax >= currentTMin && futureTMax <= currentTMax) {
// Shortcut type 1
console.log("shortcut type 1")
shortcutPoint = {
x: bothVertical ? otherDim : futureTMax,
y: bothVertical ? pointAfterShortcut.y : otherDim,
layer: currentSegment.end.layer,
}
} else if (futureTMin >= currentTMin && futureTMin <= currentTMax) {
// Shortcut type 2
console.log("shortcut type 2")
console.table([
{ candidate: "1", x: otherDim, y: futureTMax },
{ candidate: "2", x: futureTMin, y: otherDim },
{ candidate: "3", x: otherDim, y: pointAfterShortcut.y },
])
shortcutPoint = {
x: bothVertical ? otherDim : futureTMin,
y: bothVertical ? futureTMax : otherDim,
@@ -97,26 +90,11 @@ export function shortenPathWithShortcuts(
// Shortcut type 3, ignore for now
continue
}
console.log("pointAfterShortcut", pointAfterShortcut)
console.table([
...shortened.map((s, i) => ({
name: i.toString(),
...s,
})),
{ name: "shortcut", ...shortcutPoint },
{ name: "pointAfterShortcut", ...pointAfterShortcut },
])

console.log({
currentSegment,
futureSegment,
})

if (
checkIfObstacleBetweenPoints(currentSegment.end, shortcutPoint) ||
checkIfObstacleBetweenPoints(futureSegment.start, shortcutPoint)
) {
console.log("obstacle in between")
continue
}

@@ -135,8 +113,5 @@ export function shortenPathWithShortcuts(
shortened.push(route[route.length - 1])
}

console.table(route)
console.table(shortened)

return shortened
}