worked on 2D/3D raytracing
adjusted BVH improved 2D/3D BVH new bounding volumes new test cases renamed some test-cases for grouping reasons made GPC header-only using slight adjustments
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "../../geo/Angle.h"
|
||||
|
||||
TEST(Angle, dir) {
|
||||
TEST(Geo_Angle, dir) {
|
||||
|
||||
// angle -> pointer -> angle
|
||||
ASSERT_NEAR(0, Angle::getRAD_2PI(Angle::getPointer(0)), 0.0001);
|
||||
@@ -14,7 +14,7 @@ TEST(Angle, dir) {
|
||||
|
||||
}
|
||||
|
||||
TEST(Angle, safe) {
|
||||
TEST(Geo_Angle, safe) {
|
||||
|
||||
ASSERT_EQ(0, (int)std::round(Angle::radToDeg(Angle::makeSafe_2PI(Angle::degToRad(0)))));
|
||||
ASSERT_EQ(0, (int)std::round(Angle::radToDeg(Angle::makeSafe_2PI(Angle::degToRad(360)))));
|
||||
@@ -35,7 +35,7 @@ TEST(Angle, safe) {
|
||||
|
||||
}
|
||||
|
||||
TEST(Angle, calc) {
|
||||
TEST(Geo_Angle, calc) {
|
||||
|
||||
ASSERT_EQ(0, (int)Angle::getDEG_360(0,0, +1,0)); // to the right
|
||||
ASSERT_EQ(90, (int)Angle::getDEG_360(0,0, 0,+1)); // upwards
|
||||
@@ -49,7 +49,7 @@ TEST(Angle, calc) {
|
||||
|
||||
}
|
||||
|
||||
TEST(Angle, signedDiff) {
|
||||
TEST(Geo_Angle, signedDiff) {
|
||||
|
||||
const float d = 0.00001f;
|
||||
ASSERT_NEAR(+M_PI/2, Angle::getSignedDiffRAD_2PI(0, M_PI/2), d); // CCW
|
||||
@@ -62,7 +62,7 @@ TEST(Angle, signedDiff) {
|
||||
|
||||
}
|
||||
|
||||
TEST(Angle, diff) {
|
||||
TEST(Geo_Angle, diff) {
|
||||
|
||||
const float r = Angle::getRAD_2PI(0,0, +1,0); // to the right
|
||||
const float u = Angle::getRAD_2PI(0,0, 0,+1); // upwards
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "../../geo/BBox2.h"
|
||||
|
||||
TEST(BBox, noIntersect) {
|
||||
TEST(Geo_BBox2, noIntersect) {
|
||||
|
||||
BBox2 bb(Point2(1,1), Point2(3,3));
|
||||
|
||||
@@ -21,7 +21,8 @@ TEST(BBox, noIntersect) {
|
||||
|
||||
}
|
||||
|
||||
TEST(BBox, noDirectIntersect) {
|
||||
/*
|
||||
TEST(Geo_BBox2, noDirectIntersect) {
|
||||
|
||||
BBox2 bb(Point2(1,1), Point2(3,3));
|
||||
|
||||
@@ -37,9 +38,10 @@ TEST(BBox, noDirectIntersect) {
|
||||
ASSERT_FALSE(bb.intersects(l4));
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
TEST(BBox, positiveIntersect) {
|
||||
TEST(Geo_BBox2, positiveIntersect) {
|
||||
|
||||
BBox2 bb(Point2(1,1), Point2(3,3));
|
||||
|
||||
18
tests/geo/TestBBox3.cpp
Normal file
18
tests/geo/TestBBox3.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
#include "../Tests.h"
|
||||
|
||||
#include "../../geo/BBox3.h"
|
||||
|
||||
TEST(Geo_BBox3, noIntersect) {
|
||||
|
||||
BBox3 bb1(Point3(0,0,0), Point3(1,1,1));
|
||||
BBox3 bb2(Point3(1,1,1), Point3(2,3,4));
|
||||
|
||||
BBox3 joined = BBox3::join(bb1, bb2);
|
||||
ASSERT_EQ(Point3(2,3,4), joined.getMax());
|
||||
ASSERT_EQ(Point3(0,0,0), joined.getMin());
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
176
tests/geo/TestBVH2.cpp
Normal file
176
tests/geo/TestBVH2.cpp
Normal file
@@ -0,0 +1,176 @@
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
#include "../Tests.h"
|
||||
|
||||
#include "../../geo/volume/BVH.h"
|
||||
#include "../../geo/volume/BVHDebug.h"
|
||||
|
||||
#include "../../geo/BBox2.h"
|
||||
#include "../../geo/Line2.h"
|
||||
|
||||
#include "../../floorplan/v2/Floorplan.h"
|
||||
#include "../../floorplan/v2/FloorplanReader.h"
|
||||
#include "../../wifi/estimate/ray3/ModelFactory.h"
|
||||
|
||||
struct WrapperBBox2 {
|
||||
|
||||
static std::vector<Point2> getVertices(const BBox2& bbox) {
|
||||
return {bbox.getMin(), bbox.getMax()};
|
||||
}
|
||||
|
||||
static std::vector<Point2> getDebugLines(const BBox2& bbox) {
|
||||
|
||||
Point2 p1(bbox.getMin().x, bbox.getMin().y);
|
||||
Point2 p2(bbox.getMax().x, bbox.getMin().y);
|
||||
Point2 p3(bbox.getMax().x, bbox.getMax().y);
|
||||
Point2 p4(bbox.getMin().x, bbox.getMax().y);
|
||||
|
||||
std::vector<Point2> res;
|
||||
res.push_back(p1); res.push_back(p2);
|
||||
res.push_back(p2); res.push_back(p3);
|
||||
res.push_back(p3); res.push_back(p4);
|
||||
res.push_back(p4); res.push_back(p1);
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct WrapperLine2 {
|
||||
|
||||
static std::vector<Point2> getVertices(const Line2& l) {
|
||||
return {l.p1, l.p2};
|
||||
}
|
||||
|
||||
static std::vector<Point2> getDebugLines(const Line2& l) {
|
||||
return {l.p1, l.p2};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
TEST(Geo_BVH2, tree) {
|
||||
|
||||
BVH3Debug<BBox3, BoundingVolumeSphere3, Wrapper> tree;
|
||||
|
||||
BBox3 bb1(Point3(0,0,0), Point3(1,1,1));
|
||||
tree.add(bb1);
|
||||
|
||||
BBox3 bb2(Point3(-1,-1,-1), Point3(0,0,0));
|
||||
tree.add(bb2);
|
||||
|
||||
tree.optimize();
|
||||
tree.show();
|
||||
|
||||
int i = 0; (void) i;
|
||||
|
||||
}
|
||||
|
||||
TEST(Geo_BVH2, tree2) {
|
||||
|
||||
BVH3Debug<BBox3, BoundingVolumeSphere3, Wrapper> tree;
|
||||
|
||||
BBox3 bb1(Point3(0,0,0), Point3(1,1,1));
|
||||
tree.add(bb1);
|
||||
|
||||
BBox3 bb2(Point3(-1,0,0), Point3(0,1,1));
|
||||
tree.add(bb2);
|
||||
|
||||
tree.optimize();
|
||||
tree.show();
|
||||
|
||||
int i = 0; (void) i;
|
||||
|
||||
}
|
||||
|
||||
TEST(Geo_BVH2, tree3) {
|
||||
|
||||
BVH3Debug<BBox3, BoundingVolumeSphere3, Wrapper> tree;
|
||||
|
||||
BBox3 bb1 = BBox3::around(Point3(+0.5, +0.5, 0.0), Point3(0.25, 0.25, 0.25));
|
||||
tree.add(bb1);
|
||||
|
||||
BBox3 bb2 = BBox3::around(Point3(-0.5, +0.5, 0.0), Point3(0.25, 0.25, 0.25));
|
||||
tree.add(bb2);
|
||||
|
||||
BBox3 bb3 = BBox3::around(Point3(-0.0, +0.5, 0.0), Point3(0.36, 0.36, 0.36));
|
||||
tree.add(bb3);
|
||||
|
||||
BBox3 bb4 = BBox3::around(Point3(-0.0, +0.0, 0.0), Point3(0.5, 0.5, 0.5));
|
||||
tree.add(bb4);
|
||||
|
||||
tree.optimize(1);
|
||||
tree.show();
|
||||
|
||||
tree.optimize(1);
|
||||
tree.show();
|
||||
|
||||
tree.optimize(1);
|
||||
tree.show();
|
||||
|
||||
int i = 0; (void) i;
|
||||
|
||||
}
|
||||
|
||||
TEST(Geo_BVH2, treeMap) {
|
||||
|
||||
std::string file = "/apps/SHL39.xml";
|
||||
Floorplan::IndoorMap* map = Floorplan::Reader::readFromFile(file);
|
||||
|
||||
ModelFactory fac(map);
|
||||
fac.setExportCeilings(false);
|
||||
fac.setFloors({map->floors[3]});
|
||||
std::vector<Obstacle3D> obs = fac.triangulize();
|
||||
|
||||
BVH3Debug<Obstacle3D, BoundingVolumeSphere3, WrapperObs3D> tree;
|
||||
|
||||
for (const Obstacle3D& o : obs) {
|
||||
tree.add(o);
|
||||
}
|
||||
|
||||
//tree.show(150);
|
||||
|
||||
//int rounds = tree.optimize();
|
||||
|
||||
for (int i = 0; i < 200; ++i) {
|
||||
tree.optimize(1);
|
||||
//if (i%3==0) {
|
||||
tree.show(250, false);
|
||||
//}
|
||||
}
|
||||
|
||||
int i = 0; (void) i;
|
||||
|
||||
}
|
||||
*/
|
||||
TEST(Geo_BVH2, treeRandom) {
|
||||
|
||||
//BVH2Debug<Line2, BoundingVolumeCircle2, WrapperLine2> tree;
|
||||
BVH2Debug<Line2, BoundingVolumeAABB2, WrapperLine2> tree;
|
||||
|
||||
std::minstd_rand gen;
|
||||
std::uniform_real_distribution<float> dPos(-4.0, +4.0);
|
||||
std::uniform_real_distribution<float> dDir(+0.1, +0.5);
|
||||
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
const Point2 pos(dPos(gen), dPos(gen));
|
||||
const Point2 dir(dDir(gen), dDir(gen));
|
||||
const Line2 line(pos, pos+dir);
|
||||
tree.add(line);
|
||||
}
|
||||
|
||||
tree.show();
|
||||
|
||||
if (1 == 0) {
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
tree.optimize(1);
|
||||
tree.show();
|
||||
usleep(1000*100);
|
||||
}
|
||||
}
|
||||
int i = 0; (void) i;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -77,7 +77,7 @@ struct WrapperObs3D {
|
||||
|
||||
TEST(BVH, tree) {
|
||||
|
||||
BVHDebug<BBox3, BoundingVolumeSphere, Wrapper> tree;
|
||||
BVH3Debug<BBox3, BoundingVolumeSphere3, Wrapper> tree;
|
||||
|
||||
BBox3 bb1(Point3(0,0,0), Point3(1,1,1));
|
||||
tree.add(bb1);
|
||||
@@ -94,7 +94,7 @@ TEST(BVH, tree) {
|
||||
|
||||
TEST(BVH, tree2) {
|
||||
|
||||
BVHDebug<BBox3, BoundingVolumeSphere, Wrapper> tree;
|
||||
BVH3Debug<BBox3, BoundingVolumeSphere3, Wrapper> tree;
|
||||
|
||||
BBox3 bb1(Point3(0,0,0), Point3(1,1,1));
|
||||
tree.add(bb1);
|
||||
@@ -111,7 +111,7 @@ TEST(BVH, tree2) {
|
||||
|
||||
TEST(BVH, tree3) {
|
||||
|
||||
BVHDebug<BBox3, BoundingVolumeSphere, Wrapper> tree;
|
||||
BVH3Debug<BBox3, BoundingVolumeSphere3, Wrapper> tree;
|
||||
|
||||
BBox3 bb1 = BBox3::around(Point3(+0.5, +0.5, 0.0), Point3(0.25, 0.25, 0.25));
|
||||
tree.add(bb1);
|
||||
@@ -148,7 +148,7 @@ TEST(BVH, treeMap) {
|
||||
fac.setFloors({map->floors[3]});
|
||||
std::vector<Obstacle3D> obs = fac.triangulize();
|
||||
|
||||
BVHDebug<Obstacle3D, BoundingVolumeSphere, WrapperObs3D> tree;
|
||||
BVH3Debug<Obstacle3D, BoundingVolumeSphere3, WrapperObs3D> tree;
|
||||
|
||||
for (const Obstacle3D& o : obs) {
|
||||
tree.add(o);
|
||||
@@ -171,7 +171,7 @@ TEST(BVH, treeMap) {
|
||||
|
||||
TEST(BVH, treeRandom) {
|
||||
|
||||
BVHDebug<BBox3, BoundingVolumeSphere, Wrapper> tree;
|
||||
BVH3Debug<BBox3, BoundingVolumeSphere3, Wrapper> tree;
|
||||
|
||||
std::minstd_rand gen;
|
||||
std::uniform_real_distribution<float> dPos(-4.0, +4.0);
|
||||
85
tests/geo/TestCircle2.cpp
Normal file
85
tests/geo/TestCircle2.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
#include "../Tests.h"
|
||||
|
||||
#include "../../geo/Circle2.h"
|
||||
|
||||
TEST(Geo_Circle2, intersect) {
|
||||
|
||||
Circle2 c1(Point2(3,2), 1.0);
|
||||
|
||||
// left of circle
|
||||
Ray2 r1(Point2(1,0), Point2(0,1));
|
||||
ASSERT_FALSE(c1.intersects(r1));
|
||||
|
||||
// right of circle
|
||||
Ray2 r2(Point2(5,0), Point2(0,1));
|
||||
ASSERT_FALSE(c1.intersects(r2));
|
||||
|
||||
|
||||
// through circle (from bottom)
|
||||
Ray2 r3(Point2(3,0), Point2(0,1));
|
||||
ASSERT_TRUE(c1.intersects(r3));
|
||||
// through circle (from bottom)
|
||||
Ray2 r4(Point2(3.5,0), Point2(0,1));
|
||||
ASSERT_TRUE(c1.intersects(r4));
|
||||
|
||||
// within circle
|
||||
Ray2 r5(Point2(3,2), Point2(0,1));
|
||||
ASSERT_TRUE(c1.intersects(r5));
|
||||
|
||||
|
||||
// through circle (from left)
|
||||
Ray2 r6(Point2(0,2), Point2(1,0));
|
||||
ASSERT_TRUE(c1.intersects(r6));
|
||||
// through circle (from right)
|
||||
Ray2 r7(Point2(10,2), Point2(-1,0));
|
||||
ASSERT_TRUE(c1.intersects(r7));
|
||||
// through circle (from top)
|
||||
Ray2 r8(Point2(3,10), Point2(0,-1));
|
||||
ASSERT_TRUE(c1.intersects(r8));
|
||||
|
||||
|
||||
}
|
||||
|
||||
TEST(Geo_Circle2, contains) {
|
||||
|
||||
Circle2 c(Point2(0,0), 1.01);
|
||||
|
||||
ASSERT_TRUE(c.contains(Point2(+1,0)));
|
||||
ASSERT_TRUE(c.contains(Point2(-1,0)));
|
||||
|
||||
ASSERT_TRUE(c.contains(Point2(0,+1)));
|
||||
ASSERT_TRUE(c.contains(Point2(0,-1)));
|
||||
|
||||
ASSERT_FALSE(c.contains(Point2(+1,+1)));
|
||||
ASSERT_FALSE(c.contains(Point2(-1,-1)));
|
||||
|
||||
}
|
||||
|
||||
TEST(Geo_Circle2, join) {
|
||||
|
||||
// no overlap
|
||||
Circle2 a1(Point2(-1,0), 0.5);
|
||||
Circle2 a2(Point2(+1,0), 0.5);
|
||||
Circle2 a3 = Circle2::join(a1,a2);
|
||||
ASSERT_EQ(Point2(0,0), a3.center);
|
||||
ASSERT_NEAR(1.5, a3.radius, 0.01);
|
||||
|
||||
// overlap
|
||||
Circle2 b1(Point2(0,+1), 1.5);
|
||||
Circle2 b2(Point2(0,-1), 1.5);
|
||||
Circle2 b3 = Circle2::join(b1,b2);
|
||||
ASSERT_EQ(Point2(0,0), b3.center);
|
||||
ASSERT_NEAR(2.5, b3.radius, 0.01);
|
||||
|
||||
// within
|
||||
Circle2 c1(Point2(0,+1), 3.0);
|
||||
Circle2 c2(Point2(0,-1), 1.0);
|
||||
Circle2 c3 = Circle2::join(c1,c2);
|
||||
ASSERT_EQ(c1.center, c3.center);
|
||||
ASSERT_NEAR(c1.radius, c3.radius, 0.01);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "../Tests.h"
|
||||
#include "../../geo/Heading.h"
|
||||
|
||||
TEST(Heading, diff) {
|
||||
TEST(Geo_Heading, diff) {
|
||||
|
||||
// 180 degree turn
|
||||
{
|
||||
@@ -26,7 +26,7 @@ TEST(Heading, diff) {
|
||||
|
||||
}
|
||||
|
||||
TEST(Heading, mod) {
|
||||
TEST(Geo_Heading, mod) {
|
||||
|
||||
const float d = 0.0001;
|
||||
|
||||
@@ -36,7 +36,7 @@ TEST(Heading, mod) {
|
||||
|
||||
}
|
||||
|
||||
TEST(Heading, ctor) {
|
||||
TEST(Geo_Heading, ctor) {
|
||||
|
||||
// OK
|
||||
Heading(0);
|
||||
@@ -54,7 +54,7 @@ TEST(Heading, ctor) {
|
||||
|
||||
}
|
||||
|
||||
TEST(Heading, eq) {
|
||||
TEST(Geo_Heading, eq) {
|
||||
|
||||
ASSERT_EQ(Heading(0), Heading(0));
|
||||
ASSERT_EQ(Heading(1), Heading(1));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "../Tests.h"
|
||||
#include "../../geo/Length.h"
|
||||
|
||||
TEST(Length, float) {
|
||||
TEST(Geo_Length, float) {
|
||||
|
||||
static constexpr float delta = 0.00001;
|
||||
|
||||
@@ -24,7 +24,7 @@ TEST(Length, float) {
|
||||
|
||||
}
|
||||
|
||||
TEST(Length, int) {
|
||||
TEST(Geo_Length, int) {
|
||||
|
||||
LengthI l1 = LengthI::m(1.0);
|
||||
ASSERT_EQ(1, l1.m());
|
||||
|
||||
23
tests/geo/TestPoint2.cpp
Normal file
23
tests/geo/TestPoint2.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
#include "../Tests.h"
|
||||
#include "../../geo/Point2.h"
|
||||
|
||||
TEST(Geo_Point2, math) {
|
||||
|
||||
Point2 p1(1,2);
|
||||
p1 += Point2(2,3);
|
||||
ASSERT_EQ(p1, Point2(3,5));
|
||||
|
||||
Point2 p2 = Point2(-2,-1) + p1;
|
||||
ASSERT_EQ(p2, Point2(1, 4));
|
||||
|
||||
p2 -= Point2(1, 2);
|
||||
ASSERT_EQ(p2, Point2(0,2));
|
||||
|
||||
Point2 p3 = Point2(1,2)*2;
|
||||
ASSERT_EQ(p3, Point2(2,4));
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "../Tests.h"
|
||||
#include "../../geo/Point3.h"
|
||||
|
||||
TEST(Point3, math) {
|
||||
TEST(Geo_Point3, math) {
|
||||
|
||||
Point3 p1(1,2,3);
|
||||
p1 += Point3(2,3,4);
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "../../geo/Sphere3.h"
|
||||
|
||||
TEST(Sphere3, contains) {
|
||||
TEST(Geo_Sphere3, contains) {
|
||||
|
||||
Sphere3 a(Point3(0,0,0), 10);
|
||||
|
||||
@@ -30,31 +30,31 @@ TEST(Sphere3, contains) {
|
||||
|
||||
}
|
||||
|
||||
TEST(Sphere3, join) {
|
||||
TEST(Geo_Sphere3, join) {
|
||||
|
||||
// no overlap
|
||||
Sphere3 a1(Point3(-1,0,0), 1);
|
||||
Sphere3 a2(Point3(+1,0,0), 1);
|
||||
Sphere3 a3 = Sphere3::join(a1, a2);
|
||||
ASSERT_EQ(Point3(0,0,0), a3.center);
|
||||
ASSERT_EQ(2, a3.radius);
|
||||
ASSERT_NEAR(2, a3.radius, 0.001);
|
||||
|
||||
// overlap
|
||||
Sphere3 b1(Point3(-1,0,0), 1.5);
|
||||
Sphere3 b2(Point3(+1,0,0), 1.5);
|
||||
Sphere3 b3 = Sphere3::join(b1, b2);
|
||||
ASSERT_EQ(Point3(0,0,0), b3.center);
|
||||
ASSERT_EQ(2.5, b3.radius);
|
||||
ASSERT_NEAR(2.5, b3.radius, 0.001);
|
||||
|
||||
// fully within
|
||||
Sphere3 c1(Point3(-1,0,0), 3.6);
|
||||
Sphere3 c2(Point3(+1,0,0), 1.5);
|
||||
Sphere3 c3 = Sphere3::join(c1, c2);
|
||||
ASSERT_EQ(c1.center, c3.center);
|
||||
ASSERT_EQ(c1.radius, c3.radius);
|
||||
ASSERT_NEAR(c1.radius, c3.radius, 0.001);
|
||||
Sphere3 c4 = Sphere3::join(c2, c1);
|
||||
ASSERT_EQ(c1.center, c4.center);
|
||||
ASSERT_EQ(c1.radius, c4.radius);
|
||||
ASSERT_NEAR(c1.radius, c4.radius, 0.001);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
// https://stackoverflow.com/questions/17458562/efficient-aabb-triangle-intersection-in-c-sharp
|
||||
// http://fileadmin.cs.lth.se/cs/Personal/Tomas_Akenine-Moller/code/tribox3.txt
|
||||
TEST(Triangle3, intersect) {
|
||||
TEST(Geo_Triangle3, intersect) {
|
||||
|
||||
Point3 dst;
|
||||
|
||||
|
||||
37
tests/ray/TestRayTrace2.cpp
Normal file
37
tests/ray/TestRayTrace2.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
#include "../Tests.h"
|
||||
#include "../../wifi/estimate/ray2d/WiFiRayTrace2D.h"
|
||||
#include "../../floorplan/v2/FloorplanReader.h"
|
||||
#include <fstream>
|
||||
|
||||
TEST(RayTrace2, test) {
|
||||
|
||||
//std::string file = "/mnt/data/workspaces/raytest2.xml";
|
||||
//Floorplan::IndoorMap* map = Floorplan::Reader::readFromFile(file);
|
||||
//Floorplan::AccessPoint* ap = map->floors[0]->accesspoints[0];
|
||||
|
||||
//std::string file = "/apps/SHL39.xml";
|
||||
std::string file = "/mnt/data/workspaces/IndoorMap/maps/SHL39.xml";
|
||||
Floorplan::IndoorMap* map = Floorplan::Reader::readFromFile(file);
|
||||
Floorplan::Floor* floor = map->floors[0];
|
||||
Floorplan::AccessPoint* ap = floor->accesspoints[4];
|
||||
|
||||
// ModelFactory fac(map);
|
||||
// std::ofstream outOBJ("/tmp/vm/map.obj");
|
||||
// outOBJ << fac.toOBJ();
|
||||
// outOBJ.close();
|
||||
|
||||
const int gs_cm = 50;
|
||||
|
||||
WiFiRaytrace2D rt(floor, gs_cm, ap->pos.xy());
|
||||
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> start = std::chrono::high_resolution_clock::now();
|
||||
const DataMapSignal& dms = rt.estimate();
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> end = std::chrono::high_resolution_clock::now();
|
||||
auto result = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
|
||||
std::cout << "it took: " << result << " msec" << std::endl;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -12,7 +12,8 @@ TEST(RayTrace3, test) {
|
||||
//Floorplan::IndoorMap* map = Floorplan::Reader::readFromFile(file);
|
||||
//Floorplan::AccessPoint* ap = map->floors[0]->accesspoints[0];
|
||||
|
||||
std::string file = "/apps/SHL39.xml";
|
||||
//std::string file = "/apps/SHL39.xml";
|
||||
std::string file = "/mnt/data/workspaces/IndoorMap/maps/SHL39.xml";
|
||||
Floorplan::IndoorMap* map = Floorplan::Reader::readFromFile(file);
|
||||
Floorplan::AccessPoint* ap = map->floors[0]->accesspoints[4];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user