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:
38
geo/volume/BoundingVolumeCircle2.h
Normal file
38
geo/volume/BoundingVolumeCircle2.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user