Mantid
Loading...
Searching...
No Matches
Sphere.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#include <string>
13
14class TopoDS_Shape;
15
16namespace Mantid {
17
18namespace Geometry {
29class MANTID_GEOMETRY_DLL Sphere : public Quadratic {
30private:
32 double m_radius;
33 void rotate(const Kernel::Matrix<double> &) override;
34 void displace(const Kernel::V3D &) override;
36 double centreToPoint(const Kernel::V3D &pt) const;
37 Sphere *doClone() const override;
38
39protected:
40 Sphere(const Sphere &) = default;
41 Sphere &operator=(const Sphere &) = delete;
42
43public:
44 Sphere();
45 Sphere(const Kernel::V3D &centre, double radius);
46 std::unique_ptr<Sphere> clone() const;
48 std::string className() const override { return "Sphere"; }
49 // Visit acceptor
50 void acceptVisitor(BaseVisit &A) const override { A.Accept(*this); }
52 int setSurface(const std::string &) override;
55 int side(const Kernel::V3D &) const override;
57 bool onSurface(const Kernel::V3D &) const override;
59 double distance(const Kernel::V3D &) const override;
61 void setCentre(const Kernel::V3D &);
63 Kernel::V3D getCentre() const { return m_centre; }
65 double getRadius() const { return m_radius; }
67 void setRadius(const double &r) {
68 m_radius = r;
69 setBaseEqn();
70 }
72 void setBaseEqn() override;
74 void write(std::ostream &) const override;
75 void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) override;
76
78 constexpr static int g_NSLICES = 5;
80 constexpr static int g_NSTACKS = 5;
81#ifdef ENABLE_OPENCASCADE
82 TopoDS_Shape createShape() override;
83#endif
84};
85
86} // NAMESPACE Geometry
87
88} // NAMESPACE Mantid
double radius
Definition: Rasterize.cpp:31
virtual void Accept(const Surface &)=0
Accept a surface.
Holds a basic quadratic surface.
Definition: Quadratic.h:29
Holds a Sphere as vector form.
Definition: Sphere.h:29
double getRadius() const
Get Radius.
Definition: Sphere.h:65
std::string className() const override
Effective typename.
Definition: Sphere.h:48
Kernel::V3D m_centre
Point for centre.
Definition: Sphere.h:31
void setRadius(const double &r)
Set Radius.
Definition: Sphere.h:67
Kernel::V3D getCentre() const
Get Centre.
Definition: Sphere.h:63
double m_radius
Radius of sphere.
Definition: Sphere.h:32
Sphere & operator=(const Sphere &)=delete
void acceptVisitor(BaseVisit &A) const override
Accept visitor for line calculation.
Definition: Sphere.h:50
Sphere(const Sphere &)=default
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.