Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
SolidSphere.hh
Go to the documentation of this file.
1#ifndef G_SOLID_SPHERE_H
2#define G_SOLID_SPHERE_H
3
4#include "Solid.hh"
5
6namespace Garfield {
7
8/// Sphere.
9
10class SolidSphere : public Solid {
11 public:
12 /// Constructor
13 SolidSphere(const double cx, const double cy, const double cz,
14 const double r);
15 /// Destructor
17
18 bool IsInside(const double x, const double y, const double z) const override;
19 bool GetBoundingBox(double& xmin, double& ymin, double& zmin, double& xmax,
20 double& ymax, double& zmax) const override;
21 bool IsSphere() const override { return true; }
22
23 /// Set the radius of the sphere.
24 void SetRadius(const double r);
25
26 double GetRadius() const override { return m_r; }
27
28 /// When calculating surface panels, the sphere is approximated by a set of
29 /// parallelograms, much the same way maps are drawn. N specifies the number
30 /// of meridians and also the number of parallels.
31 void SetMeridians(const unsigned int n);
32
33 bool SolidPanels(std::vector<Panel>& panels) override;
34 double GetDiscretisationLevel(const Panel& panel) override;
35
36 private:
37 /// Radius
38 double m_r = 1.;
39
40 /// Number of meridians.
41 unsigned int m_n = 10;
42
43 /// Discretisation level.
44 double m_dis = -1.;
45};
46}
47
48#endif
~SolidSphere()
Destructor.
Definition: SolidSphere.hh:16
bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const override
Return the bounding box of the solid.
Definition: SolidSphere.cc:47
bool IsInside(const double x, const double y, const double z) const override
Check whether a given point is inside the solid.
Definition: SolidSphere.cc:16
void SetRadius(const double r)
Set the radius of the sphere.
Definition: SolidSphere.cc:59
double GetDiscretisationLevel(const Panel &panel) override
Retrieve the discretization level of a panel.
Definition: SolidSphere.cc:157
bool SolidPanels(std::vector< Panel > &panels) override
Retrieve the surface panels of the solid.
Definition: SolidSphere.cc:75
bool IsSphere() const override
Return true if the solid is a sphere.
Definition: SolidSphere.hh:21
double GetRadius() const override
Return the radius.
Definition: SolidSphere.hh:26
void SetMeridians(const unsigned int n)
Definition: SolidSphere.cc:67
Abstract base class for solids.
Definition: Solid.hh:28
Surface panel.
Definition: Solid.hh:11