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/wifi/estimate/ray3/Obstacle3.h
frank 8358f45674 added support for .obj objects within the floorplan
include objects within navmesh calculation
include objects within 3d mesh generation
minor changes/fixes
2018-02-17 17:20:43 +01:00

67 lines
1.3 KiB
C++

#ifndef OBSTACLE3_H
#define OBSTACLE3_H
#include <vector>
#include "../../../geo/Triangle3.h"
#include "../../../geo/Sphere3.h"
#include "../../../floorplan/v2/Floorplan.h"
namespace Ray3D {
/**
* 3D obstacle
* based on multiple triangles
* has a material and a type
*/
struct Obstacle3D {
enum class Type {
UNKNOWN,
GROUND_INDOOR,
GROUND_OUTDOOR,
STAIR,
HANDRAIL,
DOOR,
WALL,
WINDOW,
OBJECT,
};
Type type;
Floorplan::Material mat;
std::vector<Triangle3> triangles;
/** empty ctor */
Obstacle3D() : type(Type::UNKNOWN), mat() {;}
/** ctor */
Obstacle3D(Type type, Floorplan::Material mat) : type(type), mat(mat) {;}
/** translated copy */
Obstacle3D translated(const Point3 pos) const {
Obstacle3D copy = *this;
for (Triangle3& tria : copy.triangles) {
tria += pos;
}
return copy;
}
/** rotated [around (0,0,0)] copy */
Obstacle3D rotated_deg(const Point3 rot) const {
Obstacle3D copy = *this;
for (Triangle3& tria : copy.triangles) {
tria.p1 = tria.p1.rot(rot.x/180.0f*M_PI, rot.y/180.0f*M_PI, rot.z/180.0f*M_PI);
tria.p2 = tria.p2.rot(rot.x/180.0f*M_PI, rot.y/180.0f*M_PI, rot.z/180.0f*M_PI);
tria.p3 = tria.p3.rot(rot.x/180.0f*M_PI, rot.y/180.0f*M_PI, rot.z/180.0f*M_PI);
}
return copy;
}
};
}
#endif // OBSTACLE3_H