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

Holds a cone in vector form. More...

#include <Cone.h>

Inheritance diagram for Mantid::Geometry::Cone:
Mantid::Geometry::Quadratic Mantid::Geometry::Surface

Public Member Functions

void acceptVisitor (BaseVisit &A) const override
 Accept visitor for line calculation. More...
 
std::string className () const override
 Public identifer. More...
 
std::unique_ptr< Coneclone () const
 
 Cone ()
 Constructor with centre line along X axis and centre on origin. More...
 
double distance (const Kernel::V3D &) const override
 This method returns the distance of the point from the cone. More...
 
void getBoundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) override
 This will get the bounding box for the cone. More...
 
Kernel::V3D getCentre () const
 Return centre point. More...
 
double getCosAngle () const
 Edge Angle. More...
 
Kernel::V3D getNormal () const
 Central normal. More...
 
bool onSurface (const Kernel::V3D &R) const override
 Calculate if the point R is on the cone. More...
 
int operator== (const Cone &) const
 Equality operator. More...
 
void setAngle (double const)
 This method sets the angle of the cone. More...
 
void setBaseEqn () override
 This method generates the quadratic equation for cone. More...
 
void setCentre (const Kernel::V3D &)
 This method sets the centre of the cone. More...
 
void setNorm (const Kernel::V3D &)
 This method sets the cone normal. More...
 
int setSurface (const std::string &) override
 This method sets the cone surface using the input string in MCNPx format. More...
 
void setTanAngle (double const)
 This method sets the tan angle which will be converted to cos used for MCNPX format. More...
 
int side (const Kernel::V3D &R) const override
 Calculate if the point R is within the cone (return -1) or outside (return 1) More...
 
void write (std::ostream &) const override
 This method will write the cone equation in MCNP geometry format. More...
 
- Public Member Functions inherited from Mantid::Geometry::Quadratic
void acceptVisitor (BaseVisit &A) const override
 Accept visitor for line calculation. More...
 
std::string className () const override
 Effective typeid. More...
 
std::unique_ptr< Quadraticclone () const
 
const std::vector< double > & copyBaseEqn () const
 access BaseEquation vector More...
 
void displace (const Kernel::V3D &) override
 Apply a general displacement to the surface. More...
 
double distance (const Kernel::V3D &) const override
 distance between point and surface (approx) More...
 
double eqnValue (const Kernel::V3D &) const
 Helper function to calcuate the value of the equation at a fixed point. More...
 
bool onSurface (const Kernel::V3D &) const override
 is point valid on surface More...
 
void print () const override
 Print out the genreal equation for debugging. More...
 
 Quadratic ()
 Constructor. More...
 
void rotate (const Kernel::Matrix< double > &) override
 Rotate the surface by matrix MX. More...
 
virtual void setBaseEqn ()=0
 Abstract set baseEqn. More...
 
int side (const Kernel::V3D &) const override
 Determine if the the Point is true to the surface or on the other side. More...
 
Kernel::V3D surfaceNormal (const Kernel::V3D &) const override
 Normal at surface. More...
 
