26#ifdef ENABLE_OPENCASCADE
31#undef _USE_MATH_DEFINES
40#include <TopoDS_Shape.hxx>
50 :
Surface(), Centre(), Normal(1, 0, 0), Iradius(0), Dradius(0), Displacement(0)
65 return new Torus(*
this);
74 return std::unique_ptr<Torus>(
doClone());
92 if (Centre.distance(A.Centre) >
Tolerance)
94 if (Normal.distance(A.Normal) >
Tolerance)
111 std::istringstream cx;
118 const std::streamoff xpt = cx.tellg();
119 const auto xc =
static_cast<char>(cx.get());
120 if (!cx.fail() && !isspace(xc))
122 A.erase(0,
static_cast<unsigned int>(xpt));
137 enum { errDesc = -1, errAxis = -2, errCent = -3, errNormal = -4 };
139 std::string
Line = Pstr;
146 const auto ptype =
static_cast<std::size_t
>(tolower(item[2]) -
'x');
199 const auto length = A.
norm();
278 const char Tailends[] =
"zyx xyz";
279 const int Ndir = Normal.masterDir(
Tolerance);
284 std::ostringstream cx;
286 cx <<
"t" << Tailends[Ndir + 3] <<
" ";
290 cx << Centre <<
" " << Displacement <<
" " << Iradius <<
" " << Dradius;
311 log.
warning(
"Torus::getBoundingBox is not implemented.");
325#ifdef ENABLE_OPENCASCADE
326TopoDS_Shape Torus::createShape() {
328 return TopoDS_Shape();
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
#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.
void writeHeader(std::ostream &) const
Writes out the start of an MCNPX surface description .
virtual void write(std::ostream &) const
The writes the data to the output stream.
static const int Nprecision
Precision of the output.
Holds a torus in vector form.
Kernel::V3D Normal
Normal.
double Displacement
Displacement.
void setDistanceFromCentreToTube(double dist)
Suppose to set the distance from centre of the torus to the centre of tube.
double Dradius
Inner radius.
std::unique_ptr< Torus > clone() const
Makes a clone (implicit virtual copy constructor)
double distance(const Kernel::V3D &Pt) const override
Calculates the distance from the point to the Torus does not calculate the point on the Torus that is...
int side(const Kernel::V3D &R) const override
Calculate if the point R is within the torus (return -1) or outside, (return 1)
void setTubeRadius(double dist)
Suppose to set the radius of the tube which makes up the torus TODO:
Kernel::V3D Centre
Geometry::Vec3D for centre.
int operator==(const Torus &) const
Equality operator.
void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) override
SGenerates a bounding box for the Torus.
void setNorm(const Kernel::V3D &A)
Sets the Normal and the Base Equation.
double Iradius
Inner radius.
void rotate(const Kernel::Matrix< double > &) override
Rotate both the centre and the normal direction.
int setSurface(const std::string &Pstr) override
Processes a standard MCNPX cone string Recall that cones can only be specified on an axis Valid input...
bool onSurface(const Kernel::V3D &R) const override
is point valid on surface
Torus * doClone() const override
Makes a clone (implicit virtual copy constructor)
Torus()
Constructor with centre line along X axis and centre on origin.
void displace(const Kernel::V3D &) override
Displace the centre Only need to update the centre position.
void write(std::ostream &OX) const override
Write out the cone class in an mcnpx format.
Kernel::V3D surfaceNormal(const Kernel::V3D &Pt) const override
Get the normal at a point.
void setCentre(const Kernel::V3D &A)
Sets the central point and the Base Equation.
Marks code as not implemented yet.
The Logger class is in charge of the publishing messages from the framework through various channels.
void warning(const std::string &msg)
Logs at warning level.
void rotate(const Matrix< double > &) noexcept
Rotate a point by a matrix.
double norm() const noexcept
int sectionV3D(std::string &A, Mantid::Kernel::V3D &out)
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.