37 std::ostringstream lexer;
38 lexer <<
"Cannot create a InstrumentRayTracer, invalid instrument given. "
41 throw std::invalid_argument(lexer.str());
44 std::string errorMsg =
"Cannot create InstrumentRayTracer, instrument has "
45 "no defined source.\n";
46 throw std::invalid_argument(errorMsg);
101 Links::const_iterator resultItr = results.begin();
102 for (; resultItr != results.end(); ++resultItr) {
128 std::deque<IComponent_const_sptr> nodeQueue;
134 while (!nodeQueue.empty()) {
135 node = nodeQueue.front();
136 nodeQueue.pop_front();
138 auto it =
m_boxCache.find(node->getComponentID());
142 node->getBoundingBox(bbox);
143 std::lock_guard<std::mutex> lock(
m_mutex);
150 assembly->testIntersectionWithChildren(testRay, nodeQueue);
A simple structure that defines an axis-aligned cuboid shaped bounding box for a geometrical object.
bool doesLineIntersect(const Track &track) const
Does a specified track intersect the bounding box.
Links getResults() const
Get the results of the intersection tests that have been updated since the previous call to trace.
Track m_resultsTrack
Accumulate results in this Track object, aids performance.
Instrument_const_sptr m_instrument
Pointer to the instrument.
IDetector_const_sptr getDetectorResult() const
Gets the results of the trace, then returns the first detector (that is NOT a monitor) found in the r...
void traceFromSample(const Kernel::V3D &dir) const
Trace a given track from the sample position in the given direction.
boost::unordered_map< IComponent *, BoundingBox > m_boxCache
Map of component id -> bounding box.
InstrumentRayTracer()
Default constructor.
std::mutex m_mutex
Mutex to lock box cache.
void trace(const Kernel::V3D &dir) const
Trace a given track from the instrument source in the given direction and compile a list of results t...
void fireRay(Track &testRay) const
Fire the given track at the instrument.
Defines a track as a start point and a direction.
void clearIntersectionResults()
Clear the current set of intersection results.
LType::const_iterator cbegin() const
Returns an interator to the start of the set of links (const version)
LType::const_iterator cend() const
Returns an interator to one-past-the-end of the set of links (const version)
void reset(const Kernel::V3D &startPoint, const Kernel::V3D &direction)
Set a starting point and direction.
Marks code as not implemented yet.
std::shared_ptr< const ICompAssembly > ICompAssembly_const_sptr
Shared pointer to a const ICompAssembly.
std::shared_ptr< const IComponent > IComponent_const_sptr
Typdef of a shared pointer to a const IComponent.
std::shared_ptr< const Mantid::Geometry::IDetector > IDetector_const_sptr
Shared pointer to IDetector (const version)
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.
Track::LType Links
Typedef for object intersections.