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. More... | |
std::string | className () const override |
Effective typename. More... | |
std::unique_ptr< Sphere > | clone () const |
Makes a clone (implicit virtual copy constructor) More... | |
double | distance (const Kernel::V3D &) const override |
Gets the distance from the sphere to the input point. More... | |
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. More... | |
Kernel::V3D | getCentre () const |
Get Centre. More... | |
double | getRadius () const |
Get Radius. More... | |
bool | onSurface (const Kernel::V3D &) const override |
Checks whether the give input point is on the surface. More... | |
void | setBaseEqn () override |
Generates the quadratic equation. More... | |
void | setCentre (const Kernel::V3D &) |
Setter for centre of sphere. More... | |
void | setRadius (const double &r) |
Set Radius. More... | |
int | setSurface (const std::string &) override |
Set the sphere defination by input string in MCNP format. More... | |
int | side (const Kernel::V3D &) const override |
Checks the given input point to be inside, outside or on the surface of sphere. More... | |
Sphere () | |
Default constructor make sphere at the origin radius zero. More... | |
Sphere (const Kernel::V3D ¢re, double radius) | |
Sphere::Sphere. More... | |
void | write (std::ostream &) const override |
Writes the sphere equatation in MCNP 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< Quadratic > | clone () 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< Surface > | clone () 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... | |
Surface & | operator= (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 = 5 |
The number of slices to approximate a sphere. More... | |
static constexpr int | g_NSTACKS = 5 |
The number of stacks to approximate a sphere. 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 | |
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. More... | |
void | displace (const Kernel::V3D &) override |
Apply a shift of the centre. More... | |
Sphere * | doClone () const override |
Makes a clone (implicit virtual copy constructor) More... | |
void | rotate (const Kernel::Matrix< double > &) override |
Apply a Rotation matrix. More... | |
Private Attributes | |
Kernel::V3D | m_centre |
Point for centre. More... | |
double | m_radius |
Radius of sphere. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Mantid::Geometry::Quadratic | |
std::vector< double > | BaseEqn |
Base equation (as a 10 point vector) More... | |
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.
Referenced by side().
|
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 displace(), 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().