Commit bd792f30 authored by Antti Soininen's avatar Antti Soininen
Browse files

Add convenience access to geometry into ShapeInfo

Re #24636
parent 94c58767
......@@ -8,12 +8,10 @@
#define MANTID_GEOMETRY_SHAPEINFO_H_
#include "MantidGeometry/DllConfig.h"
#include "MantidKernel/V3D.h"
#include <vector>
namespace Mantid {
namespace Kernel {
class V3D;
}
namespace Geometry {
class RectangularDetector;
class StructuredDetector;
......@@ -35,6 +33,38 @@ public:
CYLINDER, ///< CYLINDER
CONE, ///< CONE
};
struct CuboidGeometry {
const Kernel::V3D &leftFrontBottom;
const Kernel::V3D &leftFrontTop;
const Kernel::V3D &leftBackBottom;
const Kernel::V3D &rightFrontBottom;
};
struct HexahedronGeometry {
const Kernel::V3D &leftBackBottom;
const Kernel::V3D &leftFrontBottom;
const Kernel::V3D &rightFrontBottom;
const Kernel::V3D &rightBackBottom;
const Kernel::V3D &leftBackTop;
const Kernel::V3D &leftFrontTop;
const Kernel::V3D &rightFrontTop;
const Kernel::V3D &rightBackTop;
};
struct SphereGeometry {
const Kernel::V3D &centre;
double radius;
};
struct CylinderGeometry {
const Kernel::V3D &centreOfBottomBase;
const Kernel::V3D &axis;
double radius;
double height;
};
struct ConeGeometry {
const Kernel::V3D &centre;
const Kernel::V3D &axis;
double radius;
double height;
};
private:
std::vector<Kernel::V3D> m_points;
......@@ -52,6 +82,11 @@ public:
void getObjectGeometry(GeometryShape &shape, std::vector<Kernel::V3D> &points,
double &radius, double &height) const;
CuboidGeometry cuboidGeometry() const;
HexahedronGeometry hexahedronGeometry() const;
SphereGeometry sphereGeometry() const;
CylinderGeometry cylinderGeometry() const;
ConeGeometry coneGeometry() const;
/// sets the geometry handler for a cuboid
void setCuboid(const Kernel::V3D &, const Kernel::V3D &, const Kernel::V3D &,
const Kernel::V3D &);
......
......@@ -40,42 +40,44 @@
#include <random>
#include <stack>
using namespace Mantid::Geometry;
using namespace Mantid::Kernel;
namespace {
/**
* Return a random point in a cuboid shape.
* @param shapeVectors cuboid's shape vectors
* @param shapeInfo cuboid's shape info
* @param rng a random number generate
* @return a random point inside the cuboid
*/
V3D randomPointInCuboid(const std::vector<V3D> &shapeVectors,
V3D randomPointInCuboid(const detail::ShapeInfo &shapeInfo,
PseudoRandomNumberGenerator &rng) {
const auto geometry = shapeInfo.cuboidGeometry();
const auto r1{rng.nextValue()};
const auto r2{rng.nextValue()};
const auto r3{rng.nextValue()};
const auto basis1{shapeVectors[1] - shapeVectors.front()};
const auto basis2{shapeVectors[2] - shapeVectors.front()};
const auto basis3{shapeVectors[3] - shapeVectors.front()};
return shapeVectors.front() + (basis1 * r1 + basis2 * r2 + basis3 * r3);
const auto basis1{geometry.leftFrontTop - geometry.leftFrontBottom};
const auto basis2{geometry.leftBackBottom - geometry.leftFrontBottom};
const auto basis3{geometry.rightFrontBottom - geometry.leftFrontBottom};
return geometry.leftFrontBottom + (basis1 * r1 + basis2 * r2 + basis3 * r3);
}
/**
* Return a random point constrained within a cuboid and active region.
* @param shapeVectors cuboid's shape vectors
* @param shapeInfo cuboid's shape info
* @param rng a random number generator
* @param activeRegion a restricting bounding box
* @param maxAttempts number of attempts to find the point
* @return a point or none if maxAttempts was exceeded
*/
boost::optional<V3D>
randomPointInCuboid(const std::vector<V3D> &shapeVectors,
randomPointInCuboid(const detail::ShapeInfo &shapeInfo,
PseudoRandomNumberGenerator &rng,
const Mantid::Geometry::BoundingBox &activeRegion,
const size_t maxAttempts) {
boost::optional<V3D> point{boost::none};
for (size_t attempt{0}; attempt < maxAttempts; ++attempt) {
const auto pt{randomPointInCuboid(shapeVectors, rng)};
const auto pt{randomPointInCuboid(shapeInfo, rng)};
if (activeRegion.isPointInside(pt)) {
point = pt;
break;
......@@ -86,43 +88,42 @@ randomPointInCuboid(const std::vector<V3D> &shapeVectors,
/**
* Return a random point in sphere.
* @param shapeVectors sphere's shape vectors
* @param radius radius of the sphere
* @param shapeInfo sphere's shape info
* @param rng a random number generator
* @return a point
*/
V3D randomPointInSphere(const std::vector<V3D> &shapeVectors,
const double radius, PseudoRandomNumberGenerator &rng) {
V3D randomPointInSphere(const detail::ShapeInfo &shapeInfo,
PseudoRandomNumberGenerator &rng) {
const auto geometry = shapeInfo.sphereGeometry();
const auto r1{rng.nextValue()};
const auto r2{rng.nextValue()};
const auto r3{rng.nextValue()};
const auto azimuthal{2. * M_PI * r1};
// The acos is needed for a uniform distribution of points.
const auto polar{std::acos(2. * r2 - 1.)};
const auto r{r3 * radius};
const auto r{r3 * geometry.radius};
const auto x{r * std::cos(azimuthal) * std::sin(polar)};
const auto y{r * std::sin(azimuthal) * std::sin(polar)};
const auto z{r * std::cos(polar)};
return shapeVectors.front() + V3D{x, y, z};
return geometry.centre + V3D{x, y, z};
}
/**
* Return a random number within the intersection of a box and a sphere.
* @param shapeVectors sphere's shape vectors
* @param radius the radius of the sphere
* @param shapeInfo sphere's shape info
* @param rng a random number generator
* @param activeRegion a restricting box
* @param maxAttempts number of attempts to find the point
* @return a point or none if maxAttempts was exceeded
*/
boost::optional<V3D>
randomPointInSphere(const std::vector<V3D> &shapeVectors, const double radius,
randomPointInSphere(const detail::ShapeInfo &shapeInfo,
PseudoRandomNumberGenerator &rng,
const Mantid::Geometry::BoundingBox &activeRegion,
const size_t maxAttempts) {
boost::optional<V3D> point;
for (size_t attempt{0}; attempt < maxAttempts; ++attempt) {
const auto pt{randomPointInSphere(shapeVectors, radius, rng)};
const auto pt{randomPointInSphere(shapeInfo, rng)};
if (activeRegion.isPointInside(pt)) {
point = pt;
break;
......@@ -133,25 +134,23 @@ randomPointInSphere(const std::vector<V3D> &shapeVectors, const double radius,
/**
* Return a random point in cylinder.
* @param shapeVectors cylinder's shape vectors
* @param radius radius of the cylinder
* @param height height of the cylinder
* @param shapeInfo cylinder's shape info
* @param rng a random number generator
* @return a point
*/
V3D randomPointInCylinder(const std::vector<V3D> &shapeVectors,
const double radius, const double height,
V3D randomPointInCylinder(const detail::ShapeInfo &shapeInfo,
PseudoRandomNumberGenerator &rng) {
using boost::math::pow;
const auto geometry = shapeInfo.cylinderGeometry();
const auto r1{rng.nextValue()};
const auto r2{rng.nextValue()};
const auto r3{rng.nextValue()};
const auto polar{2. * M_PI * r1};
// The sqrt is needed for a uniform distribution of points.
const auto r{radius * std::sqrt(r2)};
const auto z{height * r3};
const auto alongAxis{shapeVectors.back() * z};
const V3D &basis1{shapeVectors.back()};
const auto r{geometry.radius * std::sqrt(r2)};
const auto z{geometry.height * r3};
const auto alongAxis{geometry.axis * z};
const V3D &basis1{geometry.axis};
Mantid::Kernel::V3D basis2{1., 0., 0.};
if (basis1.X() != 0. && basis1.Z() != 0) {
const auto inverseXZSumSq = 1. / (pow<2>(basis1.X()) + pow<2>(basis1.Z()));
......@@ -161,27 +160,25 @@ V3D randomPointInCylinder(const std::vector<V3D> &shapeVectors,
const V3D basis3{basis1.cross_prod(basis2)};
const V3D localPoint{
((basis2 * std::cos(polar) + basis3 * std::sin(polar)) * r) + alongAxis};
return shapeVectors.front() + localPoint;
return geometry.centreOfBottomBase + localPoint;
}
/**
* Return a random point in cylinder restricted by a bounding box.
* @param shapeVectors cylinder's shape vectors
* @param radius cylinder radius
* @param height height of the cylinder
* @param shapeInfo cylinder's shape info
* @param rng a random number generator
* @param activeRegion a restricting box
* @param maxAttempts number of attempts
* @return a point or none if maxAttempts was exceeded
*/
boost::optional<V3D>
randomPointInCylinder(const std::vector<V3D> &shapeVectors, const double radius,
const double height, PseudoRandomNumberGenerator &rng,
randomPointInCylinder(const detail::ShapeInfo &shapeInfo,
PseudoRandomNumberGenerator &rng,
const Mantid::Geometry::BoundingBox &activeRegion,
const size_t maxAttempts) {
boost::optional<V3D> point;
for (size_t attempt{0}; attempt < maxAttempts; ++attempt) {
const auto pt{randomPointInCylinder(shapeVectors, radius, height, rng)};
const auto pt{randomPointInCylinder(shapeInfo, rng)};
if (activeRegion.isPointInside(pt)) {
point = pt;
break;
......@@ -2188,20 +2185,15 @@ V3D CSGObject::generatePointInObject(PseudoRandomNumberGenerator &rng,
if (maybePoint) {
point = *maybePoint;
} else {
detail::ShapeInfo::GeometryShape shape;
std::vector<Kernel::V3D> shapeVectors;
double radius;
double height;
GetObjectGeom(shape, shapeVectors, radius, height);
switch (shape) {
switch (shape()) {
case detail::ShapeInfo::GeometryShape::CUBOID:
point = randomPointInCuboid(shapeVectors, rng);
point = randomPointInCuboid(m_handler->shapeInfo(), rng);
break;
case detail::ShapeInfo::GeometryShape::SPHERE:
point = randomPointInSphere(shapeVectors, radius, rng);
point = randomPointInSphere(m_handler->shapeInfo(), rng);
break;
case detail::ShapeInfo::GeometryShape::CYLINDER:
point = randomPointInCylinder(shapeVectors, radius, height, rng);
point = randomPointInCylinder(m_handler->shapeInfo(), rng);
break;
default:
maybePoint = randomPointInNoShapeObject(rng, bbox,
......@@ -2248,15 +2240,16 @@ V3D CSGObject::generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng,
GetObjectGeom(shape, shapeVectors, radius, height);
switch (shape) {
case detail::ShapeInfo::GeometryShape::CUBOID:
point = randomPointInCuboid(shapeVectors, rng, activeRegion, maxAttempts);
point = randomPointInCuboid(m_handler->shapeInfo(), rng, activeRegion,
maxAttempts);
break;
case detail::ShapeInfo::GeometryShape::SPHERE:
point = randomPointInSphere(shapeVectors, radius, rng, activeRegion,
point = randomPointInSphere(m_handler->shapeInfo(), rng, activeRegion,
maxAttempts);
break;
case detail::ShapeInfo::GeometryShape::CYLINDER:
point = randomPointInCylinder(shapeVectors, radius, height, rng,
activeRegion, maxAttempts);
point = randomPointInCylinder(m_handler->shapeInfo(), rng, activeRegion,
maxAttempts);
break;
default:
point = randomPointInNoShapeObject(rng, activeRegion,
......
......@@ -7,6 +7,7 @@
#include "MantidGeometry/Rendering/ShapeInfo.h"
#include "MantidKernel/Tolerance.h"
#include "MantidKernel/V3D.h"
#include <cassert>
#include <cmath>
namespace Mantid {
......@@ -34,6 +35,37 @@ void ShapeInfo::getObjectGeometry(ShapeInfo::GeometryShape &shape,
height = m_height;
}
ShapeInfo::CuboidGeometry ShapeInfo::cuboidGeometry() const {
assert(m_shape == GeometryShape::CUBOID);
CuboidGeometry g{m_points[0], m_points[1], m_points[2], m_points[3]};
return g;
}
ShapeInfo::HexahedronGeometry ShapeInfo::hexahedronGeometry() const {
assert(m_shape == GeometryShape::HEXAHEDRON);
HexahedronGeometry g{m_points[0], m_points[1], m_points[2], m_points[3],
m_points[4], m_points[5], m_points[6], m_points[7]};
return g;
}
ShapeInfo::SphereGeometry ShapeInfo::sphereGeometry() const {
assert(m_shape == GeometryShape::SPHERE);
SphereGeometry g{m_points.front(), m_radius};
return g;
}
ShapeInfo::CylinderGeometry ShapeInfo::cylinderGeometry() const {
assert(m_shape == GeometryShape::CYLINDER);
CylinderGeometry g{m_points.front(), m_points.back(), m_radius, m_height};
return g;
}
ShapeInfo::ConeGeometry ShapeInfo::coneGeometry() const {
assert(m_shape == GeometryShape::CONE);
ConeGeometry g{m_points.front(), m_points.back(), m_radius, m_height};
return g;
}
void ShapeInfo::setCuboid(const V3D &p1, const V3D &p2, const V3D &p3,
const V3D &p4) {
m_shape = GeometryShape::CUBOID;
......
......@@ -12,45 +12,46 @@ using Mantid::Kernel::V3D;
using namespace Mantid::Geometry::detail;
class ShapeInfoTest : public CxxTest::TestSuite {
private:
ShapeInfo m_shapeInfo;
public:
void testConstructEmptyInitiazesEverythingZero() {
TS_ASSERT(m_shapeInfo.points().size() == 0);
TS_ASSERT(m_shapeInfo.height() == 0);
TS_ASSERT(m_shapeInfo.radius() == 0);
TS_ASSERT(m_shapeInfo.shape() == ShapeInfo::GeometryShape::NOSHAPE);
ShapeInfo shapeInfo;
TS_ASSERT(shapeInfo.points().size() == 0);
TS_ASSERT(shapeInfo.height() == 0);
TS_ASSERT(shapeInfo.radius() == 0);
TS_ASSERT(shapeInfo.shape() == ShapeInfo::GeometryShape::NOSHAPE);
}
void testSetSphere() {
ShapeInfo shapeInfo;
V3D center(0, 0, 0);
double radius = 10;
m_shapeInfo.setSphere(center, radius);
shapeInfo.setSphere(center, radius);
TS_ASSERT_EQUALS(m_shapeInfo.shape(), ShapeInfo::GeometryShape::SPHERE);
TS_ASSERT_EQUALS(m_shapeInfo.radius(), radius);
TS_ASSERT_EQUALS(m_shapeInfo.height(), 0);
TS_ASSERT_EQUALS(m_shapeInfo.points().size(), 1);
TS_ASSERT_EQUALS(m_shapeInfo.points()[0], center);
TS_ASSERT_EQUALS(shapeInfo.shape(), ShapeInfo::GeometryShape::SPHERE);
TS_ASSERT_EQUALS(shapeInfo.radius(), radius);
TS_ASSERT_EQUALS(shapeInfo.height(), 0);
TS_ASSERT_EQUALS(shapeInfo.points().size(), 1);
TS_ASSERT_EQUALS(shapeInfo.points()[0], center);
}
void testSetCuboid() {
ShapeInfo shapeInfo;
V3D p1(0, 0, 0);
V3D p2(0, 0, 1);
V3D p3(0, 1, 0);
V3D p4(0, 1, 1);
m_shapeInfo.setCuboid(p1, p2, p3, p4);
shapeInfo.setCuboid(p1, p2, p3, p4);
TS_ASSERT_EQUALS(m_shapeInfo.shape(), ShapeInfo::GeometryShape::CUBOID);
TS_ASSERT_EQUALS(m_shapeInfo.radius(), 0);
TS_ASSERT_EQUALS(m_shapeInfo.height(), 0);
TS_ASSERT_EQUALS(m_shapeInfo.points().size(), 4);
TS_ASSERT_EQUALS(m_shapeInfo.points(), (std::vector<V3D>{p1, p2, p3, p4}));
TS_ASSERT_EQUALS(shapeInfo.shape(), ShapeInfo::GeometryShape::CUBOID);
TS_ASSERT_EQUALS(shapeInfo.radius(), 0);
TS_ASSERT_EQUALS(shapeInfo.height(), 0);
TS_ASSERT_EQUALS(shapeInfo.points().size(), 4);
TS_ASSERT_EQUALS(shapeInfo.points(), (std::vector<V3D>{p1, p2, p3, p4}));
}
void testSetHexahedron() {
ShapeInfo shapeInfo;
V3D p1(0, 0, 0);
V3D p2(0, 0, 1);
V3D p3(0, 1, 0);
......@@ -60,57 +61,60 @@ public:
V3D p7(1, 1, 0);
V3D p8(1, 1, 1);
m_shapeInfo.setHexahedron(p1, p2, p3, p4, p5, p6, p7, p8);
shapeInfo.setHexahedron(p1, p2, p3, p4, p5, p6, p7, p8);
TS_ASSERT_EQUALS(m_shapeInfo.shape(), ShapeInfo::GeometryShape::HEXAHEDRON);
TS_ASSERT_EQUALS(m_shapeInfo.radius(), 0);
TS_ASSERT_EQUALS(m_shapeInfo.height(), 0);
TS_ASSERT_EQUALS(m_shapeInfo.points().size(), 8);
TS_ASSERT_EQUALS(m_shapeInfo.points(),
TS_ASSERT_EQUALS(shapeInfo.shape(), ShapeInfo::GeometryShape::HEXAHEDRON);
TS_ASSERT_EQUALS(shapeInfo.radius(), 0);
TS_ASSERT_EQUALS(shapeInfo.height(), 0);
TS_ASSERT_EQUALS(shapeInfo.points().size(), 8);
TS_ASSERT_EQUALS(shapeInfo.points(),
(std::vector<V3D>{p1, p2, p3, p4, p5, p6, p7, p8}));
}
void testSetCone() {
ShapeInfo shapeInfo;
V3D center(0, 0, 0);
V3D axis(1, 0, 0);
double radius = 10;
double height = 5;
m_shapeInfo.setCone(center, axis, radius, height);
TS_ASSERT_EQUALS(m_shapeInfo.shape(), ShapeInfo::GeometryShape::CONE);
TS_ASSERT_EQUALS(m_shapeInfo.radius(), radius);
TS_ASSERT_EQUALS(m_shapeInfo.height(), height);
TS_ASSERT_EQUALS(m_shapeInfo.points().size(), 2);
TS_ASSERT_EQUALS(m_shapeInfo.points()[0], center);
TS_ASSERT_EQUALS(m_shapeInfo.points()[1], axis);
shapeInfo.setCone(center, axis, radius, height);
TS_ASSERT_EQUALS(shapeInfo.shape(), ShapeInfo::GeometryShape::CONE);
TS_ASSERT_EQUALS(shapeInfo.radius(), radius);
TS_ASSERT_EQUALS(shapeInfo.height(), height);
TS_ASSERT_EQUALS(shapeInfo.points().size(), 2);
TS_ASSERT_EQUALS(shapeInfo.points()[0], center);
TS_ASSERT_EQUALS(shapeInfo.points()[1], axis);
}
void testSetCylinder() {
ShapeInfo shapeInfo;
V3D center(0, 0, 0);
V3D axis(1, 0, 0);
double radius = 10;
double height = 5;
m_shapeInfo.setCylinder(center, axis, radius, height);
TS_ASSERT_EQUALS(m_shapeInfo.shape(), ShapeInfo::GeometryShape::CYLINDER);
TS_ASSERT_EQUALS(m_shapeInfo.radius(), radius);
TS_ASSERT_EQUALS(m_shapeInfo.height(), height);
TS_ASSERT_EQUALS(m_shapeInfo.points().size(), 2);
TS_ASSERT_EQUALS(m_shapeInfo.points()[0], center);
TS_ASSERT_EQUALS(m_shapeInfo.points()[1], axis);
shapeInfo.setCylinder(center, axis, radius, height);
TS_ASSERT_EQUALS(shapeInfo.shape(), ShapeInfo::GeometryShape::CYLINDER);
TS_ASSERT_EQUALS(shapeInfo.radius(), radius);
TS_ASSERT_EQUALS(shapeInfo.height(), height);
TS_ASSERT_EQUALS(shapeInfo.points().size(), 2);
TS_ASSERT_EQUALS(shapeInfo.points()[0], center);
TS_ASSERT_EQUALS(shapeInfo.points()[1], axis);
}
void testGetObjectGeometry() {
ShapeInfo shapeInfo;
V3D center(0, 0, 0);
double radius = 10;
m_shapeInfo.setSphere(center, radius);
shapeInfo.setSphere(center, radius);
ShapeInfo::GeometryShape tshape;
std::vector<V3D> tpoints;
double theight;
double tradius;
m_shapeInfo.getObjectGeometry(tshape, tpoints, tradius, theight);
shapeInfo.getObjectGeometry(tshape, tpoints, tradius, theight);
TS_ASSERT_EQUALS(tradius, radius);
TS_ASSERT(theight == 0);
TS_ASSERT(tpoints.size() == 1);
......@@ -118,27 +122,105 @@ public:
TS_ASSERT_EQUALS(tshape, ShapeInfo::GeometryShape::SPHERE);
}
void testCuboidGeometry() {
ShapeInfo shapeInfo;
const V3D p1(0, 0, 0);
const V3D p2(0, 0, 1);
const V3D p3(0, 1, 0);
const V3D p4(0, 1, 1);
shapeInfo.setCuboid(p1, p2, p3, p4);
const auto geometry = shapeInfo.cuboidGeometry();
TS_ASSERT_EQUALS(geometry.leftFrontBottom, p1)
TS_ASSERT_EQUALS(geometry.leftFrontTop, p2)
TS_ASSERT_EQUALS(geometry.leftBackBottom, p3)
TS_ASSERT_EQUALS(geometry.rightFrontBottom, p4)
}
void testHexahedronGeometry() {
ShapeInfo shapeInfo;
V3D p1(0, 0, 0);
V3D p2(0, 0, 1);
V3D p3(0, 1, 0);
V3D p4(0, 1, 1);
V3D p5(1, 0, 0);
V3D p6(1, 0, 1);
V3D p7(1, 1, 0);
V3D p8(1, 1, 1);
shapeInfo.setHexahedron(p1, p2, p3, p4, p5, p6, p7, p8);
const auto geometry = shapeInfo.hexahedronGeometry();
TS_ASSERT_EQUALS(geometry.leftBackBottom, p1)
TS_ASSERT_EQUALS(geometry.leftFrontBottom, p2)
TS_ASSERT_EQUALS(geometry.rightFrontBottom, p3)
TS_ASSERT_EQUALS(geometry.rightBackBottom, p4)
TS_ASSERT_EQUALS(geometry.leftBackTop, p5)
TS_ASSERT_EQUALS(geometry.leftFrontTop, p6)
TS_ASSERT_EQUALS(geometry.rightFrontTop, p7)
TS_ASSERT_EQUALS(geometry.rightBackTop, p8)
}
void testSphereGeometry() {
ShapeInfo shapeInfo;
const V3D center(0, 0, 0);
constexpr double radius = 10;
shapeInfo.setSphere(center, radius);
const auto geometry = shapeInfo.sphereGeometry();
TS_ASSERT_EQUALS(geometry.centre, center)
TS_ASSERT_EQUALS(geometry.radius, radius)
}
void testCylinderGeometry() {
ShapeInfo shapeInfo;
const V3D center(0, 0, 0);
const V3D axis(1, 0, 0);
constexpr double radius = 10;
constexpr double height = 5;
shapeInfo.setCylinder(center, axis, radius, height);
const auto geometry = shapeInfo.cylinderGeometry();
TS_ASSERT_EQUALS(geometry.centreOfBottomBase, center)
TS_ASSERT_EQUALS(geometry.axis, axis)
TS_ASSERT_EQUALS(geometry.radius, radius)
TS_ASSERT_EQUALS(geometry.height, height)
}
void testConeGeometry() {
ShapeInfo shapeInfo;
const V3D center(0, 0, 0);
const V3D axis(1, 0, 0);
constexpr double radius = 10;
constexpr double height = 5;
shapeInfo.setCone(center, axis, radius, height);
const auto geometry = shapeInfo.coneGeometry();
TS_ASSERT_EQUALS(geometry.centre, center)
TS_ASSERT_EQUALS(geometry.axis, axis)
TS_ASSERT_EQUALS(geometry.radius, radius)
TS_ASSERT_EQUALS(geometry.height, height)
}
void testCopyConstructor() {
ShapeInfo shapeInfo;
V3D center(0, 2, 1);
double radius = 10;
m_shapeInfo.setSphere(center, radius);
shapeInfo.setSphere(center, radius);
ShapeInfo shapeInfoCopy(m_shapeInfo);
ShapeInfo shapeInfoCopy(shapeInfo);
TS_ASSERT_EQUALS(m_shapeInfo.shape(), shapeInfoCopy.shape());
TS_ASSERT_EQUALS(m_shapeInfo.radius(), shapeInfoCopy.radius());
TS_ASSERT_EQUALS(m_shapeInfo.height(), shapeInfoCopy.height());
TS_ASSERT_EQUALS(m_shapeInfo.points(), shapeInfoCopy.points());
TS_ASSERT_EQUALS(shapeInfo.shape(), shapeInfoCopy.shape());
TS_ASSERT_EQUALS(shapeInfo.radius(), shapeInfoCopy.radius());
TS_ASSERT_EQUALS(shapeInfo.height(), shapeInfoCopy.height());
TS_ASSERT_EQUALS(shapeInfo.points(), shapeInfoCopy.points());
}
void testEquality() {
ShapeInfo shapeInfo;
V3D center(0, 2, 1);
double radius = 10;
m_shapeInfo.setSphere(center, radius);
shapeInfo.setSphere(center, radius);