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

Holds a torus in vector form. More...

#include <Torus.h>

Inheritance diagram for Mantid::Geometry::Torus:
Mantid::Geometry::Surface

Public Member Functions

void acceptVisitor (BaseVisit &A) const override
 Accept visitor for line calculation. More...
 
std::string className () const override
 Public identifier. More...
 
std::unique_ptr< Torusclone () const
 Makes a clone (implicit virtual copy constructor) More...
 
double distance (const Kernel::V3D &Pt) const override
 Calculates the distance from the point to the Torus does not calculate the point on the Torus that is closest. More...
 
void getBoundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) override
 SGenerates a bounding box for the Torus. More...
 
Kernel::V3D getCentre () const
 Return centre point. More...
 
Kernel::V3D getNormal () const
 Central normal. More...
 
bool onSurface (const Kernel::V3D &R) const override
 is point valid on surface More...
 
int operator== (const Torus &) const
 Equality operator. More...
 
void setCentre (const Kernel::V3D &A)
 Sets the central point and the Base Equation. More...
 
void setDistanceFromCentreToTube (double dist)
 Suppose to set the distance from centre of the torus to the centre of tube. More...
 
void setNorm (const Kernel::V3D &A)
 Sets the Normal and the Base Equation. More...
 
int setSurface (const std::string &Pstr) override
 Processes a standard MCNPX cone string Recall that cones can only be specified on an axis Valid input is: More...
 
void setTubeRadius (double dist)
 Suppose to set the radius of the tube which makes up the torus TODO: More...
 
int side (const Kernel::V3D &R) const override
 Calculate if the point R is within the torus (return -1) or outside, (return 1) More...
 
Kernel::V3D surfaceNormal (const Kernel::V3D &Pt) const override
 Get the normal at a point. More...
 
 Torus ()
 Constructor with centre line along X axis and centre on origin. More...
 
void write (std::ostream &OX) const override
 Write out the cone class in an mcnpx format. More...
 
- Public Member Functions inherited from Mantid::Geometry::Surface
virtual void acceptVisitor (BaseVisit &A) const
 Accept visitor for line calculation. More...
 
virtual std::string className () const
 Effective typeid. More...
 
std::unique_ptr< Surfaceclone () const
 
virtual void displace (const Kernel::V3D &)=0
 translates the surface More...
 
virtual double distance (const Kernel::V3D &) const =0
 returns the minimum distance to the surface More...
 
virtual void getBoundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin)=0
 bounding box for the surface More...
 
int getName () const
 Get Name. More...
 
virtual bool onSurface (const Kernel::V3D &R) const =0
 is point valid on surface More...
 
Surfaceoperator= (const Surface &)=delete
 
virtual void print () const
 Simple print out function for surface header. More...
 
virtual void rotate (const Kernel::Matrix< double > &)=0
 rotates the surface More...
 
void setName (int const N)
 Set Name. More...
 
virtual int setSurface (const std::string &R)=0
 Sets the surface based on a string input in MCNPX format. More...
 
virtual int side (const Kernel::V3D &) const
 Surface side : throw AbsObjMethod. More...
 
 Surface ()
 Constructor. More...
 
virtual Kernel::V3D surfaceNormal (const Kernel::V3D &) const =0
 returns the normal to the closest point on the surface More...
 
virtual void write (std::ostream &) const
 The writes the data to the output stream. More...
 
void writeHeader (std::ostream &) const
 Writes out the start of an MCNPX surface description . More...
 
virtual ~Surface ()=default
 

Protected Member Functions

Torusoperator= (const Torus &)=delete
 
 Torus (const Torus &)=default
 
- Protected Member Functions inherited from Mantid::Geometry::Surface
 Surface (const Surface &)=default
 

Private Member Functions

void displace (const Kernel::V3D &) override
 Displace the centre Only need to update the centre position. More...
 
TorusdoClone () const override
 Makes a clone (implicit virtual copy constructor) More...
 
void rotate (const Kernel::Matrix< double > &) override
 Rotate both the centre and the normal direction. More...
 

Private Attributes

Kernel::V3D Centre
 Geometry::Vec3D for centre. More...
 
double Displacement
 Displacement. More...
 
double Dradius
 Inner radius. More...
 
double Iradius
 Inner radius. More...
 
Kernel::V3D Normal
 Normal. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Mantid::Geometry::Surface
static const int Nprecision = 10
 Precision of the output. More...
 

Detailed Description

Holds a torus in vector form.

Author
S. Ansell
Date
December 2006
Version
1.0

