a lot of work on th map-creator
This commit is contained in:
52
mapview/3D/misc/Plane.h
Normal file
52
mapview/3D/misc/Plane.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef PLANE_H
|
||||
#define PLANE_H
|
||||
|
||||
#include <Indoor/geo/Point3.h>
|
||||
#include <QtOpenGL>
|
||||
|
||||
class Plane {
|
||||
|
||||
private:
|
||||
|
||||
Point3 p1;
|
||||
Point3 p2;
|
||||
Point3 p3;
|
||||
Point3 p4;
|
||||
Point3 n;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/** construct from 2D line and heights */
|
||||
Plane(const Point2 from, const Point2 to, const float atHeight, const float height) {
|
||||
|
||||
p1 = Point3(from.x, from.y, atHeight);
|
||||
p2 = Point3(to.x, to.y, atHeight);
|
||||
p3 = Point3(to.x, to.y, atHeight+height);
|
||||
p4 = Point3(from.x, from.y, atHeight+height);
|
||||
|
||||
const Point2 perp = (to-from).perpendicular();
|
||||
n = Point3(perp.x, perp.y, 0);
|
||||
|
||||
}
|
||||
|
||||
void paintGL() {
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
// bottom
|
||||
glNormal3f(n.x, n.z, n.y);
|
||||
glVertex3f(p1.x, p1.z, p1.y);
|
||||
glVertex3f(p2.x, p2.z, p2.y);
|
||||
glVertex3f(p3.x, p3.z, p3.y);
|
||||
glVertex3f(p4.x, p4.z, p4.y);
|
||||
|
||||
glEnd();
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // PLANE_H
|
||||
Reference in New Issue
Block a user