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
39 lines
834 B
C++
39 lines
834 B
C++
#ifndef BOUDINGVOLUMECIRCLE2_H
|
|
#define BOUDINGVOLUMECIRCLE2_H
|
|
|
|
#include <vector>
|
|
|
|
#include "BoundingVolume.h"
|
|
#include "../Circle2.h"
|
|
|
|
class BoundingVolumeCircle2 : public Circle2 {
|
|
|
|
public:
|
|
|
|
BoundingVolumeCircle2() {;}
|
|
|
|
BoundingVolumeCircle2(const Circle2& c) : Circle2(c) {;}
|
|
|
|
float getVolumeSize() const {
|
|
return M_PI * (radius*radius);
|
|
}
|
|
|
|
bool intersects(const Ray2 ray) const {
|
|
return Circle2::intersects(ray);
|
|
}
|
|
|
|
/** construct a volume around the given point-set */
|
|
static BoundingVolumeCircle2 fromVertices(const std::vector<Point2>& verts) {
|
|
BoundingVolumeCircle2 bvs;
|
|
bvs.adjustToPointSet(verts);
|
|
return bvs;
|
|
}
|
|
|
|
static BoundingVolumeCircle2 join(const BoundingVolumeCircle2 a, const BoundingVolumeCircle2 b) {
|
|
return BoundingVolumeCircle2(Circle2::join(a, b));
|
|
}
|
|
|
|
};
|
|
|
|
#endif // BOUDINGVOLUMECIRCLE2_H
|