12#include "MantidGeometry/DllConfig.h"
18#include <boost/container/small_vector.hpp>
39struct MANTID_GEOMETRY_DLL
Link {
51 : entryPoint(entry), exitPoint(exit), distFromStart(totalDistance),
52 distInsideObject(entryPoint.distance(exitPoint)), object(&
obj), componentID(compID) {}
54 inline bool operator<(
const Link &other)
const {
return distFromStart < other.distFromStart; }
56 inline bool operator<(
const double &other)
const {
return distFromStart < other; }
59 if (componentID != other.componentID) {
63 if (
object != other.object) {
72 bool isExitSame = !(std::abs(exitPoint[0] - other.exitPoint[0]) >
tolerance ||
73 std::abs(exitPoint[1] - other.exitPoint[1]) >
tolerance ||
74 std::abs(exitPoint[2] - other.exitPoint[2]) >
tolerance);
75 return isExitSame && (entryPoint == other.entryPoint);
94 return static_cast<int>(
left) <
static_cast<int>(
right);
167 using LType = boost::container::small_vector<Link, 5>;
168 using PType = boost::container::small_vector<IntersectionPoint, 5>;
180 int addLink(
const Kernel::V3D &firstPoint,
const Kernel::V3D &secondPoint,
const double distanceAlongTrack,
183 void removeCojoins();
189 void clearIntersectionResults();
195 double totalDistInsideObject()
const;
197 LType::iterator
begin() {
return m_links.begin(); }
199 LType::iterator
end() {
return m_links.end(); }
201 LType::const_iterator
begin()
const {
return m_links.begin(); }
204 LType::const_iterator
end()
const {
return m_links.end(); }
206 LType::const_iterator
cbegin()
const {
return m_links.cbegin(); }
209 LType::const_iterator
cend()
const {
return m_links.cend(); }
211 LType::reference
front() {
return m_links.front(); }
213 LType::reference
back() {
return m_links.back(); }
215 LType::const_reference
front()
const {
return m_links.front(); }
217 LType::const_reference
back()
const {
return m_links.back(); }
219 int count()
const {
return static_cast<int>(m_links.size()); }
223 int nonComplete()
const;
225 virtual double calculateAttenuation(
double lambda)
const;
const std::vector< double > * lambda
double obj
the value of the quadratic function
base class for Geometric IComponent
IObject : Interface for geometry objects.
Defines a track as a start point and a direction.
LType::reference front()
Returns a reference to the first link.
const Kernel::V3D & startPoint() const
Returns the starting point.
LType::iterator end()
Returns an interator to one-past-the-end of the set of links.
PType m_surfPoints
Intersection points.
LType::const_iterator begin() const
Returns an interator to the start of the set of links (const version)
boost::container::small_vector< Link, 5 > LType
LType::const_reference back() const
Returns a reference to the last link (const version)
int surfPointsCount() const
Returns the number of intersection points.
LType::const_reference front() const
Returns a reference to the first link (const version)
boost::container::small_vector< IntersectionPoint, 5 > PType
LType::reference back()
Returns a reference to the last link.
int count() const
Returns the number of links.
const Kernel::V3D & direction() const
Returns the direction as a unit vector.
LType::const_iterator end() const
Returns an interator to one-past-the-end of the set of links (const version)
LType::const_iterator cbegin() const
Returns an interator to the start of the set of links (const version)
LType m_links
Track units.
LType::const_iterator cend() const
Returns an interator to one-past-the-end of the set of links (const version)
Line m_line
Line object containing origin and direction.
LType::iterator begin()
Returns an interator to the start of the set of links.
MANTID_GEOMETRY_DLL std::ostream & operator<<(std::ostream &stream, const PointGroup &self)
Returns a streamed representation of the PointGroup object.
bool operator<(const TrackDirection left, const TrackDirection right)
constexpr double Tolerance
Standard tolerance value.
Helper class which provides the Collimation Length for SANS instruments.
Stores a point of intersection along a track.
TrackDirection direction
Directional flag.
Kernel::V3D endPoint
Point.
double distFromStart
Total distance from track begin.
ComponentID componentID
Unique component ID.
const IObject * object
The object that was intersected.
bool operator<(const IntersectionPoint &other) const
A IntersectionPoint is less-than another if either (a) the difference in distances is greater than th...
bool operator==(const IntersectionPoint &other) const
IntersectionPoint(const TrackDirection direction, const Kernel::V3D &end, const double distFromStartOfTrack, const IObject &obj, const ComponentID compID=nullptr)
Constuctor.
const IObject * object
The object that was intersected.
Kernel::V3D entryPoint
Entry point.
Link(const Kernel::V3D &entry, const Kernel::V3D &exit, const double totalDistance, const IObject &obj, const ComponentID compID=nullptr)
Constuctor.
double distInsideObject
Total distance covered inside object.
bool operator==(const Link &other) const
bool operator<(const double &other) const
Less than operator.
bool operator<(const Link &other) const
Less than operator.
Kernel::V3D exitPoint
Exit point.
double distFromStart
Total distance from track beginning.
ComponentID componentID
ComponentID of the intersected component.