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:
2017-09-13 08:08:00 +02:00
parent c19d18a3a6
commit 686151b511
38 changed files with 1257 additions and 253 deletions

View File

@@ -1,8 +1,9 @@
#ifndef BBOX2_H
#define BBOX2_H
#ifndef GEO_BBOX2_H
#define GEO_BBOX2_H
#include "Point2.h"
#include "Line2.h"
#include <vector>
class BBox2 {
@@ -105,6 +106,21 @@ public:
p2 += Point2(val, val); // increase maximum
}
/** grow the bbox by the amount given for each dimension */
void growRel(const float val) {
const Point2 center = (p1+p2)/2;
p1 += (p1-center)*val; // decrease minimum
p2 += (p2-center)*val; // increase maximum
}
/** combine two bboxes */
static BBox2 join(const BBox2& bb1, const BBox2& bb2) {
const Point2 min( std::min(bb1.p1.x, bb2.p1.x), std::min(bb1.p1.y, bb2.p1.y) );
const Point2 max( std::max(bb1.p2.x, bb2.p2.x), std::max(bb1.p2.y, bb2.p2.y) );
return BBox2(min, max);
}
};
#endif // BBOX2_H
#endif // GEO_BBOX2_H