Mantid
Loading...
Searching...
No Matches
Cylinder.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidGeometry/DllConfig.h"
11#include "MantidKernel/V3D.h"
12
13namespace Mantid {
14namespace Kernel {
15class Logger;
16}
17
18namespace Geometry {
19
32class MANTID_GEOMETRY_DLL Cylinder : public Quadratic {
33private:
35
38 std::size_t m_normVec;
40 double m_radius;
41
42 void rotate(const Kernel::Matrix<double> &) override;
43 void displace(const Kernel::V3D &) override;
44 void setNormVec();
45 Cylinder *doClone() const override;
46 void setRadiusInternal(const double &r) {
47 m_radius = r;
48 m_oneoverradius = 1 / m_radius;
49 };
50
51protected:
52 Cylinder(const Cylinder &) = default;
53 Cylinder &operator=(const Cylinder &) = delete;
54
55public:
57 std::string className() const override { return "Cylinder"; }
58
59 Cylinder();
60 std::unique_ptr<Cylinder> clone() const;
61
62 // Visit acceptor
63 void acceptVisitor(BaseVisit &A) const override { A.Accept(*this); }
64
65 virtual double lineIntersect(const Kernel::V3D &, const Kernel::V3D &) const;
66
67 int side(const Kernel::V3D &) const override;
68 bool onSurface(const Kernel::V3D &) const override;
69 double distance(const Kernel::V3D &) const override;
70
71 int setSurface(const std::string &) override;
72 void setCentre(const Kernel::V3D &);
73 void setNorm(const Kernel::V3D &);
74 Kernel::V3D getCentre() const { return m_centre; }
75 Kernel::V3D getNormal() const { return m_normal; }
76 double getRadius() const { return m_radius; }
78 void setRadius(const double &r) {
79 setRadiusInternal(r);
80 setBaseEqn();
81 }
82 void setBaseEqn() override;
83
84 void write(std::ostream &) const override;
85 void print() const override;
86 void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) override;
87
89 constexpr static int g_NSLICES = 10;
91 constexpr static int g_NSTACKS = 1;
92#ifdef ENABLE_OPENCASCADE
93 TopoDS_Shape createShape() override;
94#endif
95};
96
97} // NAMESPACE Geometry
98
99} // NAMESPACE Mantid
virtual void Accept(const Surface &)=0
Accept a surface.
Holds a cylinder as a vector form.
Definition: Cylinder.h:32
void acceptVisitor(BaseVisit &A) const override
Accept visitor for line calculation.
Definition: Cylinder.h:63
void setRadius(const double &r)
Set Radius.
Definition: Cylinder.h:78
double getRadius() const
Get Radius.
Definition: Cylinder.h:76
double m_radius
Radius of cylinder.
Definition: Cylinder.h:40
void setRadiusInternal(const double &r)
Definition: Cylinder.h:46
Kernel::V3D m_normal
Direction of centre line.
Definition: Cylinder.h:37
std::string className() const override
Public identifer.
Definition: Cylinder.h:57
Cylinder & operator=(const Cylinder &)=delete
std::size_t m_normVec
Normal vector is x,y or z :: (1-3) (0 if general)
Definition: Cylinder.h:38
static Kernel::Logger & PLog
The official logger.
Definition: Cylinder.h:34
Cylinder(const Cylinder &)=default
Kernel::V3D m_centre
Kernel::V3D for centre.
Definition: Cylinder.h:36
Kernel::V3D getCentre() const
Return centre point.
Definition: Cylinder.h:74
Kernel::V3D getNormal() const
Return Central line.
Definition: Cylinder.h:75
Holds a basic quadratic surface.
Definition: Quadratic.h:29
The Logger class is in charge of the publishing messages from the framework through various channels.
Definition: Logger.h:52
Numerical Matrix class.
Definition: Matrix.h:42
Class for 3D vectors.
Definition: V3D.h:34
Helper class which provides the Collimation Length for SANS instruments.