Defines a Torus as a centre, normal and three parameters:

Definition at line 30 of file Torus.h.

Constructor & Destructor Documentation

◆ Torus() [1/2]

Mantid::Geometry::Torus::Torus ( const Torus )
protecteddefault

◆ Torus() [2/2]

Mantid::Geometry::Torus::Torus ( )

Constructor with centre line along X axis and centre on origin.

Definition at line 49 of file Torus.cpp.

Referenced by doClone().

Member Function Documentation

◆ acceptVisitor()

void Mantid::Geometry::Torus::acceptVisitor ( BaseVisit A) const
inlineoverridevirtual

Accept visitor for line calculation.

Reimplemented from Mantid::Geometry::Surface.

Definition at line 55 of file Torus.h.

References Mantid::Geometry::BaseVisit::Accept().

◆ className()

std::string Mantid::Geometry::Torus::className ( ) const
inlineoverridevirtual

Public identifier.

Reimplemented from Mantid::Geometry::Surface.

Definition at line 48 of file Torus.h.

◆ clone()

std::unique_ptr< Torus > Mantid::Geometry::Torus::clone ( ) const

Makes a clone (implicit virtual copy constructor)

Returns
new(*this)

Definition at line 68 of file Torus.cpp.

References doClone().

◆ displace()

void Mantid::Geometry::Torus::displace ( const Kernel::V3D A)
overrideprivatevirtual

Displace the centre Only need to update the centre position.

Parameters
A:: Point to add

Implements Mantid::Geometry::Surface.

Definition at line 174 of file Torus.cpp.

References Centre.

◆ distance()

double Mantid::Geometry::Torus::distance ( const Kernel::V3D Pt) const
overridevirtual

Calculates the distance from the point to the Torus does not calculate the point on the Torus that is closest.

Parameters
Pt:: Point to calcuate from
  • normalise to a cone vertex at the origin
  • calculate the angle between the axis and the Point
  • Calculate the distance to P
    Returns
    distance to Pt

Implements Mantid::Geometry::Surface.

Definition at line 217 of file Torus.cpp.

References Mantid::Kernel::V3D::norm(), and Mantid::Kernel::Tolerance.

◆ doClone()

Torus * Mantid::Geometry::Torus::doClone ( ) const
overrideprivatevirtual

Makes a clone (implicit virtual copy constructor)

Returns
new(*this)

Implements Mantid::Geometry::Surface.

Definition at line 59 of file Torus.cpp.

References Torus().

Referenced by clone().

◆ getBoundingBox()

void Mantid::Geometry::Torus::getBoundingBox ( double &  xmax,
double &  ymax,
double &  zmax,
double &  xmin,
double &  ymin,
double &  zmin 
)
overridevirtual

SGenerates a bounding box for the Torus.

Parameters
xmax:: the X max value
ymax:: the Y max value
zmax:: the Z max value
xmin:: the X min value
ymin:: the Y min value
zmin:: the Z min value

TODO:

Implements Mantid::Geometry::Surface.

Definition at line 302 of file Torus.cpp.

References UNUSED_ARG, and Mantid::Kernel::Logger::warning().

◆ getCentre()

Kernel::V3D Mantid::Geometry::Torus::getCentre ( ) const
inline

Return centre point.

Definition at line 63 of file Torus.h.

◆ getNormal()

Kernel::V3D Mantid::Geometry::Torus::getNormal ( ) const
inline

Central normal.

Definition at line 65 of file Torus.h.

◆ onSurface()

bool Mantid::Geometry::Torus::onSurface ( const Kernel::V3D R) const
overridevirtual

is point valid on surface

Calculate if the point R is on the cone (Note: have to be careful here since angle calcuation calcuates an angle. We need a distance for tolerance!)

Parameters
R:: Point to check

Implements Mantid::Geometry::Surface.

Definition at line 253 of file Torus.cpp.

References UNUSED_ARG.

◆ operator=()

Torus & Mantid::Geometry::Torus::operator= ( const Torus )
protecteddelete

◆ operator==()

int Mantid::Geometry::Torus::operator== ( const Torus A) const

Equality operator.

Checks angle,centre and normal separately

Parameters
A:: Torus to compare
Returns
A==this within TTolerance

Definition at line 77 of file Torus.cpp.

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

◆ rotate()

void Mantid::Geometry::Torus::rotate ( const Kernel::Matrix< double > &  R)
overrideprivatevirtual

Rotate both the centre and the normal direction.

Parameters
R:: Matrix for rotation.

Implements Mantid::Geometry::Surface.

