add option for pythagorean metric

This commit is contained in:
Leijurv 2018-08-23 08:52:05 -07:00
parent 2d7b465844
commit 5baa56bb29
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 8 additions and 0 deletions

View File

@ -107,6 +107,11 @@ public class Settings {
*/
public Setting<Boolean> minimumImprovementRepropagation = new Setting<>(true);
/**
* Use a pythagorean metric (as opposed to the more accurate hybrid diagonal / traverse).
*/
public Setting<Boolean> pythagoreanMetric = new Setting<>(false);
/**
* After calculating a path (potentially through cached chunks), artificially cut it off to just the part that is
* entirely within currently loaded chunks. Improves path safety because cached chunks are heavily simplified.

View File

@ -64,6 +64,9 @@ public class GoalXZ implements Goal {
}
public static double calculate(double xDiff, double zDiff) {
if (Baritone.settings().pythagoreanMetric.get()) {
return Math.sqrt(xDiff * xDiff + zDiff * zDiff) * Baritone.settings().costHeuristic.get();
}
//This is a combination of pythagorean and manhattan distance
//It takes into account the fact that pathing can either walk diagonally or forwards