11#ifdef ENABLE_OPENCASCADE
16#undef _USE_MATH_DEFINES
25#include <BRepPrimAPI_MakeSphere.hxx>
71 std::string
Line = Pstr;
76 std::vector<double> cent(3, 0.0);
78 if (item.length() == 2)
80 if (tolower(item[1]) !=
'o') {
81 const auto pType =
static_cast<std::size_t
>(tolower(item[1]) -
'x');
87 }
else if (item.length() == 1) {
119 const double displace = sqrt(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff) -
m_radius;
168 return displace_vec.
norm();
203 std::ostringstream cx;
233#ifdef ENABLE_OPENCASCADE
234TopoDS_Shape Sphere::createShape() {
std::map< DeltaEMode::Type, std::string > index
#define GNU_DIAG_OFF(x)
This is a collection of macros for turning compiler warnings off in a controlled manner.
Holds a basic quadratic surface.
std::vector< double > BaseEqn
Base equation (as a 10 point vector)
void displace(const Kernel::V3D &) override
Apply a general displacement to the surface.
void rotate(const Kernel::Matrix< double > &) override
Rotate the surface by matrix MX.
Holds a Sphere as vector form.
void displace(const Kernel::V3D &) override
Apply a shift of the centre.
void setBaseEqn() override
Generates the quadratic equation.
void rotate(const Kernel::Matrix< double > &) override
Apply a Rotation matrix.
std::unique_ptr< Sphere > clone() const
Makes a clone (implicit virtual copy constructor)
bool onSurface(const Kernel::V3D &) const override
Checks whether the give input point is on the surface.
Kernel::V3D m_centre
Point for centre.
void write(std::ostream &) const override
Writes the sphere equatation in MCNP format.
double m_radius
Radius of sphere.
int setSurface(const std::string &) override
Set the sphere defination by input string in MCNP format.
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.
Sphere * doClone() const override
Makes a clone (implicit virtual copy constructor)
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.
double centreToPoint(const Kernel::V3D &pt) const
Compute the distance from the centre of the sphere to the given point.
void setCentre(const Kernel::V3D &)
Setter for centre of sphere.
void writeHeader(std::ostream &) const
Writes out the start of an MCNPX surface description .
static const int Nprecision
Precision of the output.
double distance(const V3D &v) const noexcept
Calculates the distance between two vectors.
constexpr double scalar_prod(const V3D &v) const noexcept
Calculates the cross product.
constexpr double X() const noexcept
Get x.
constexpr double Y() const noexcept
Get y.
void rotate(const Matrix< double > &) noexcept
Rotate a point by a matrix.
double norm() const noexcept
constexpr double Z() const noexcept
Get z.
int section(std::string &A, T &out)
Convert and cut a string.
MANTID_KERNEL_DLL void writeMCNPX(const std::string &Line, std::ostream &OX)
Write file in standard MCNPX input form.
constexpr double Tolerance
Standard tolerance value.