Commit d8fa6464 authored by Andre Bamidele's avatar Andre Bamidele
Browse files

Refactored get object geometry to take inner radius. Refs: #25149

parent f211f36e
...@@ -89,9 +89,9 @@ public: ...@@ -89,9 +89,9 @@ public:
} }
void GetObjectGeom(detail::ShapeInfo::GeometryShape &type, void GetObjectGeom(detail::ShapeInfo::GeometryShape &type,
std::vector<Kernel::V3D> &vectors, double &myradius, std::vector<Kernel::V3D> &vectors, double &innerRadius,
double &myheight) const override { double &radius, double &height) const override {
m_shape->GetObjectGeom(type, vectors, myradius, myheight); m_shape->GetObjectGeom(type, vectors, innerRadius, radius, height);
} }
boost::shared_ptr<GeometryHandler> getGeometryHandler() const override { boost::shared_ptr<GeometryHandler> getGeometryHandler() const override {
return m_shape->getGeometryHandler(); return m_shape->getGeometryHandler();
......
...@@ -186,8 +186,8 @@ public: ...@@ -186,8 +186,8 @@ public:
detail::ShapeInfo::GeometryShape shape() const override; detail::ShapeInfo::GeometryShape shape() const override;
const detail::ShapeInfo &shapeInfo() const; const detail::ShapeInfo &shapeInfo() const;
void GetObjectGeom(detail::ShapeInfo::GeometryShape &type, void GetObjectGeom(detail::ShapeInfo::GeometryShape &type,
std::vector<Kernel::V3D> &vectors, double &myradius, std::vector<Kernel::V3D> &vectors, double &innerRadius,
double &myheight) const override; double &radius, double &height) const override;
/// Getter for the shape xml /// Getter for the shape xml
std::string getShapeXML() const; std::string getShapeXML() const;
......
...@@ -78,8 +78,8 @@ public: ...@@ -78,8 +78,8 @@ public:
virtual detail::ShapeInfo::GeometryShape shape() const = 0; virtual detail::ShapeInfo::GeometryShape shape() const = 0;
virtual void GetObjectGeom(detail::ShapeInfo::GeometryShape &type, virtual void GetObjectGeom(detail::ShapeInfo::GeometryShape &type,
std::vector<Kernel::V3D> &vectors, std::vector<Kernel::V3D> &vectors, double &innerRadius,
double &myradius, double &myheight) const = 0; double &radius, double &height) const = 0;
// Rendering // Rendering
virtual void draw() const = 0; virtual void draw() const = 0;
virtual void initDraw() const = 0; virtual void initDraw() const = 0;
......
...@@ -126,8 +126,8 @@ public: ...@@ -126,8 +126,8 @@ public:
detail::ShapeInfo::GeometryShape shape() const override; detail::ShapeInfo::GeometryShape shape() const override;
void GetObjectGeom(detail::ShapeInfo::GeometryShape &type, void GetObjectGeom(detail::ShapeInfo::GeometryShape &type,
std::vector<Kernel::V3D> &vectors, double &myradius, std::vector<Kernel::V3D> &vectors, double &innerRadius,
double &myheight) const override; double &radius, double &height) const override;
/// Read access to mesh object for rendering /// Read access to mesh object for rendering
size_t numberOfVertices() const; size_t numberOfVertices() const;
......
...@@ -70,8 +70,8 @@ public: ...@@ -70,8 +70,8 @@ public:
const size_t) const override; const size_t) const override;
detail::ShapeInfo::GeometryShape shape() const override; detail::ShapeInfo::GeometryShape shape() const override;
void GetObjectGeom(detail::ShapeInfo::GeometryShape &type, void GetObjectGeom(detail::ShapeInfo::GeometryShape &type,
std::vector<Kernel::V3D> &vectors, double &myradius, std::vector<Kernel::V3D> &vectors, double &innerRadius,
double &myheight) const override; double &radius, double &height) const override;
void draw() const override; void draw() const override;
void initDraw() const override; void initDraw() const override;
const Kernel::Material &material() const override; const Kernel::Material &material() const override;
......
...@@ -92,10 +92,8 @@ public: ...@@ -92,10 +92,8 @@ public:
GeometryShape shape() const; GeometryShape shape() const;
void getObjectGeometry(GeometryShape &shape, std::vector<Kernel::V3D> &points, void getObjectGeometry(GeometryShape &shape, std::vector<Kernel::V3D> &points,
double &innerRadius, double &outerRadius, double &innerRadius, double &radius,
double &height) const; double &height) const;
void getObjectGeometry(GeometryShape &shape, std::vector<Kernel::V3D> &points,
double &radius, double &height) const;
CuboidGeometry cuboidGeometry() const; CuboidGeometry cuboidGeometry() const;
HexahedronGeometry hexahedronGeometry() const; HexahedronGeometry hexahedronGeometry() const;
......
...@@ -388,13 +388,13 @@ boost::shared_ptr<IObject> ObjCompAssembly::createOutline() { ...@@ -388,13 +388,13 @@ boost::shared_ptr<IObject> ObjCompAssembly::createOutline() {
std::string type; std::string type;
detail::ShapeInfo::GeometryShape otype; detail::ShapeInfo::GeometryShape otype;
std::vector<Kernel::V3D> vectors; std::vector<Kernel::V3D> vectors;
double radius, height; double radius, height, innerRadius;
boost::shared_ptr<const IObject> obj = group.front()->shape(); boost::shared_ptr<const IObject> obj = group.front()->shape();
if (!obj) { if (!obj) {
throw Kernel::Exception::InstrumentDefinitionError( throw Kernel::Exception::InstrumentDefinitionError(
"Found ObjComponent without shape"); "Found ObjComponent without shape");
} }
obj->GetObjectGeom(otype, vectors, radius, height); obj->GetObjectGeom(otype, vectors, innerRadius, radius, height);
if (otype == detail::ShapeInfo::GeometryShape::CUBOID) { if (otype == detail::ShapeInfo::GeometryShape::CUBOID) {
type = "box"; type = "box";
} else if (otype == detail::ShapeInfo::GeometryShape::CYLINDER) { } else if (otype == detail::ShapeInfo::GeometryShape::CYLINDER) {
......
...@@ -1014,12 +1014,12 @@ double CSGObject::triangleSolidAngle(const V3D &observer) const { ...@@ -1014,12 +1014,12 @@ double CSGObject::triangleSolidAngle(const V3D &observer) const {
} }
// If the object is a simple shape use the special methods // If the object is a simple shape use the special methods
double height(0.0), radius(0.0); double height(0.0), radius(0.0), innerRadius(0.0);
detail::ShapeInfo::GeometryShape type; detail::ShapeInfo::GeometryShape type;
std::vector<Mantid::Kernel::V3D> geometry_vectors; std::vector<Mantid::Kernel::V3D> geometry_vectors;
// Maximum of 4 vectors depending on the type // Maximum of 4 vectors depending on the type
geometry_vectors.reserve(4); geometry_vectors.reserve(4);
this->GetObjectGeom(type, geometry_vectors, radius, height); this->GetObjectGeom(type, geometry_vectors, innerRadius, radius, height);
auto nTri = this->numberOfTriangles(); auto nTri = this->numberOfTriangles();
// Cylinders are by far the most frequently used // Cylinders are by far the most frequently used
switch (type) { switch (type) {
...@@ -1113,10 +1113,10 @@ double CSGObject::triangleSolidAngle(const V3D &observer, ...@@ -1113,10 +1113,10 @@ double CSGObject::triangleSolidAngle(const V3D &observer,
// and Cone cases as well. // and Cone cases as well.
// //
if (nTri == 0) { if (nTri == 0) {
double height = 0.0, radius(0.0); double height = 0.0, radius(0.0), innerRadius;
detail::ShapeInfo::GeometryShape type; detail::ShapeInfo::GeometryShape type;
std::vector<Kernel::V3D> vectors; std::vector<Kernel::V3D> vectors;
this->GetObjectGeom(type, vectors, radius, height); this->GetObjectGeom(type, vectors, innerRadius, radius, height);
switch (type) { switch (type) {
case detail::ShapeInfo::GeometryShape::CUBOID: case detail::ShapeInfo::GeometryShape::CUBOID:
for (auto &vector : vectors) for (auto &vector : vectors)
...@@ -1506,8 +1506,9 @@ double CSGObject::volume() const { ...@@ -1506,8 +1506,9 @@ double CSGObject::volume() const {
detail::ShapeInfo::GeometryShape type; detail::ShapeInfo::GeometryShape type;
double height; double height;
double radius; double radius;
double innerRadius;
std::vector<Kernel::V3D> vectors; std::vector<Kernel::V3D> vectors;
this->GetObjectGeom(type, vectors, radius, height); this->GetObjectGeom(type, vectors, innerRadius, radius, height);
switch (type) { switch (type) {
case detail::ShapeInfo::GeometryShape::CUBOID: { case detail::ShapeInfo::GeometryShape::CUBOID: {
// Here, the volume is calculated by the triangular method. // Here, the volume is calculated by the triangular method.
...@@ -1543,6 +1544,8 @@ double CSGObject::volume() const { ...@@ -1543,6 +1544,8 @@ double CSGObject::volume() const {
return 4.0 / 3.0 * M_PI * radius * radius * radius; return 4.0 / 3.0 * M_PI * radius * radius * radius;
case detail::ShapeInfo::GeometryShape::CYLINDER: case detail::ShapeInfo::GeometryShape::CYLINDER:
return M_PI * radius * radius * height; return M_PI * radius * radius * height;
case detail::ShapeInfo::GeometryShape::HOLLOWCYLINDER:
return M_PI * height * (radius * radius - innerRadius * innerRadius);
default: default:
// Fall back to Monte Carlo method. // Fall back to Monte Carlo method.
return monteCarloVolume(); return monteCarloVolume();
...@@ -1774,9 +1777,10 @@ void CSGObject::calcBoundingBoxByGeometry() { ...@@ -1774,9 +1777,10 @@ void CSGObject::calcBoundingBoxByGeometry() {
std::vector<Kernel::V3D> vectors; std::vector<Kernel::V3D> vectors;
double radius; double radius;
double height; double height;
double innerRadius;
// Will only work for shapes with ShapeInfo // Will only work for shapes with ShapeInfo
m_handler->GetObjectGeom(type, vectors, radius, height); m_handler->GetObjectGeom(type, vectors, innerRadius, radius, height);
// Type of shape is given as a simple integer // Type of shape is given as a simple integer
switch (type) { switch (type) {
case detail::ShapeInfo::GeometryShape::CUBOID: { case detail::ShapeInfo::GeometryShape::CUBOID: {
...@@ -2022,6 +2026,7 @@ V3D CSGObject::generatePointInObject(PseudoRandomNumberGenerator &rng, ...@@ -2022,6 +2026,7 @@ V3D CSGObject::generatePointInObject(PseudoRandomNumberGenerator &rng,
break; break;
case detail::ShapeInfo::GeometryShape::HOLLOWCYLINDER: case detail::ShapeInfo::GeometryShape::HOLLOWCYLINDER:
point = RandomPoint::inHollowCylinder(m_handler->shapeInfo(), rng); point = RandomPoint::inHollowCylinder(m_handler->shapeInfo(), rng);
break;
case detail::ShapeInfo::GeometryShape::SPHERE: case detail::ShapeInfo::GeometryShape::SPHERE:
point = RandomPoint::inSphere(m_handler->shapeInfo(), rng); point = RandomPoint::inSphere(m_handler->shapeInfo(), rng);
break; break;
...@@ -2067,7 +2072,8 @@ V3D CSGObject::generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng, ...@@ -2067,7 +2072,8 @@ V3D CSGObject::generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng,
std::vector<Kernel::V3D> shapeVectors; std::vector<Kernel::V3D> shapeVectors;
double radius; double radius;
double height; double height;
GetObjectGeom(shape, shapeVectors, radius, height); double innerRadius;
GetObjectGeom(shape, shapeVectors, innerRadius, radius, height);
switch (shape) { switch (shape) {
case detail::ShapeInfo::GeometryShape::CUBOID: case detail::ShapeInfo::GeometryShape::CUBOID:
point = RandomPoint::bounded<RandomPoint::inCuboid>( point = RandomPoint::bounded<RandomPoint::inCuboid>(
...@@ -2077,6 +2083,10 @@ V3D CSGObject::generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng, ...@@ -2077,6 +2083,10 @@ V3D CSGObject::generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng,
point = RandomPoint::bounded<RandomPoint::inCylinder>( point = RandomPoint::bounded<RandomPoint::inCylinder>(
m_handler->shapeInfo(), rng, activeRegion, maxAttempts); m_handler->shapeInfo(), rng, activeRegion, maxAttempts);
break; break;
case detail::ShapeInfo::GeometryShape::HOLLOWCYLINDER:
point = RandomPoint::bounded<RandomPoint::inHollowCylinder>(
m_handler->shapeInfo(), rng, activeRegion, maxAttempts);
break;
case detail::ShapeInfo::GeometryShape::SPHERE: case detail::ShapeInfo::GeometryShape::SPHERE:
point = RandomPoint::bounded<RandomPoint::inSphere>( point = RandomPoint::bounded<RandomPoint::inSphere>(
m_handler->shapeInfo(), rng, activeRegion, maxAttempts); m_handler->shapeInfo(), rng, activeRegion, maxAttempts);
...@@ -2253,11 +2263,12 @@ const detail::ShapeInfo &CSGObject::shapeInfo() const { ...@@ -2253,11 +2263,12 @@ const detail::ShapeInfo &CSGObject::shapeInfo() const {
*/ */
void CSGObject::GetObjectGeom(detail::ShapeInfo::GeometryShape &type, void CSGObject::GetObjectGeom(detail::ShapeInfo::GeometryShape &type,
std::vector<Kernel::V3D> &vectors, std::vector<Kernel::V3D> &vectors,
double &myradius, double &myheight) const { double &innerRadius, double &radius,
double &height) const {
type = detail::ShapeInfo::GeometryShape::NOSHAPE; type = detail::ShapeInfo::GeometryShape::NOSHAPE;
if (m_handler == nullptr) if (m_handler == nullptr)
return; return;
m_handler->GetObjectGeom(type, vectors, myradius, myheight); m_handler->GetObjectGeom(type, vectors, innerRadius, radius, height);
} }
/** Getter for the shape xml /** Getter for the shape xml
......
...@@ -520,14 +520,15 @@ detail::ShapeInfo::GeometryShape MeshObject::shape() const { ...@@ -520,14 +520,15 @@ detail::ShapeInfo::GeometryShape MeshObject::shape() const {
*/ */
void MeshObject::GetObjectGeom(detail::ShapeInfo::GeometryShape &type, void MeshObject::GetObjectGeom(detail::ShapeInfo::GeometryShape &type,
std::vector<Kernel::V3D> &vectors, std::vector<Kernel::V3D> &vectors,
double &myradius, double &myheight) const { double &innerRadius, double &radius,
double &height) const {
// In practice, this outputs type = -1, // In practice, this outputs type = -1,
// to indicate not a "standard" object (cuboid/cone/cyl/sphere). // to indicate not a "standard" object (cuboid/cone/cyl/sphere).
// Retained for possible future use. // Retained for possible future use.
type = detail::ShapeInfo::GeometryShape::NOSHAPE; type = detail::ShapeInfo::GeometryShape::NOSHAPE;
if (m_handler == nullptr) if (m_handler == nullptr)
return; return;
m_handler->GetObjectGeom(type, vectors, myradius, myheight); m_handler->GetObjectGeom(type, vectors, innerRadius, radius, height);
} }
} // NAMESPACE Geometry } // NAMESPACE Geometry
......
...@@ -401,7 +401,7 @@ detail::ShapeInfo::GeometryShape MeshObject2D::shape() const { ...@@ -401,7 +401,7 @@ detail::ShapeInfo::GeometryShape MeshObject2D::shape() const {
} }
void MeshObject2D::GetObjectGeom(detail::ShapeInfo::GeometryShape &, void MeshObject2D::GetObjectGeom(detail::ShapeInfo::GeometryShape &,
std::vector<Kernel::V3D> &, double &, std::vector<Kernel::V3D> &, double &, double &,
double &) const { double &) const {
throw std::runtime_error("Not implemented"); throw std::runtime_error("Not implemented");
......
...@@ -103,14 +103,6 @@ void GeometryHandler::setGeometryCache(size_t nPts, size_t nFaces, ...@@ -103,14 +103,6 @@ void GeometryHandler::setGeometryCache(size_t nPts, size_t nFaces,
} }
} }
void GeometryHandler::GetObjectGeom(detail::ShapeInfo::GeometryShape &type,
std::vector<Kernel::V3D> &vectors,
double &radius, double &height) const {
type = detail::ShapeInfo::GeometryShape::NOSHAPE;
if (m_shapeInfo)
m_shapeInfo->getObjectGeometry(type, vectors, radius, height);
}
void GeometryHandler::GetObjectGeom(detail::ShapeInfo::GeometryShape &type, void GeometryHandler::GetObjectGeom(detail::ShapeInfo::GeometryShape &type,
std::vector<Kernel::V3D> &vectors, std::vector<Kernel::V3D> &vectors,
double &innerRadius, double &radius, double &innerRadius, double &radius,
......
...@@ -30,21 +30,12 @@ ShapeInfo::GeometryShape ShapeInfo::shape() const { return m_shape; } ...@@ -30,21 +30,12 @@ ShapeInfo::GeometryShape ShapeInfo::shape() const { return m_shape; }
void ShapeInfo::getObjectGeometry(ShapeInfo::GeometryShape &shape, void ShapeInfo::getObjectGeometry(ShapeInfo::GeometryShape &shape,
std::vector<Kernel::V3D> &points, std::vector<Kernel::V3D> &points,
double &radius, double &height) const { double &innerRadius, double &radius,
shape = m_shape;
points = m_points;
radius = m_radius;
height = m_height;
}
void ShapeInfo::getObjectGeometry(ShapeInfo::GeometryShape &shape,
std::vector<Kernel::V3D> &points,
double &innerRadius, double &outerRadius,
double &height) const { double &height) const {
shape = m_shape; shape = m_shape;
points = m_points; points = m_points;
innerRadius = m_innerRadius; innerRadius = m_innerRadius;
outerRadius = m_radius; radius = m_radius;
height = m_height; height = m_height;
} }
......
...@@ -63,16 +63,16 @@ public: ...@@ -63,16 +63,16 @@ public:
auto &original = dynamic_cast<CSGObject &>(*original_ptr); auto &original = dynamic_cast<CSGObject &>(*original_ptr);
original.setID("sp-1"); original.setID("sp-1");
ShapeInfo::GeometryShape objType; ShapeInfo::GeometryShape objType;
double radius(-1.0), height(-1.0); double radius(-1.0), height(-1.0), innerRadius(0.0);
std::vector<V3D> pts; std::vector<V3D> pts;
auto handler = original.getGeometryHandler(); auto handler = original.getGeometryHandler();
TS_ASSERT(handler->hasShapeInfo()); TS_ASSERT(handler->hasShapeInfo());
original.GetObjectGeom(objType, pts, radius, height); original.GetObjectGeom(objType, pts, innerRadius, radius, height);
TS_ASSERT_EQUALS(ShapeInfo::GeometryShape::SPHERE, objType); TS_ASSERT_EQUALS(ShapeInfo::GeometryShape::SPHERE, objType);
CSGObject copy(original); CSGObject copy(original);
// The copy should be a primitive object with a GeometryHandler // The copy should be a primitive object with a GeometryHandler
copy.GetObjectGeom(objType, pts, radius, height); copy.GetObjectGeom(objType, pts, innerRadius, radius, height);
TS_ASSERT_EQUALS("sp-1", copy.id()); TS_ASSERT_EQUALS("sp-1", copy.id());
auto handlerCopy = copy.getGeometryHandler(); auto handlerCopy = copy.getGeometryHandler();
...@@ -89,17 +89,17 @@ public: ...@@ -89,17 +89,17 @@ public:
auto &original = dynamic_cast<CSGObject &>(*original_ptr); auto &original = dynamic_cast<CSGObject &>(*original_ptr);
original.setID("sp-1"); original.setID("sp-1");
ShapeInfo::GeometryShape objType; ShapeInfo::GeometryShape objType;
double radius(-1.0), height(-1.0); double radius(-1.0), height(-1.0), innerRadius(0.0);
std::vector<V3D> pts; std::vector<V3D> pts;
auto handler = original.getGeometryHandler(); auto handler = original.getGeometryHandler();
TS_ASSERT(handler->hasShapeInfo()); TS_ASSERT(handler->hasShapeInfo());
original.GetObjectGeom(objType, pts, radius, height); original.GetObjectGeom(objType, pts, innerRadius, radius, height);
TS_ASSERT_EQUALS(ShapeInfo::GeometryShape::SPHERE, objType); TS_ASSERT_EQUALS(ShapeInfo::GeometryShape::SPHERE, objType);
CSGObject lhs; // initialize CSGObject lhs; // initialize
lhs = original; // assign lhs = original; // assign
// The copy should be a primitive object with a GluGeometryHandler // The copy should be a primitive object with a GluGeometryHandler
lhs.GetObjectGeom(objType, pts, radius, height); lhs.GetObjectGeom(objType, pts, innerRadius, radius, height);
TS_ASSERT_EQUALS("sp-1", lhs.id()); TS_ASSERT_EQUALS("sp-1", lhs.id());
TS_ASSERT_EQUALS(ShapeInfo::GeometryShape::SPHERE, objType); TS_ASSERT_EQUALS(ShapeInfo::GeometryShape::SPHERE, objType);
......
...@@ -350,10 +350,10 @@ public: ...@@ -350,10 +350,10 @@ public:
void test_GetObjGeom_not_implemented() { void test_GetObjGeom_not_implemented() {
auto mesh = makeSimpleTriangleMesh(); auto mesh = makeSimpleTriangleMesh();
std::vector<V3D> vectors; std::vector<V3D> vectors;
double radius, height; double radius, height, innerRadius;
Mantid::Geometry::detail::ShapeInfo::GeometryShape shape; Mantid::Geometry::detail::ShapeInfo::GeometryShape shape;
TS_ASSERT_THROWS(mesh.GetObjectGeom(shape, vectors, radius, height), TS_ASSERT_THROWS(mesh.GetObjectGeom(shape, vectors, innerRadius, radius, height),
std::runtime_error &); std::runtime_error &);
} }
......
...@@ -367,8 +367,8 @@ public: ...@@ -367,8 +367,8 @@ public:
detail::ShapeInfo::GeometryShape otype; detail::ShapeInfo::GeometryShape otype;
std::vector<V3D> vectors; std::vector<V3D> vectors;
double radius, height; double radius, height, innerRadius;
shape->GetObjectGeom(otype, vectors, radius, height); shape->GetObjectGeom(otype, vectors, innerRadius, radius, height);
TS_ASSERT_EQUALS(otype, detail::ShapeInfo::GeometryShape::CYLINDER); TS_ASSERT_EQUALS(otype, detail::ShapeInfo::GeometryShape::CYLINDER);
TS_ASSERT_EQUALS(radius, 0.1); TS_ASSERT_EQUALS(radius, 0.1);
......
...@@ -141,8 +141,8 @@ public: ...@@ -141,8 +141,8 @@ public:
detail::ShapeInfo::GeometryShape otype; detail::ShapeInfo::GeometryShape otype;
std::vector<V3D> vectors; std::vector<V3D> vectors;
double radius, height; double radius, height, innerRadius;
shape->GetObjectGeom(otype, vectors, radius, height); shape->GetObjectGeom(otype, vectors, innerRadius, radius, height);
TS_ASSERT_EQUALS(otype, detail::ShapeInfo::GeometryShape::CYLINDER); TS_ASSERT_EQUALS(otype, detail::ShapeInfo::GeometryShape::CYLINDER);
TS_ASSERT_EQUALS(radius, 0.1); TS_ASSERT_EQUALS(radius, 0.1);
......
...@@ -135,17 +135,20 @@ public: ...@@ -135,17 +135,20 @@ public:
double radius = 10; double radius = 10;
shapeInfo.setSphere(center, radius); shapeInfo.setSphere(center, radius);
ShapeInfo::GeometryShape tshape; ShapeInfo::GeometryShape testShape;
std::vector<V3D> tpoints; std::vector<V3D> testPoints;
double theight; double testHeight;
double tradius; double testRadius;
double testInnerRadius;
shapeInfo.getObjectGeometry(tshape, tpoints, tradius, theight);
TS_ASSERT_EQUALS(tradius, radius); shapeInfo.getObjectGeometry(testShape, testPoints, testInnerRadius,
TS_ASSERT(theight == 0); testRadius, testHeight);
TS_ASSERT(tpoints.size() == 1); TS_ASSERT_EQUALS(testRadius, radius);
TS_ASSERT_EQUALS(tpoints[0], center); TS_ASSERT_EQUALS(testHeight, 0);
TS_ASSERT_EQUALS(tshape, ShapeInfo::GeometryShape::SPHERE); TS_ASSERT_EQUALS(testInnerRadius, 0);
TS_ASSERT(testPoints.size() == 1);
TS_ASSERT_EQUALS(testPoints[0], center);
TS_ASSERT_EQUALS(testShape, ShapeInfo::GeometryShape::SPHERE);
} }
void testGetObjectGeometryForCylinders() { void testGetObjectGeometryForCylinders() {
...@@ -158,21 +161,21 @@ public: ...@@ -158,21 +161,21 @@ public:
shapeInfo.setHollowCylinder(centreBottomBase, symmetryAxis, innerRadius, shapeInfo.setHollowCylinder(centreBottomBase, symmetryAxis, innerRadius,
outerRadius, height); outerRadius, height);
ShapeInfo::GeometryShape tshape; ShapeInfo::GeometryShape testShape;
std::vector<V3D> tpoints; std::vector<V3D> testPoints;
double theight; double testHeight;
double tinnerRadius; double tinnerRadius;
double touterRadius; double touterRadius;
shapeInfo.getObjectGeometry(tshape, tpoints, tinnerRadius, touterRadius, shapeInfo.getObjectGeometry(testShape, testPoints, tinnerRadius,
theight); touterRadius, testHeight);
TS_ASSERT_EQUALS(tinnerRadius, innerRadius); TS_ASSERT_EQUALS(tinnerRadius, innerRadius);
TS_ASSERT_EQUALS(touterRadius, outerRadius); TS_ASSERT_EQUALS(touterRadius, outerRadius);
TS_ASSERT_EQUALS(theight, height); TS_ASSERT_EQUALS(testHeight, height);
TS_ASSERT(tpoints.size() == 2); TS_ASSERT(testPoints.size() == 2);
TS_ASSERT_EQUALS(tpoints[0], centreBottomBase); TS_ASSERT_EQUALS(testPoints[0], centreBottomBase);
TS_ASSERT_EQUALS(tpoints[1], symmetryAxis); TS_ASSERT_EQUALS(testPoints[1], symmetryAxis);
TS_ASSERT_EQUALS(tshape, ShapeInfo::GeometryShape::HOLLOWCYLINDER); TS_ASSERT_EQUALS(testShape, ShapeInfo::GeometryShape::HOLLOWCYLINDER);
} }
void testCuboidGeometry() { void testCuboidGeometry() {
......