-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibIOctoMap.h
More file actions
86 lines (72 loc) · 3.37 KB
/
libIOctoMap.h
File metadata and controls
86 lines (72 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef LIBIOCTOMAP_H
#define LIBIOCTOMAP_H
#include "libioctomap_global.h"
#include <QMap>
#include <QVector>
#include <QString>
#include <QWidget>
#define LIBIOCTOMAP_OPENVIS "octovis/octovis.exe"
#define LIBIOCTOMAP_BT_FILE_EXTENSION ".bt"
#define LIBIOCTOMAP_OT_FILE_EXTENSION ".ot"
#define LIBIOCTOMAP_NUMBER_OF_POINTS_TO_PROCESS_BY_STEP 10000
#define LIBIOCTOMAP_LINEAR_TOLERANCE 0.0001
#include <math.h>
#include <stdlib.h>
// this is mimicing gtest expressions
#define EXPECT_TRUE(args) { \
if (!(args)) { fprintf(stderr, "test failed (EXPECT_TRUE) in %s, line %d\n", __FILE__, __LINE__); \
exit(1); \
} }
#define EXPECT_FALSE(args) { \
if (args) { fprintf(stderr, "test failed (EXPECT_FALSE) in %s, line %d\n", __FILE__, __LINE__); \
exit(1); \
} }
#define EXPECT_EQ(a,b) { \
if (!(a == b)) { std::cerr << "test failed: " <<a<<"!="<<b<< " in " \
<< __FILE__ << ", line " <<__LINE__ << std::endl; \
exit(1); \
} }
#define EXPECT_FLOAT_EQ(a,b) { \
if (!(fabs(a-b) <= 1e-5)) { fprintf(stderr, "test failed: %f != %f in %s, line %d\n", a, b, __FILE__, __LINE__); \
exit(1); \
} }
#define EXPECT_NEAR(a,b,prec) { \
if (!(fabs(a-b) <= prec)) { fprintf(stderr, "test failed: |%f - %f| > %f in %s, line %d\n", a, b, prec, __FILE__, __LINE__); \
exit(1); \
} }
class LIBIOCTOMAPSHARED_EXPORT libIOctoMap
{
public:
inline libIOctoMap() {;};
static inline libIOctoMap * getInstance(void )
{
if ( mInstance == 0 ) mInstance = new libIOctoMap;
return mInstance;
};
bool createOctoMap(QVector<QVector<double> >& coordinates,
QVector<QVector<unsigned short> >& colors,
QVector<unsigned short>& sourceIds,
QMap<int,QVector<double> >& scanPositions,
float resolution,
bool computeFreeVoxels,
double& volume,
bool computeMetrics,
bool openViewer,
QString outputFileName,
QString& strError,
QWidget *ptrWidget=NULL);
bool openFileInViewer(QString fileName,
QString& strError);
private:
double max(double v1,double v2);
double min(double v1,double v2);
bool getNewOriginForRayInBoundingBox(double xs,double ys,double zs, // start
double xe,double ye,double ze, // end
double minX, double minY,
double maxX, double maxY,
double& xo,
double& yo,
double& zo);
static libIOctoMap * mInstance;
};
#endif // LIBIOCTOMAP_H