Mantid
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
Mantid::Geometry::Track Class Reference

Defines a track as a start point and a direction. More...

#include <Track.h>

Public Types

using LType = boost::container::small_vector< Link, 5 >
 
using PType = boost::container::small_vector< IntersectionPoint, 5 >
 

Public Member Functions

int addLink (const Kernel::V3D &firstPoint, const Kernel::V3D &secondPoint, const double distanceAlongTrack, const IObject &obj, const ComponentID compID=nullptr)
 Adds a link to the track. More...
 
void addPoint (const TrackDirection direction, const Kernel::V3D &endPoint, const IObject &obj, const ComponentID compID=nullptr)
 Adds a point of intersection to the track. More...
 
LType::reference back ()
 Returns a reference to the last link. More...
 
LType::const_reference back () const
 Returns a reference to the last link (const version) More...
 
LType::iterator begin ()
 Returns an interator to the start of the set of links. More...
 
LType::const_iterator begin () const
 Returns an interator to the start of the set of links (const version) More...
 
void buildLink ()
 Construct links between added points. More...
 
virtual double calculateAttenuation (double lambda) const
 Calculate attenuation across all links. More...
 
LType::const_iterator cbegin () const
 Returns an interator to the start of the set of links (const version) More...
 
LType::const_iterator cend () const
 Returns an interator to one-past-the-end of the set of links (const version) More...
 
void clearIntersectionResults ()
 Clear the current set of intersection results. More...
 
int count () const
 Returns the number of links. More...
 
const Kernel::V3Ddirection () const
 Returns the direction as a unit vector. More...
 
LType::iterator end ()
 Returns an interator to one-past-the-end of the set of links. More...
 
LType::const_iterator end () const
 Returns an interator to one-past-the-end of the set of links (const version) More...
 
LType::reference front ()
 Returns a reference to the first link. More...
 
LType::const_reference front () const
 Returns a reference to the first link (const version) More...
 
int nonComplete () const
 Is the link complete? More...
 
void removeCojoins ()
 Remove touching Links that have identical components. More...
 
void reset (const Kernel::V3D &startPoint, const Kernel::V3D &direction)
 Set a starting point and direction. More...
 
const Kernel::V3DstartPoint () const
 Returns the starting point. More...
 
int surfPointsCount () const
 Returns the number of intersection points. More...
 
double totalDistInsideObject () const
 Returns the sum of all the links distInsideObject in the track. More...
 
 Track ()
 Default constructor. More...
 
 Track (const Kernel::V3D &startPt, const Kernel::V3D &unitVector)
 Constructor. More...
 
virtual ~Track ()=default
 

Private Attributes

Line m_line
 Line object containing origin and direction. More...
 
LType m_links
 Track units. More...
 
PType m_surfPoints
 Intersection points. More...
 

Detailed Description

Defines a track as a start point and a direction.

Intersections are stored as ordered lists of links from the start point to the exit point.

Author
S. Ansell

Definition at line 165 of file Track.h.

Member Typedef Documentation

◆ LType

using Mantid::Geometry::Track::LType = boost::container::small_vector<Link, 5>

Definition at line 167 of file Track.h.

◆ PType

using Mantid::Geometry::Track::PType = boost::container::small_vector<IntersectionPoint, 5>

Definition at line 168 of file Track.h.

Constructor & Destructor Documentation

◆ Track() [1/2]

Mantid::Geometry::Track::Track ( )

Default constructor.

Definition at line 25 of file Track.cpp.

◆ Track() [2/2]

Mantid::Geometry::Track::Track ( const Kernel::V3D startPt,
const Kernel::V3D unitVector 
)

Constructor.

Parameters
startPt:: Initial point
unitVector:: Directional vector. It must be unit vector.

Definition at line 32 of file Track.cpp.

References m_links, m_surfPoints, and Mantid::Kernel::V3D::unitVector().

◆ ~Track()