Definition at line 164 of file Torus.cpp.

References Centre, Normal, and Mantid::Kernel::V3D::rotate().

◆ setCentre()

void Mantid::Geometry::Torus::setCentre ( const Kernel::V3D A)

Sets the central point and the Base Equation.

Parameters
A:: New Centre point

Definition at line 184 of file Torus.cpp.

References Centre.

◆ setDistanceFromCentreToTube()

void Mantid::Geometry::Torus::setDistanceFromCentreToTube ( double  dist)

Suppose to set the distance from centre of the torus to the centre of tube.

Supposed to set the distance from centre of the torus to the centre of tube (i.e.

TODO:

tube which makes up the torus)

Parameters
dist:: The distance

Definition at line 318 of file Torus.cpp.

References Iradius.

◆ setNorm()

void Mantid::Geometry::Torus::setNorm ( const Kernel::V3D A)

Sets the Normal and the Base Equation.

Parameters
A:: New Normal direction

Definition at line 193 of file Torus.cpp.

References Mantid::Kernel::V3D::norm(), Normal, and Mantid::Kernel::Tolerance.

◆ setSurface()

int Mantid::Geometry::Torus::setSurface ( const std::string &  Pstr)
overridevirtual

Processes a standard MCNPX cone string Recall that cones can only be specified on an axis Valid input is:

  • number {transformNumber} t/x cen_x cen_y cen_z a,b,c
    Parameters
    Pstr:: String to process
    Returns
    : 0 on success, neg of failure

Implements Mantid::Geometry::Surface.

Definition at line 127 of file Torus.cpp.

References Centre, Displacement, Dradius, Iradius, Mantid::Kernel::Strings::section(), and Mantid::Geometry::sectionV3D().

◆ setTubeRadius()

void Mantid::Geometry::Torus::setTubeRadius ( double  dist)

Suppose to set the radius of the tube which makes up the torus TODO:

Supposed to set the radius of the tube which makes up the torus.

Parameters
dist:: The radius

Definition at line 323 of file Torus.cpp.

References Dradius.

◆ side()

int Mantid::Geometry::Torus::side ( const Kernel::V3D R) const
overridevirtual

Calculate if the point R is within the torus (return -1) or outside, (return 1)

Todo:
NEEDS ON SURFACE CALCULATING:: waiting for a point to cone distance function
Parameters
R:: Point to determine if in/out of cone
Returns
Side of R

Reimplemented from Mantid::Geometry::Surface.

Definition at line 236 of file Torus.cpp.

References UNUSED_ARG.

◆ surfaceNormal()

Kernel::V3D Mantid::Geometry::Torus::surfaceNormal ( const Kernel::V3D Pt) const
overridevirtual

Get the normal at a point.

Parameters
Pt:: The Point of interest
Todo:
Does not work
Returns
the normal to the surface at that point

Implements Mantid::Geometry::Surface.

Definition at line 205 of file Torus.cpp.

References UNUSED_ARG.

◆ write()

void Mantid::Geometry::Torus::write ( std::ostream &  OX) const
overridevirtual

Write out the cone class in an mcnpx format.

Parameters
OX:: Output Stream (required for multiple std::endl)

Reimplemented from Mantid::Geometry::Surface.

Definition at line 270 of file Torus.cpp.

References Mantid::Geometry::Surface::Nprecision, Mantid::Kernel::Tolerance, Mantid::Geometry::Surface::write(), Mantid::Geometry::Surface::writeHeader(), and Mantid::Kernel::Strings::writeMCNPX().

Member Data Documentation

◆ Centre

Kernel::V3D Mantid::Geometry::Torus::Centre
private

Geometry::Vec3D for centre.

Definition at line 32 of file Torus.h.

Referenced by displace(), rotate(), setCentre(), and setSurface().

◆ Displacement

double Mantid::Geometry::Torus::Displacement
private

Displacement.

Definition at line 36 of file Torus.h.

Referenced by setSurface().

◆ Dradius

double Mantid::Geometry::Torus::Dradius
private

Inner radius.

Definition at line 35 of file Torus.h.

Referenced by setSurface(), and setTubeRadius().

◆ Iradius

double Mantid::Geometry::Torus::Iradius
private

Inner radius.

Definition at line 34 of file Torus.h.

Referenced by setDistanceFromCentreToTube(), and setSurface().

◆ Normal

Kernel::V3D Mantid::Geometry::Torus::Normal
private

Normal.

Definition at line 33 of file Torus.h.

Referenced by rotate(), and setNorm().


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