Mantid
|
Holds a cone in vector form. More...
#include <Cone.h>
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< Cone > | clone () 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< 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 = 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 | |
Cone & | operator= (const Cone &)=delete |
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 | |
void | displace (const Kernel::V3D &) override |
Displace the centre Only need to update the centre position. More... | |
Cone * | doClone () 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... | |
Holds a cone in vector form.
Defines a cone as a centre point (on main axis) a vector from that point (unit) and a radius. and an angle.
|
protecteddefault |
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().
|
inlineoverridevirtual |
Accept visitor for line calculation.
Reimplemented from Mantid::Geometry::Surface.
Definition at line 57 of file Cone.h.
References Mantid::Geometry::BaseVisit::Accept().
|
inlineoverridevirtual |
Public identifer.
Reimplemented from Mantid::Geometry::Surface.
std::unique_ptr< Cone > Mantid::Geometry::Cone::clone | ( | ) | const |
|
overrideprivatevirtual |
Displace the centre Only need to update the centre position.
A | :: Kernel::V3D to add |
Implements Mantid::Geometry::Surface.
Definition at line 170 of file Cone.cpp.
References Centre, and setBaseEqn().
|
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.
Pt | :: Point to calcuate from |
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.
|
overrideprivatevirtual |
Makes a clone (implicit virtual copy constructor)
Implements Mantid::Geometry::Quadratic.
Definition at line 60 of file Cone.cpp.
References Cone().
Referenced by clone().
|
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.
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().
|
inline |
|
inline |
|
inline |
|
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!)
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.
int Mantid::Geometry::Cone::operator== | ( | const Cone & | A | ) | const |
Equality operator.
Checks angle,centre and normal separately
A | :: Cone to compare |
Definition at line 119 of file Cone.cpp.
References fabs, and Mantid::Kernel::Tolerance.
|
overrideprivatevirtual |
Rotate both the centre and the normal direction.
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().
void Mantid::Geometry::Cone::setAngle | ( | double const | A | ) |
This method sets the angle of the cone.
Set the angle of the cone.
A | :: Angle in degrees. Resets the base equation |
Definition at line 204 of file Cone.cpp.
References alpha, cangle, and 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().
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.
A | :: New Centre point |
Definition at line 181 of file Cone.cpp.
References Centre, and setBaseEqn().
void Mantid::Geometry::Cone::setNorm | ( | const Kernel::V3D & | A | ) |
This method sets the cone normal.
Sets the Normal and the Base Equation.
A | :: New Normal direction |
Definition at line 191 of file Cone.cpp.
References Mantid::Kernel::V3D::norm(), Normal, setBaseEqn(), and Mantid::Kernel::Tolerance.
|
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:
Implements Mantid::Geometry::Surface.
Definition at line 71 of file Cone.cpp.
References Centre, index, Normal, Mantid::Kernel::Strings::section(), setBaseEqn(), and 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.
A | :: Tan of the angle (for MCNPX) |
Definition at line 216 of file Cone.cpp.
References alpha, cangle, and setBaseEqn().
Referenced by setSurface().
|
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)
R | :: Point to determine if in/out of cone |
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.
|
overridevirtual |
This method will write the cone equation in MCNP geometry format.
Write out the cone class in an mcnpx format.
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().
|
private |
Angle (degrees)
Definition at line 33 of file Cone.h.
Referenced by getBoundingBox(), setAngle(), and setTanAngle().
|
private |
Cos(angle)
Definition at line 34 of file Cone.h.
Referenced by onSurface(), setAngle(), setBaseEqn(), setTanAngle(), and side().
|
private |
Kernel::V3D for centre.
Definition at line 31 of file Cone.h.
Referenced by displace(), getBoundingBox(), onSurface(), rotate(), setBaseEqn(), setCentre(), setSurface(), and side().
|
staticconstexpr |
|
staticconstexpr |
|
private |
Normal.
Definition at line 32 of file Cone.h.
Referenced by getBoundingBox(), onSurface(), rotate(), setBaseEqn(), setNorm(), setSurface(), and side().