Repository navigation
Replies: 1 comment 1 reply
|
Sounds good 👍 The Since I'm not sure where else it might be useful, I'd suggest merging the parameters into a single entry (to make it easier to provide more data). var neighborPenalty;
if (typeof opt.penalties === 'function') {
var penalties = opt.penalties({ isStart, currentPoint, neighborPoint, direction /* possible more */ });
neighborPenalty = penalties[directionChange];
} else {
// default behavior (for backwards compatibility)
neighborPenalty = isStart ? 0 : opt.penalties[directionChange]; // no penalties for start point
} |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The manhattan router has a penalties option that returns an options with neighbor penalties for each direction.
This option can be an object or a function, however it's always resolved at the start of the routing, presumably for performance reasons.
I would like to change this config option to a function that accepts arguments, and call it every time so that we can improve the suggested routes. Something like this:
What's the benefit:
@kumilingus, thoughts?
All reactions