|
Mantid
|
Holds a Sphere as vector form. More...
#include <Sphere.h>
Public Member Functions | |
| void | acceptVisitor (BaseVisit &A) const override |
| Accept visitor for line calculation. | |
| std::string | className () const override |
| Effective typename. | |
| std::unique_ptr< Sphere > | clone () const |
| Makes a clone (implicit virtual copy constructor) | |
| double | distance (const Kernel::V3D &) const override |
| Gets the distance from the sphere to the input point. | |
| void | getBoundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) override |
| Calculates the bounding box for the sphere and returns the bounding box values. | |
| Kernel::V3D | getCentre () const |
| Get Centre. | |
| double | getRadius () const |
| Get Radius. | |
| bool | onSurface (const Kernel::V3D &) const override |
| Checks whether the give input point is on the surface. | |
| void | setBaseEqn () override |
| Generates the quadratic equation. | |
| void | setCentre (const Kernel::V3D &) |
| Setter for centre of sphere. | |
| void | setRadius (const double &r) |
| Set Radius. | |
| int | setSurface (const std::string &) override |
| Set the sphere defination by input string in MCNP format. | |
| int | side (const Kernel::V3D &) const override |
| Checks the given input point to be inside, outside or on the surface of sphere. | |
| Sphere () | |
| Default constructor make sphere at the origin radius zero. | |
| Sphere (const Kernel::V3D ¢re, double radius) | |
| Sphere::Sphere. | |
| void | write (std::ostream &) const override |
| Writes the sphere equatation in MCNP format. | |
Public Member Functions inherited from Mantid::Geometry::Quadratic | |
| std::unique_ptr< Quadratic > | clone () const |
| const std::vector< double > & | copyBaseEqn () const |
| access BaseEquation vector | |
| double | eqnValue (const Kernel::V3D &) const |
| Helper function to calcuate the value of the equation at a fixed point. | |
| void | print () const override |
| Print out the genreal equation for debugging. | |
| Quadratic () | |
| Constructor. | |
| Kernel::V3D | surfaceNormal (const Kernel::V3D &) const override |
| Normal at surface. | |
Public Member Functions inherited from Mantid::Geometry::Surface | |
| std::unique_ptr< Surface > | clone () const |
| int | getName () const |
| Get Name. | |
| Surface & | operator= (const Surface &)=delete |
| void | setName (int const N) |
| Set Name. | |
| Surface () | |
| Constructor. | |
| void | writeHeader (std::ostream &) const |
| Writes out the start of an MCNPX surface description . | |
| virtual | ~Surface ()=default |
Static Public Attributes | |
| static constexpr int | g_NSLICES = 5 |
| The number of slices to approximate a sphere. | |
| static constexpr int | g_NSTACKS = 5 |
| The number of stacks to approximate a sphere. | |
Static Public Attributes inherited from Mantid::Geometry::Quadratic | |
| static const int | Nprecision = 10 |
| Precision of the output. | |
Static Public Attributes inherited from Mantid::Geometry::Surface | |
| static const int | Nprecision = 10 |
| Precision of the output. | |
Protected Member Functions | |
| Sphere & | operator= (const Sphere &)=delete |
| Sphere (const Sphere &)=default | |
Protected Member Functions inherited from Mantid::Geometry::Quadratic | |
| Quadratic & | operator= (const Quadratic &)=delete |
| Quadratic (const Quadratic &)=default | |
Protected Member Functions inherited from Mantid::Geometry::Surface | |
| Surface (const Surface &)=default | |
Private Member Functions | |
| double | centreToPoint (const Kernel::V3D &pt) const |
| Compute the distance from the centre of the sphere to the given point. | |
| void | displace (const Kernel::V3D &) override |
| Apply a shift of the centre. | |
| Sphere * | doClone () const override |
| Makes a clone (implicit virtual copy constructor) | |
| void | rotate (const Kernel::Matrix< double > &) override |
| Apply a Rotation matrix. | |
Private Attributes | |
| Kernel::V3D | m_centre |
| Point for centre. | |
| double | m_radius |
| Radius of sphere. | |
Additional Inherited Members | |
Protected Attributes inherited from Mantid::Geometry::Quadratic | |
| std::vector< double > | BaseEqn |
| Base equation (as a 10 point vector) | |
Holds a Sphere as vector form.
Defines a sphere as a centre point and a radius.
|
protecteddefault |
| Mantid::Geometry::Sphere::Sphere | ( | ) |
Default constructor make sphere at the origin radius zero.
Definition at line 38 of file Sphere.cpp.
Referenced by doClone().
| Mantid::Geometry::Sphere::Sphere | ( | const Kernel::V3D & | centre, |
| double | radius | ||
| ) |
|
inlineoverridevirtual |
Accept visitor for line calculation.
Reimplemented from Mantid::Geometry::Quadratic.
Definition at line 50 of file Sphere.h.
References Mantid::Geometry::BaseVisit::Accept().
|
private |
Compute the distance from the centre of the sphere to the given point.
Compute the distance between the given point and the centre of the sphere.
| pt | :: The chosen point |
Definition at line 166 of file Sphere.cpp.
References m_centre, and Mantid::Kernel::V3D::norm().
|
inlineoverridevirtual |
Effective typename.
Reimplemented from Mantid::Geometry::Quadratic.
| std::unique_ptr< Sphere > Mantid::Geometry::Sphere::clone | ( | ) | const |
Makes a clone (implicit virtual copy constructor)
Definition at line 59 of file Sphere.cpp.
References doClone().
|
overrideprivatevirtual |
Apply a shift of the centre.
| Pt | :: distance to add to the centre |
Reimplemented from Mantid::Geometry::Quadratic.
Definition at line 148 of file Sphere.cpp.
References Mantid::Geometry::Quadratic::displace(), and m_centre.
|
overridevirtual |
Gets the distance from the sphere to the input point.
Determine the shortest distance from the Surface to the Point.
| Pt | :: Point to calculate distance from |
Reimplemented from Mantid::Geometry::Quadratic.
Definition at line 139 of file Sphere.cpp.
References m_centre, m_radius, and Mantid::Kernel::V3D::norm().
Referenced by onSurface().
|
overrideprivatevirtual |
Makes a clone (implicit virtual copy constructor)
Implements Mantid::Geometry::Quadratic.
Definition at line 53 of file Sphere.cpp.
References Sphere().
Referenced by clone().
|
overridevirtual |
Calculates the bounding box for the sphere and returns the bounding box values.
| xmax | :: input and output for the bounding box X axis max value |
| ymax | :: input and output for the bounding box Y axis max value |
| zmax | :: input and output for the bounding box Z axis max value |
| xmin | :: input and output for the bounding box X axis min value |
| ymin | :: input and output for the bounding box Y axis min value |
| zmin | :: input and output for the bounding box Z axis min value |
Implements Mantid::Geometry::Surface.
Definition at line 224 of file Sphere.cpp.
|
inline |
|
inline |
|
overridevirtual |
Checks whether the give input point is on the surface.
Calculate if the point Pt on the surface of the sphere (within tolerance CTolerance)
| Pt | :: Point to check |
Reimplemented from Mantid::Geometry::Quadratic.
Definition at line 131 of file Sphere.cpp.
References distance(), and Mantid::Kernel::Tolerance.
|
overrideprivatevirtual |
Apply a Rotation matrix.
| MA | :: matrix to rotate by |
Reimplemented from Mantid::Geometry::Quadratic.
Definition at line 157 of file Sphere.cpp.
References m_centre, Mantid::Geometry::Quadratic::rotate(), and Mantid::Kernel::V3D::rotate().
|
overridevirtual |
Generates the quadratic equation.
Sets an equation of type (general sphere)
\[ x^2+y^2+z^2+Gx+Hy+Jz+K=0 \]
Implements Mantid::Geometry::Quadratic.
Definition at line 184 of file Sphere.cpp.
References Mantid::Geometry::Quadratic::BaseEqn, m_centre, m_radius, and Mantid::Kernel::V3D::scalar_prod().
Referenced by setCentre(), setSurface(), and Sphere().
| void Mantid::Geometry::Sphere::setCentre | ( | const Kernel::V3D & | A | ) |
Setter for centre of sphere.
Set the centre point.
| A | :: New Centre Point |
Definition at line 175 of file Sphere.cpp.
References m_centre, and setBaseEqn().
|
inline |
|
overridevirtual |
Set the sphere defination by input string in MCNP format.
Processes a standard MCNPX cone string Recall that cones can only be specified on an axis Valid input is:
Implements Mantid::Geometry::Surface.
Definition at line 70 of file Sphere.cpp.
References index, m_centre, m_radius, Mantid::Kernel::Strings::section(), and setBaseEqn().
|
overridevirtual |
Checks the given input point to be inside, outside or on the surface of sphere.
Calculate where the point Pt is relative to the sphere.
| Pt | :: Point to test |
| -1 | :: Pt within sphere |
| 0 | :: point on the surface (within CTolerance) |
| 1 | :: Pt outside the sphere |
Reimplemented from Mantid::Geometry::Quadratic.
Definition at line 112 of file Sphere.cpp.
References fabs, m_centre, m_radius, Mantid::Kernel::Tolerance, Mantid::Kernel::V3D::X(), Mantid::Kernel::V3D::Y(), and Mantid::Kernel::V3D::Z().
|
overridevirtual |
Writes the sphere equatation in MCNP format.
Object of write is to output a MCNPX plane info.
| OX | :: Output stream (required for multiple std::endl) |
Reimplemented from Mantid::Geometry::Quadratic.
Definition at line 202 of file Sphere.cpp.
References Mantid::Kernel::V3D::distance(), m_centre, m_radius, Mantid::Geometry::Surface::Nprecision, Mantid::Kernel::Tolerance, Mantid::Geometry::Surface::writeHeader(), and Mantid::Kernel::Strings::writeMCNPX().
|
staticconstexpr |
|
staticconstexpr |
|
private |
Point for centre.
Definition at line 31 of file Sphere.h.
Referenced by centreToPoint(), displace(), distance(), getBoundingBox(), rotate(), setBaseEqn(), setCentre(), setSurface(), side(), and write().
|
private |
Radius of sphere.
Definition at line 32 of file Sphere.h.
Referenced by distance(), getBoundingBox(), setBaseEqn(), setSurface(), side(), and write().