26 lines
864 B
C++
Executable File
26 lines
864 B
C++
Executable File
#include "simulation/geometry.h"
|
|
|
|
Cylinder::Cylinder(double radius, double height)
|
|
: radius_(radius), height_(height) {}
|
|
|
|
bool Cylinder::isInside(const Coordinate& position) const {
|
|
const blitz::TinyVector<double, 3> cylinder_position =
|
|
position.cylinderEntries();
|
|
return (cylinder_position(0) < radius_) && (cylinder_position(2) < height_) &&
|
|
(cylinder_position(2) > 0);
|
|
}
|
|
|
|
GeometryPositioning Cylinder::isWhere(const Coordinate& position) const {
|
|
const blitz::TinyVector<double, 3> cylinder_position =
|
|
position.cylinderEntries();
|
|
if(cylinder_position(0) >= radius_) {
|
|
return GeometryPositioning::hull;
|
|
} else if (cylinder_position(2) <= 0) {
|
|
return GeometryPositioning::bottom;
|
|
} else if (cylinder_position(2) >= height_) {
|
|
return GeometryPositioning::top;
|
|
} else {
|
|
return GeometryPositioning::inside;
|
|
}
|
|
}
|