2016-07-12 17:40:45 +00:00
|
|
|
#pragma once
|
2015-10-15 18:21:32 +00:00
|
|
|
|
|
|
|
#include "basics_global.h"
|
|
|
|
|
|
|
|
#include "Vector3.h"
|
|
|
|
|
|
|
|
namespace paysages {
|
|
|
|
namespace basics {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Infinite 3d geometric plane.
|
|
|
|
*/
|
2015-11-09 21:30:46 +00:00
|
|
|
class BASICSSHARED_EXPORT InfinitePlane {
|
|
|
|
public:
|
2015-10-15 18:21:32 +00:00
|
|
|
InfinitePlane();
|
|
|
|
InfinitePlane(const Vector3 &point, const Vector3 &normal);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check the intersection between the plane and an infinite ray.
|
|
|
|
*
|
|
|
|
* Returns the number of intersections (0, 1), and fill the intersection point.
|
|
|
|
*
|
|
|
|
* Returns -1 if the ray is on the plane, and make for an infinite number of intersection points.
|
|
|
|
*/
|
2015-11-09 21:30:46 +00:00
|
|
|
int checkRayIntersection(const InfiniteRay &ray, Vector3 *intersection) const;
|
2015-10-15 18:21:32 +00:00
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
inline const Vector3 &getPoint() const {
|
|
|
|
return point;
|
|
|
|
}
|
|
|
|
inline const Vector3 &getNormal() const {
|
|
|
|
return normal;
|
|
|
|
}
|
2015-10-15 18:21:32 +00:00
|
|
|
|
|
|
|
virtual void save(PackStream *stream) const;
|
|
|
|
virtual void load(PackStream *stream);
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
private:
|
2015-10-15 18:21:32 +00:00
|
|
|
Vector3 point;
|
|
|
|
Vector3 normal;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|