virtual Mantid::Geometry::Track::~Track ( )
virtualdefault

Member Function Documentation

◆ addLink()

int Mantid::Geometry::Track::addLink ( const Kernel::V3D firstPoint,
const Kernel::V3D secondPoint,
const double  distanceAlongTrack,
const IObject obj,
const ComponentID  compID = nullptr 
)

Adds a link to the track.

This adds a whole segment to the track : This currently assumes that links are added in order.

Parameters
firstPoint:: first Point
secondPoint:: second Point
distanceAlongTrack:: Distance along track
obj:: A reference to the object that was intersected
compID:: ID of the component that this link is about (Default=NULL)
Return values
Indexof link within the track

Definition at line 152 of file Track.cpp.

References index, m_links, and obj.

Referenced by buildLink(), Mantid::Geometry::ObjComponent::interceptSurface(), Mantid::Geometry::GridDetector::testIntersectionWithChildren(), and Mantid::Geometry::RectangularDetector::testIntersectionWithChildren().

◆ addPoint()

void Mantid::Geometry::Track::addPoint ( const TrackDirection  direction,
const Kernel::V3D endPoint,
const IObject obj,
const ComponentID  compID = nullptr 
)

Adds a point of intersection to the track.

Objective is to merge in partial information about the beginning and end of the tracks.

The points are kept in order

Parameters
direction:: A flag indicating if the direction of travel is entering/leaving an object. +1 is entering, -1 is leaving.
endPoint:: Point of intersection
obj:: A reference to the object that was intersected
compID:: ID of the component that this link is about (Default=NULL)

Definition at line 124 of file Track.cpp.

References direction(), Mantid::Kernel::V3D::distance(), Mantid::Geometry::Line::getOrigin(), m_line, m_surfPoints, and obj.

Referenced by Mantid::Geometry::MeshObject::interceptSurface(), Mantid::Geometry::CSGObject::interceptSurface(), and Mantid::Geometry::MeshObject2D::interceptSurface().

◆ back() [1/2]

LType::reference Mantid::Geometry::Track::back ( )
inline

Returns a reference to the last link.

Definition at line 213 of file Track.h.

Referenced by Mantid::Crystal::PredictPeaks::calculateQAndAddToOutput().

◆ back() [2/2]

LType::const_reference Mantid::Geometry::Track::back ( ) const
inline

Returns a reference to the last link (const version)

Definition at line 217 of file Track.h.

◆ begin() [1/2]

LType::iterator Mantid::Geometry::Track::begin ( )
inline

Returns an interator to the start of the set of links.

Definition at line 197 of file Track.h.

◆ begin() [2/2]

LType::const_iterator Mantid::Geometry::Track::begin ( ) const
inline

Returns an interator to the start of the set of links (const version)

Definition at line 201 of file Track.h.

◆ buildLink()

void Mantid::Geometry::Track::buildLink ( )

Construct links between added points.

Builds a set of linking track components.

This version deals with touching surfaces

Definition at line 184 of file Track.cpp.

References addLink(), Mantid::Geometry::ENTERING, fabs, Mantid::Geometry::Line::getOrigin(), Mantid::Geometry::LEAVING, m_line, m_surfPoints, and Mantid::Kernel::Tolerance.

Referenced by Mantid::Geometry::MeshObject::interceptSurface(), Mantid::Geometry::CSGObject::interceptSurface(), and Mantid::Geometry::MeshObject2D::interceptSurface().

◆ calculateAttenuation()

double Mantid::Geometry::Track::calculateAttenuation ( double  lambda) const
virtual

Calculate attenuation across all links.

Definition at line 276 of file Track.cpp.

References lambda, and m_links.

Referenced by Mantid::Algorithms::AddAbsorptionWeightedPathLengths::exec().

◆ cbegin()

LType::const_iterator Mantid::Geometry::Track::cbegin ( ) const
inline

◆ cend()

LType::const_iterator Mantid::Geometry::Track::cend ( ) const
inline

