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:
36
geo/volume/BoundingVolumeAABB2.h
Normal file
36
geo/volume/BoundingVolumeAABB2.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef BOUNDINGVOLUMEAABB2_H
|
||||
#define BOUNDINGVOLUMEAABB2_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "BoundingVolume.h"
|
||||
#include "../BBox2.h"
|
||||
|
||||
class BoundingVolumeAABB2 : public BBox2 {
|
||||
|
||||
public:
|
||||
|
||||
BoundingVolumeAABB2() {;}
|
||||
|
||||
BoundingVolumeAABB2(const BBox2& bb) : BBox2(bb) {;}
|
||||
|
||||
float getVolumeSize() const {
|
||||
const float dx = getMax().x - getMin().x;
|
||||
const float dy = getMax().y - getMin().y;
|
||||
return (dx*dy);
|
||||
}
|
||||
|
||||
/** construct a volume around the given point-set */
|
||||
static BoundingVolumeAABB2 fromVertices(const std::vector<Point2>& verts) {
|
||||
BoundingVolumeAABB2 bvs;
|
||||
for (const Point2 p : verts) {bvs.add(p);}
|
||||
return bvs;
|
||||
}
|
||||
|
||||
static BoundingVolumeAABB2 join(const BoundingVolumeAABB2 a, const BoundingVolumeAABB2 b) {
|
||||
return BoundingVolumeAABB2(BBox2::join(a, b));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // BOUNDINGVOLUMEAABB2_H
|
||||
Reference in New Issue
Block a user