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

Impliments a line. More...

#include <Line.h>

Public Types

using PType = boost::container::small_vector< Kernel::V3D, 5 >
 

Public Member Functions

Lineclone () const
 Virtual copy constructor (not currently used) More...
 
void displace (const Kernel::V3D &)
 Apply a displacement Pt. More...
 
double distance (const Kernel::V3D &) const
 distance from line More...
 
const Kernel::V3DgetDirect () const
 returns the direction More...
 
const Kernel::V3DgetOrigin () const
 returns the origin More...
 
Kernel::V3D getPoint (const double lambda) const
 gets the point O+lam*N More...
 
int intersect (PType &, const Cylinder &) const
 For the line that intersects the cylinder generate add the point to the VecOut, return number of points added. More...
 
int intersect (PType &, const Plane &) const
 For the line that intersects the cylinder generate add the point to the VecOut, return number of points added. More...
 
int intersect (PType &, const Quadratic &) const
 For the line that intersects the surfaces add the point(s) to the VecOut, return number of points added. More...
 
int intersect (PType &, const Sphere &) const
 For the line that intersects the cylinder generate add the point to the VecOut, return number of points added. More...
 
int isValid (const Kernel::V3D &) const
 Is the point on the line. More...
 
 Line ()
 Constructor. More...
 
 Line (const Kernel::V3D &, const Kernel::V3D &)
 Constructor. More...
 
void print () const
 Print statement for debugging. More...
 
void rotate (const Kernel::Matrix< double > &)
 Applies the rotation matrix to the object. More...
 
int setLine (const Kernel::V3D &, const Kernel::V3D &)
 input Origin + direction More...
 

Private Member Functions

int lambdaPair (const int ix, const std::pair< std::complex< double >, std::complex< double > > &SQ, PType &PntOut) const
 Helper function to decide which roots to take. More...
 

Private Attributes

Kernel::V3D m_direction
 Direction of outer surface (Unit Vector) More...
 
Kernel::V3D m_origin
 Orign point (on plane) More...
 

Detailed Description

Impliments a line.

Author
S. Ansell
Date
Apr 2005
Version
0.7

Impliments the line

\[ r=\vec{O} + \lambda \vec{n} \]

ChangeLog: 22.04.2008: Sri, Missing MANTID_GEOMETRY_DLL and Destructor was virtual it's changed to normal destructor

Definition at line 43 of file Line.h.

Member Typedef Documentation

◆ PType

using Mantid::Geometry::Line::PType = boost::container::small_vector<Kernel::V3D, 5>

Definition at line 45 of file Line.h.

Constructor & Destructor Documentation

◆ Line() [1/2]

Mantid::Geometry::Line::Line ( )

Constructor.

Definition at line 26 of file Line.cpp.

Referenced by clone().

◆ Line() [2/2]

Mantid::Geometry::Line::Line ( const Kernel::V3D O,
const Kernel::V3D D 
)

Constructor.

Definition at line 33 of file Line.cpp.

Member Function Documentation

◆ clone()

Line * Mantid::Geometry::Line::clone ( ) const

Virtual copy constructor (not currently used)

Returns
the cloned line

Definition at line 40 of file Line.cpp.

References Line().

◆ displace()

void Mantid::Geometry::Line::displace ( const Kernel::V3D Pt)

Apply a displacement Pt.

Parameters
Pt:: Point value of the displacement

Definition at line 96 of file Line.cpp.

References m_origin.

◆ distance()

double Mantid::Geometry::Line::distance ( const Kernel::V3D A) const

distance from line

Distance of a point from the line.

Parameters
A:: test Point
Returns
absolute distance (not signed)

Definition at line 59 of file Line.cpp.

References lambda.

◆ getDirect()

const Kernel::V3D & Mantid::Geometry::Line::getDirect ( ) const
inline

returns the direction

Definition at line 53 of file Line.h.

Referenced by Mantid::Geometry::LineIntersectVisit::sortAndRemoveDuplicates().

◆ getOrigin()

const Kernel::V3D & Mantid::Geometry::Line::getOrigin ( ) const
inline

◆ getPoint()

Kernel::V3D Mantid::Geometry::Line::getPoint ( const double  lambda) const

gets the point O+lam*N

Return the point on the line given lambda*direction.

Parameters
lambda:: line position scalar
Returns
\( \vec{O}+ \lambda \vec{D} \)

Definition at line 49 of file Line.cpp.

References lambda.

◆ intersect() [1/4]

int Mantid::Geometry::Line::intersect ( PType PntOut,
const Cylinder cylinder 
) const

For the line that intersects the cylinder generate add the point to the VecOut, return number of points added.