Returns an interator to one-past-the-end of the set of links (const version)

Definition at line 209 of file Track.h.

Referenced by Mantid::Geometry::InstrumentRayTracer::getResults(), Mantid::Geometry::ObjComponent::interceptSurface(), and Mantid::Algorithms::DiscusMultipleScatteringCorrection::updateWeightAndPosition().

◆ clearIntersectionResults()

void Mantid::Geometry::Track::clearIntersectionResults ( )

◆ count()

int Mantid::Geometry::Track::count ( ) const
inline

◆ direction()

const Kernel::V3D & Mantid::Geometry::Track::direction ( ) const
inline

◆ end() [1/2]

LType::iterator Mantid::Geometry::Track::end ( )
inline

Returns an interator to one-past-the-end of the set of links.

Definition at line 199 of file Track.h.

◆ end() [2/2]

LType::const_iterator Mantid::Geometry::Track::end ( ) const
inline

Returns an interator to one-past-the-end of the set of links (const version)

Definition at line 204 of file Track.h.

◆ front() [1/2]

LType::reference Mantid::Geometry::Track::front ( )
inline

Returns a reference to the first link.

Definition at line 211 of file Track.h.

Referenced by Mantid::Algorithms::DiscusMultipleScatteringCorrection::inc_xyz(), and Mantid::DataHandling::Mantid3MFFileIO::writeMeshObject().

◆ front() [2/2]

LType::const_reference Mantid::Geometry::Track::front ( ) const
inline

Returns a reference to the first link (const version)

Definition at line 215 of file Track.h.

◆ nonComplete()

int Mantid::Geometry::Track::nonComplete ( ) const

Is the link complete?

Determines if the track is complete.

Return values
0:: Complete from Init to end without gaps
+ve:: Index number of incomplete segment +1

Definition at line 65 of file Track.cpp.

References Mantid::Kernel::V3D::distance(), Mantid::Geometry::Line::getOrigin(), m_line, m_links, and Mantid::Kernel::Tolerance.

◆ removeCojoins()

void Mantid::Geometry::Track::removeCojoins ( )

Remove touching Links that have identical components.

Remove touching links that have identical components.

Definition at line 91 of file Track.cpp.

References m_links.

◆ reset()

void Mantid::Geometry::Track::reset ( const Kernel::V3D startPoint,
const Kernel::V3D direction 
)

◆ startPoint()

const Kernel::V3D & Mantid::Geometry::Track::startPoint ( ) const
inline

◆ surfPointsCount()

int Mantid::Geometry::Track::surfPointsCount ( ) const
inline

Returns the number of intersection points.

Definition at line 221 of file Track.h.

◆ totalDistInsideObject()

double Mantid::Geometry::Track::totalDistInsideObject ( ) const

Returns the sum of all the links distInsideObject in the track.

Sums each link's distance inside an object to get a total interior distance for the track.

This is needed when there are multiple intersection points through an object.

Returns
Sum of all links distInsideObject

Definition at line 254 of file Track.cpp.

References m_links.

Referenced by Mantid::Algorithms::AbsorptionCorrection::calculateDistances(), Mantid::Algorithms::PaalmanPingsAbsorptionCorrection::calculateDistances(), and Mantid::Algorithms::PaalmanPingsAbsorptionCorrection::initialiseCachedDistances().

Member Data Documentation

◆ m_line

Line Mantid::Geometry::Track::m_line
private

Line object containing origin and direction.

Definition at line 228 of file Track.h.

Referenced by addPoint(), buildLink(), nonComplete(), and reset().

◆ m_links

LType Mantid::Geometry::Track::m_links
private

◆ m_surfPoints

PType Mantid::Geometry::Track::m_surfPoints
private

Intersection points.

Definition at line 230 of file Track.h.

Referenced by addPoint(), buildLink(), clearIntersectionResults(), and Track().


The documentation for this class was generated from the following files: