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/geo/volume/BoundingVolumeAABB2.h
FrankE 686151b511 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
2017-09-13 08:08:00 +02:00

37 lines
812 B
C++

#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