2015-10-15 18:21:32 +00:00
|
|
|
#ifndef CAPPEDCYLINDER_H
|
|
|
|
#define CAPPEDCYLINDER_H
|
|
|
|
|
|
|
|
#include "basics_global.h"
|
|
|
|
|
|
|
|
#include "InfiniteCylinder.h"
|
|
|
|
|
|
|
|
namespace paysages {
|
|
|
|
namespace basics {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Geometric cylinder, with capped ends (not infinite).
|
|
|
|
*/
|
2015-11-09 21:30:46 +00:00
|
|
|
class BASICSSHARED_EXPORT CappedCylinder : public InfiniteCylinder {
|
|
|
|
public:
|
2015-10-15 18:21:32 +00:00
|
|
|
CappedCylinder();
|
|
|
|
CappedCylinder(const Vector3 &base, const Vector3 &direction, double radius, double length);
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
inline double getLength() const {
|
|
|
|
return length;
|
|
|
|
}
|
2015-10-15 18:21:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check the intersection between the cylinder and an infinite ray.
|
|
|
|
*/
|
|
|
|
int checkRayIntersection(const InfiniteRay &ray, Vector3 *first_intersection, Vector3 *second_intersection) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if a point projects in the length of the finite cylinder.
|
|
|
|
*/
|
|
|
|
bool checkPointProjection(Vector3 *point) const;
|
|
|
|
|
|
|
|
virtual void save(PackStream *stream) const override;
|
|
|
|
virtual void load(PackStream *stream) override;
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
private:
|
2015-10-15 18:21:32 +00:00
|
|
|
double length;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // CAPPEDCYLINDER_H
|