It does not check the points for validity.

Parameters
PntOut:: Vector of points found by the line/cylinder intersection
cylinder:: Cylinder to intersect line with
Returns
Number of points found by intersection

Definition at line 200 of file Line.cpp.

References Mantid::Kernel::V3D::norm2(), radius, Mantid::Kernel::V3D::scalar_prod(), and Mantid::solveQuadratic().

◆ intersect() [2/4]

int Mantid::Geometry::Line::intersect ( PType PntOut,
const Plane Pln 
) const

For the line that intersects the cylinder generate add the point to the VecOut, return number of points added.

It does not check the points for validity.

Parameters
PntOut:: Vector of points found by the line/cylinder intersection
Pln:: Plane for intersect
Returns
Number of points found by intersection

Definition at line 177 of file Line.cpp.

References fabs, and Mantid::Kernel::Tolerance.

◆ intersect() [3/4]

int Mantid::Geometry::Line::intersect ( PType VecOut,
const Quadratic Sur 
) const

For the line that intersects the surfaces add the point(s) to the VecOut, return number of points added.

It does not check the points for validity.

Parameters
VecOut:: intersection points of the line and surface
Sur:: Surface to intersect with a line
Returns
Number of points found.

Definition at line 152 of file Line.cpp.

References Mantid::Geometry::d, and Mantid::solveQuadratic().

Referenced by Mantid::Geometry::LineIntersectVisit::Accept().

◆ intersect() [4/4]

int Mantid::Geometry::Line::intersect ( PType PntOut,
const Sphere Sph 
) const

For the line that intersects the cylinder generate add the point to the VecOut, return number of points added.

It does not check the points for validity.

Parameters
PntOut:: Vector of points found by the line/sphere intersection
Sph:: Sphere to intersect line with
Returns
Number of points found by intersection

Definition at line 234 of file Line.cpp.

References Mantid::Kernel::V3D::scalar_prod(), and Mantid::solveQuadratic().

◆ isValid()

int Mantid::Geometry::Line::isValid ( const Kernel::V3D A) const

Is the point on the line.

Calculate is point is on line by using distance to determine if the point is within Tolerance of the line.

Parameters
A:: Point to test
Return values
1: the point is on the line
0: Point is not on the line

Definition at line 72 of file Line.cpp.

References Mantid::Kernel::Tolerance.

◆ lambdaPair()

int Mantid::Geometry::Line::lambdaPair ( const int  ix,
const std::pair< std::complex< double >, std::complex< double > > &  SQ,
PType PntOut 
) const
private

Helper function to decide which roots to take.

The assumption is that lambda has been solved by quadratic equation and we require the points that correspond to these values. Note: have changed this so that only positive roots are returned. This makes the quadratic solutions consistent with the ones returned when asking if a line hits a plane. It is not clear if some other use cases exist.

Parameters
ix: number of solutions in SQ (0,1,2)
SQ: solutions to lambda (the distance along the line
PntOut: Output vector of points (added to)
Returns
Number of real unique points found.

Definition at line 105 of file Line.cpp.

References lambda, and Mantid::Kernel::Tolerance.

◆ print()

void Mantid::Geometry::Line::print ( ) const

Print statement for debugging.

Definition at line 276 of file Line.cpp.

References m_direction, and m_origin.

◆ rotate()

void Mantid::Geometry::Line::rotate ( const Kernel::Matrix< double > &  MA)

Applies the rotation matrix to the object.

Parameters
MA:: Rotation Matrix

Definition at line 84 of file Line.cpp.

References m_direction, m_origin, Mantid::Kernel::V3D::normalize(), and Mantid::Kernel::V3D::rotate().

◆ setLine()

int Mantid::Geometry::Line::setLine ( const Kernel::V3D O,
const Kernel::V3D D 
)

input Origin + direction

sets the line given the Origne and direction

Parameters
O:: origin
D:: direction
Return values
0:: Direction == 0 ie no line
1:: on success

Definition at line 260 of file Line.cpp.

References m_direction, m_origin, Mantid::Kernel::normalize(), and Mantid::Kernel::V3D::nullVector().

Referenced by Mantid::Geometry::Track::reset().

Member Data Documentation

◆ m_direction

Kernel::V3D Mantid::Geometry::Line::m_direction
private

Direction of outer surface (Unit Vector)

Definition at line 71 of file Line.h.

Referenced by print(), rotate(), and setLine().

◆ m_origin

Kernel::V3D Mantid::Geometry::Line::m_origin
private

Orign point (on plane)

Definition at line 70 of file Line.h.

Referenced by displace(), print(), rotate(), and setLine().


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