28std::string
cuboidXML(
double xExtent,
double yExtent,
double zExtent,
const V3D ¢erPos) {
31 const double szX = xExtent / 2.0;
32 const double szY = yExtent / 2.0;
33 const double szZ = zExtent / 2.0;
36 V3D leftFrontBottom{szX, -szY, -szZ};
37 V3D leftFrontTop{szX, -szY, szZ};
38 V3D leftBackBottom{-szX, -szY, -szZ};
39 V3D rightFrontBottom{szX, szY, -szZ};
42 leftFrontBottom += centerPos;
43 leftFrontTop += centerPos;
44 leftBackBottom += centerPos;
45 rightFrontBottom += centerPos;
47 std::ostringstream xmlShapeStream;
48 xmlShapeStream <<
" <cuboid id=\"gauge-volume\"> "
49 <<
"<left-front-bottom-point x=\"" << leftFrontBottom.X() <<
"\" y=\"" << leftFrontBottom.Y()
50 <<
"\" z=\"" << leftFrontBottom.Z() <<
"\" /> "
51 <<
"<left-front-top-point x=\"" << leftFrontTop.X() <<
"\" y=\"" << leftFrontTop.Y() <<
"\" z=\""
52 << leftFrontTop.Z() <<
"\" /> "
53 <<
"<left-back-bottom-point x=\"" << leftBackBottom.X() <<
"\" y=\"" << leftBackBottom.Y()
54 <<
"\" z=\"" << leftBackBottom.Z() <<
"\" /> "
55 <<
"<right-front-bottom-point x=\"" << rightFrontBottom.X() <<
"\" y=\"" << rightFrontBottom.Y()
56 <<
"\" z=\"" << rightFrontBottom.Z() <<
"\" /> "
59 return xmlShapeStream.str();
83 }
catch (
const std::invalid_argument &) {
91 return std::shared_ptr<Geometry::IObject>(sample.
clone());
94 double yExtent = intersectionBox.
yMax() - intersectionBox.
yMin();
95 double xExtent = intersectionBox.
xMax() - intersectionBox.
xMin();
96 double zExtent = intersectionBox.
zMax() - intersectionBox.
zMin();
98 std::string shapeXML = cuboidXML(xExtent, yExtent, zExtent, intersectionBox.
centrePoint());
virtual Geometry::BoundingBox defineActiveRegion(const Geometry::BoundingBox &) const =0
Geometry::IObject_sptr getIntersectionWithSample(const Geometry::IObject &sample) const
Get the intersection of the beam with the sample.
A simple structure that defines an axis-aligned cuboid shaped bounding box for a geometrical object.
double xMax() const
Return the maximum value of X.
double zMin() const
Return the minimum value of Z.
const Kernel::V3D & minPoint() const
Returns the min point of the box.
double zMax() const
Return the maximum value of Z.
double yMax() const
Return the maximum value of Y.
double xMin() const
Return the minimum value of X.
Kernel::V3D centrePoint() const
Returns the centre of the bounding box.
double yMin() const
Return the minimum value of Y.
const Kernel::V3D & maxPoint() const
Returns the min point of the box.
IObject : Interface for geometry objects.
virtual const BoundingBox & getBoundingBox() const =0
Return cached value of axis-aligned bounding box.
virtual IObject * clone() const =0
Class originally intended to be used with the DataHandling 'LoadInstrument' algorithm.
std::shared_ptr< CSGObject > createShape(Poco::XML::Element *pElem)
Creates a geometric object from a DOM-element-node pointing to an element whose child nodes contain t...
std::string cuboidXML(double xHalfLength, double yHalfLength=-1.0, double zHalfLength=-1.0, const Mantid::Kernel::V3D ¢re={0.0, 0.0, 0.0}, const std::string &id="detector-shape")
std::shared_ptr< IObject > IObject_sptr
Typdef for a shared pointer.
Helper class which provides the Collimation Length for SANS instruments.