2016-07-12 17:40:45 +00:00
|
|
|
#pragma once
|
2015-10-15 18:21:32 +00:00
|
|
|
|
|
|
|
#include "basics_global.h"
|
|
|
|
|
|
|
|
#include "InfinitePlane.h"
|
|
|
|
|
|
|
|
namespace paysages {
|
|
|
|
namespace basics {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Geometric plane disk.
|
|
|
|
*/
|
2015-11-09 21:30:46 +00:00
|
|
|
class BASICSSHARED_EXPORT Disk : public InfinitePlane {
|
|
|
|
public:
|
2015-11-02 19:14:35 +00:00
|
|
|
Disk() = default;
|
2015-10-15 18:21:32 +00:00
|
|
|
Disk(const Vector3 &point, const Vector3 &normal, double radius);
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
inline double getRadius() const {
|
|
|
|
return radius;
|
|
|
|
}
|
2015-10-15 18:21:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check the intersection between the disk and an infinite ray.
|
|
|
|
*
|
|
|
|
* Returns the number of intersections (0, 1), and fill the intersection point.
|
|
|
|
*
|
|
|
|
* Returns -1 if the ray shares a segment with the disk.
|
|
|
|
*/
|
2015-11-09 21:30:46 +00:00
|
|
|
int checkRayIntersection(const InfiniteRay &ray, Vector3 *intersection) const;
|
2015-10-15 18:21:32 +00:00
|
|
|
|
|
|
|
void save(PackStream *stream) const override;
|
|
|
|
void load(PackStream *stream) override;
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
private:
|
2015-10-15 18:21:32 +00:00
|
|
|
double radius;
|
|
|
|
double radius2;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|