This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Indoor/tests/navMesh/TestNavMeshFactory.cpp
frank 55061ef0da minor changes to floorplan
fixed some compile issues
worked on nav-meshes
added some tests
2018-01-16 12:41:05 +01:00

41 lines
1.1 KiB
C++

#ifdef WITH_TESTS
#include "../Tests.h"
#include "../../navMesh/NavMeshFactory.h"
using namespace NM;
TEST(NavMeshFactory, build1) {
Floorplan::IndoorMap map;
Floorplan::Floor floor; map.floors.push_back(&floor); floor.atHeight = 0; floor.height = 3;
Floorplan::FloorOutlinePolygon outline; floor.outline.push_back(&outline);
outline.poly.points.push_back(Point2(0,0));
outline.poly.points.push_back(Point2(10,0));
outline.poly.points.push_back(Point2(10,10));
outline.poly.points.push_back(Point2(0,10));
outline.outdoor = false;
outline.method = Floorplan::OutlineMethod::ADD;
NavMeshSettings set;
NavMesh<NM::NavMeshTriangle> nm;
NavMeshFactory<NM::NavMeshTriangle> fac(&nm,set);
fac.build(&map);
ASSERT_NEAR(0, nm.getBBox().getMin().x, 0.5);
ASSERT_NEAR(0, nm.getBBox().getMin().y, 0.5);
ASSERT_NEAR(0, nm.getBBox().getMin().z, 0.5);
ASSERT_NEAR(10, nm.getBBox().getMax().x, 0.5);
ASSERT_NEAR(10, nm.getBBox().getMax().y, 0.5);
ASSERT_NEAR( 0, nm.getBBox().getMax().z, 0.5);
ASSERT_EQ(2, nm.getNumTriangles());
// ASSERT_EQ(nm.getNeighbor(0,0), nm[1]);
// ASSERT_EQ(nm.getNeighbor(1,0), nm[0]);
}
#endif