work on raytracing
This commit is contained in:
27
geo/volume/BoundingVolumeSphere.h
Normal file
27
geo/volume/BoundingVolumeSphere.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef BOUNDINGVOLUMESPHERE_H
|
||||
#define BOUNDINGVOLUMESPHERE_H
|
||||
|
||||
#include "../Point3.h"
|
||||
|
||||
class BoundingVolumeSphere : public BoundingVolume {
|
||||
|
||||
private:
|
||||
|
||||
Point3 center;
|
||||
|
||||
float radius;
|
||||
|
||||
public:
|
||||
|
||||
float getVolumeSize() const override {
|
||||
return (4.0f / 3.0f) * M_PI * (radius*radius*radius);
|
||||
}
|
||||
|
||||
/** does the volume contain the given point? */
|
||||
virtual bool contains(const Point3 p) const {
|
||||
return (center-p).length() <= radius;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // BOUNDINGVOLUMESPHERE_H
|
||||
Reference in New Issue
Block a user