Modify path visualization
This commit is contained in:
1 parent
542fc191fa
commit
53328484b8
14 files changed
+175
-41
No files matched your search
@@ -58,6 +58,30 @@ int main()
|
||||
const Eigen::Vector3f end(5.f, 0.f, 5.f);
|
||||
const auto path = pathFinder.findPathToNearest(start, end);
|
||||
if (path.size() < 2) return fail("Path query did not produce a route");
|
||||
const auto exactResult = pathFinder.findPathResult(
|
||||
FRG::Vec3fp::fromEigen(start), FRG::Vec3fp::fromEigen(end));
|
||||
if (exactResult.outcome !=
|
||||
FRG::PathFinder::PathOutcome::ReachedExactGoal ||
|
||||
exactResult.waypoints.size() < 2 ||
|
||||
exactResult.endpoint.x != static_cast<FRG::fp>(end.x()) ||
|
||||
exactResult.endpoint.z != static_cast<FRG::fp>(end.z())) {
|
||||
return fail("Reachable destination was not reported as exact");
|
||||
}
|
||||
|
||||
const auto blockedResult = pathFinder.findPathResult(
|
||||
FRG::Vec3fp::fromEigen(start),
|
||||
FRG::Vec3fp::fromEigen(Eigen::Vector3f(0.f, 0.f, 0.f)));
|
||||
if (blockedResult.outcome !=
|
||||
FRG::PathFinder::PathOutcome::NearestReachable ||
|
||||
blockedResult.waypoints.empty() ||
|
||||
!pathFinder.isWalkable(blockedResult.endpoint)) {
|
||||
return fail("Blocked destination did not return a reachable partial path");
|
||||
}
|
||||
if ((blockedResult.endpoint -
|
||||
FRG::Vec3fp::fromEigen(Eigen::Vector3f(0.f, 0.f, 0.f))).normSquared() <=
|
||||
static_cast<FRG::fp>(0.01f * 0.01f)) {
|
||||
return fail("Blocked destination was incorrectly reported as reached");
|
||||
}
|
||||
if (!pathFinder.isWalkable(Eigen::Vector3f(0.f, 0.f, 5.f)))
|
||||
return fail("Walkability query failed");
|
||||
if (path.back().y() != 2.5f)
|
||||
|
||||
Reference in new issue
Block a user