void write (std::ostream &) const override
 Writes out an MCNPX surface description Note : Swap since base equation is swapped in gq output (mcnp 4c manual pg. 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
 

Static Public Attributes

static constexpr int g_NSLICES = 10
 The number of slices to approximate a cone. More...
 
static constexpr int g_NSTACKS = 1
 The number of stacks to approximate a cone. More...
 
- Static Public Attributes inherited from Mantid::Geometry::Quadratic
static const int Nprecision = 10
 Precision of the output. More...
 
- Static Public Attributes inherited from Mantid::Geometry::Surface
static const int Nprecision = 10
 Precision of the output. More...
 

Protected Member Functions

 Cone (const Cone &)=default
 
Coneoperator= (const Cone &)=delete
 
- Protected Member Functions inherited from Mantid::Geometry::Quadratic
Quadraticoperator= (const Quadratic &)=delete
 
 Quadratic (const Quadratic &)=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...
 
ConedoClone () 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

double alpha
 Angle (degrees) More...
 
double cangle
 Cos(angle) More...
 
Kernel::V3D Centre
 Kernel::V3D for centre. More...
 
Kernel::V3D Normal
 Normal. More...
 

Additional Inherited Members

- Protected Attributes inherited from Mantid::Geometry::Quadratic
std::vector< double > BaseEqn
 Base equation (as a 10 point vector) More...
 

Detailed Description

Holds a cone in vector form.

Author
S. Ansell
Date
April 2004
Version
1.0

Defines a cone as a centre point (on main axis) a vector from that point (unit) and a radius. and an angle.

Definition at line 29 of file Cone.h.

Constructor & Destructor Documentation

◆ Cone() [1/2]

Mantid::Geometry::Cone::Cone ( const Cone )
protecteddefault

◆ Cone() [2/2]

Mantid::Geometry::Cone::Cone ( )

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

Definition at line 50 of file Cone.cpp.

References setBaseEqn().

Referenced by doClone().

Member Function Documentation

◆ acceptVisitor()

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

Accept visitor for line calculation.

Reimplemented from Mantid::Geometry::Surface.

Definition at line 57 of file Cone.h.

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

◆ className()

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

Public identifer.

Reimplemented from Mantid::Geometry::Surface.

Definition at line 46 of file Cone.h.

◆ clone()

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

Definition at line 69 of file Cone.cpp.

References doClone().

◆ displace()

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

Displace the centre Only need to update the centre position.

Parameters
A:: Kernel::V3D to add

Implements Mantid::Geometry::Surface.

Definition at line 170 of file Cone.cpp.

References Centre, and setBaseEqn().

◆ distance()

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

This method returns the distance of the point from the cone.

Calculates the distance from the point to the Cone does not calculate the point on the cone 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 228 of file Cone.cpp.

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

◆ doClone()

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

Makes a clone (implicit virtual copy constructor)

Returns
new(*this)

Implements Mantid::Geometry::Quadratic.

Definition at line 60 of file Cone.cpp.

References Cone().

Referenced by clone().

◆ getBoundingBox()

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

This will get the bounding box for the cone.

Cone bounding box Intended to improve bounding box for a general quadratic surface Using the surface calculate improved limits on the bounding box, if possible.

Parameters
xmax:: On input, existing Xmax bound, on exit possibly improved Xmax bound
xmin:: On input, existing Xmin bound, on exit possibly improved Xmin bound
ymax:: as for xmax
ymin:: as for xmin
zmax:: as for xmax
zmin:: as for xmin /TODO: its bit difficult to find resonable AABB /For now it will return the same bounding box as input

Implements Mantid::Geometry::Surface.

Definition at line 329 of file Cone.cpp.

References alpha, Centre, fabs, Normal, radius, Mantid::Kernel::V3D::X(), Mantid::Kernel::V3D::Y(), and Mantid::Kernel::V3D::Z().

◆ getCentre()

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

Return centre point.

Definition at line 60 of file Cone.h.

◆ getCosAngle()

double Mantid::Geometry::Cone::getCosAngle ( ) const
inline

Edge Angle.

Definition at line 64 of file Cone.h.

◆ getNormal()

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

Central normal.

Definition at line 62 of file Cone.h.

◆ onSurface()

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

Calculate if the point R is on the cone.

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 282 of file Cone.cpp.

References cangle, Centre, Normal, Mantid::Kernel::V3D::scalar_prod(), and Mantid::Kernel::Tolerance.

◆ operator=()

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

◆ operator==()

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

Equality operator.

Checks angle,centre and normal separately

Parameters
A:: Cone to compare
Returns
A==this within SurfaceTolerance

Definition at line 119 of file Cone.cpp.

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

◆ rotate()

void Mantid::Geometry::Cone::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 159 of file Cone.cpp.

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

◆ setAngle()

void Mantid::Geometry::Cone::setAngle ( double const  A)

This method sets the angle of the cone.

Set the angle of the cone.

Parameters
A:: Angle in degrees. Resets the base equation

Definition at line 204 of file Cone.cpp.

References alpha, cangle, and setBaseEqn().

◆ setBaseEqn()

void Mantid::Geometry::Cone::setBaseEqn ( )
overridevirtual

This method generates the quadratic equation for cone.

Sets an equation of type.

\[ Ax^2+By^2+Cz^2+Dxy+Exz+Fyz+Gx+Hy+Jz+K=0 \]

Implements Mantid::Geometry::Quadratic.

Definition at line 139 of file Cone.cpp.

References Mantid::Geometry::Quadratic::BaseEqn, cangle, Centre, Normal, and Mantid::Kernel::V3D::scalar_prod().

Referenced by Cone(), displace(), rotate(), setAngle(), setCentre(), setNorm(), setSurface(), and setTanAngle().

◆ setCentre()

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

This method sets the centre of the cone.

Sets the central point and the Base Equation.

Parameters
A:: New Centre point

Definition at line 181 of file Cone.cpp.

References Centre, and setBaseEqn().

◆ setNorm()

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

This method sets the cone normal.

Sets the Normal and the Base Equation.

Parameters
A:: New Normal direction

Definition at line 191 of file Cone.cpp.

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

◆ setSurface()

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

This method sets the cone surface using the input string in MCNPx format.

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

  • k/x cen_x cen_y cen_z radius
  • kx radius
    Returns
    : 0 on success, neg of failure

Implements Mantid::Geometry::Surface.

Definition at line 71 of file Cone.cpp.

References Centre, index, Normal, Mantid::Kernel::Strings::section(), setBaseEqn(), and setTanAngle().

◆ setTanAngle()

void Mantid::Geometry::Cone::setTanAngle ( double const  A)

This method sets the tan angle which will be converted to cos used for MCNPX format.

Set the cone angle Resets the base equation.

Parameters
A:: Tan of the angle (for MCNPX)

Definition at line 216 of file Cone.cpp.

References alpha, cangle, and setBaseEqn().

Referenced by setSurface().

◆ side()

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

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

Calculate if the point R is within the cone (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 264 of file Cone.cpp.

References cangle, Centre, fabs, Normal, Mantid::Kernel::V3D::scalar_prod(), and Mantid::Kernel::Tolerance.

◆ write()

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

This method will write the cone equation in MCNP geometry format.

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 292 of file Cone.cpp.

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

Member Data Documentation

◆ alpha

double Mantid::Geometry::Cone::alpha
private

Angle (degrees)

Definition at line 33 of file Cone.h.

Referenced by getBoundingBox(), setAngle(), and setTanAngle().

◆ cangle

double Mantid::Geometry::Cone::cangle
private

Cos(angle)

Definition at line 34 of file Cone.h.

Referenced by onSurface(), setAngle(), setBaseEqn(), setTanAngle(), and side().

◆ Centre

Kernel::V3D Mantid::Geometry::Cone::Centre
private

Kernel::V3D for centre.

Definition at line 31 of file Cone.h.

Referenced by displace(), getBoundingBox(), onSurface(), rotate(), setBaseEqn(), setCentre(), setSurface(), and side().

◆ g_NSLICES

constexpr int Mantid::Geometry::Cone::g_NSLICES = 10
staticconstexpr

The number of slices to approximate a cone.

Definition at line 88 of file Cone.h.

◆ g_NSTACKS

constexpr int Mantid::Geometry::Cone::g_NSTACKS = 1
staticconstexpr

The number of stacks to approximate a cone.

Definition at line 90 of file Cone.h.

◆ Normal

Kernel::V3D Mantid::Geometry::Cone::Normal
private

Normal.

Definition at line 32 of file Cone.h.

Referenced by getBoundingBox(), onSurface(), rotate(), setBaseEqn(), setNorm(), setSurface(), and side().


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