Mantid
Loading...
Searching...
No Matches
IObject.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2017 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 <boost/optional.hpp>
12#include <map>
13#include <memory>
14#include <vector>
15
16namespace Mantid {
17
18//----------------------------------------------------------------------
19// Forward declarations
20//----------------------------------------------------------------------
21namespace Kernel {
22class PseudoRandomNumberGenerator;
23class Material;
24class V3D;
25} // namespace Kernel
26
27namespace Geometry {
28class BoundingBox;
29class GeometryHandler;
30class Surface;
31class Track;
32class vtkGeometryCacheReader;
33class vtkGeometryCacheWriter;
34
41class MANTID_GEOMETRY_DLL IObject {
42public:
43 virtual ~IObject() = default;
44 virtual bool isValid(const Kernel::V3D &) const = 0;
45 virtual bool isOnSide(const Kernel::V3D &) const = 0;
46 virtual bool isFiniteGeometry() const { return true; }
47 virtual void setFiniteGeometryFlag(bool) {}
48 virtual bool hasValidShape() const = 0;
49 virtual IObject *clone() const = 0;
50 virtual IObject *cloneWithMaterial(const Kernel::Material &material) const = 0;
51
52 virtual int getName() const = 0;
53
54 virtual int interceptSurface(Geometry::Track &) const = 0;
55 virtual double distance(const Geometry::Track &) const = 0;
56 // Solid angle
57 virtual double solidAngle(const Kernel::V3D &observer) const = 0;
58 // Solid angle with a scaling of the object
59 virtual double solidAngle(const Kernel::V3D &observer, const Kernel::V3D &scaleFactor) const = 0;
61 virtual const BoundingBox &getBoundingBox() const = 0;
64 virtual void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin,
65 double &zmin) const = 0;
66 virtual double volume() const = 0;
67
68 virtual int getPointInObject(Kernel::V3D &point) const = 0;
69
70 virtual boost::optional<Kernel::V3D> generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng,
71 const size_t) const = 0;
72 virtual boost::optional<Kernel::V3D> generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng,
73 const BoundingBox &activeRegion, const size_t) const = 0;
74
76 virtual const detail::ShapeInfo &shapeInfo() const = 0;
77 virtual void GetObjectGeom(detail::ShapeInfo::GeometryShape &type, std::vector<Kernel::V3D> &vectors,
78 double &innerRadius, double &radius, double &height) const = 0;
79 // Rendering
80 virtual void draw() const = 0;
81 virtual void initDraw() const = 0;
82
83 virtual const Kernel::Material &material() const = 0;
84 virtual void setMaterial(const Kernel::Material &material) = 0;
85 virtual const std::string &id() const = 0;
86 virtual void setID(const std::string &id) = 0;
87
88 virtual std::shared_ptr<GeometryHandler> getGeometryHandler() const = 0;
89};
90
92using IObject_sptr = std::shared_ptr<IObject>;
94using IObject_const_sptr = std::shared_ptr<const IObject>;
96using IObject_uptr = std::unique_ptr<IObject>;
98using IObject_const_uptr = std::unique_ptr<const IObject>;
99
100} // namespace Geometry
101} // namespace Mantid
double height
Definition: GetAllEi.cpp:155
double radius
Definition: Rasterize.cpp:31
double innerRadius
Definition: Rasterize.cpp:39
A simple structure that defines an axis-aligned cuboid shaped bounding box for a geometrical object.
Definition: BoundingBox.h:34
IObject : Interface for geometry objects.
Definition: IObject.h:41
virtual bool isOnSide(const Kernel::V3D &) const =0
virtual int getPointInObject(Kernel::V3D &point) const =0
virtual void GetObjectGeom(detail::ShapeInfo::GeometryShape &type, std::vector< Kernel::V3D > &vectors, double &innerRadius, double &radius, double &height) const =0
virtual void initDraw() const =0
virtual int interceptSurface(Geometry::Track &) const =0
virtual std::shared_ptr< GeometryHandler > getGeometryHandler() const =0
virtual double distance(const Geometry::Track &) const =0
virtual const detail::ShapeInfo & shapeInfo() const =0
virtual double solidAngle(const Kernel::V3D &observer, const Kernel::V3D &scaleFactor) const =0
virtual boost::optional< Kernel::V3D > generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng, const BoundingBox &activeRegion, const size_t) const =0
virtual boost::optional< Kernel::V3D > generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng, const size_t) const =0
virtual IObject * cloneWithMaterial(const Kernel::Material &material) const =0
virtual void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const =0
Calculate (or return cached value of) Axis Aligned Bounding box (DEPRECATED)
virtual void setID(const std::string &id)=0
virtual void setMaterial(const Kernel::Material &material)=0
virtual detail::ShapeInfo::GeometryShape shape() const =0
virtual double solidAngle(const Kernel::V3D &observer) const =0
virtual const std::string & id() const =0
virtual ~IObject()=default
virtual void setFiniteGeometryFlag(bool)
Definition: IObject.h:47
virtual bool isValid(const Kernel::V3D &) const =0
virtual double volume() const =0
virtual int getName() const =0
virtual const BoundingBox & getBoundingBox() const =0
Return cached value of axis-aligned bounding box.
virtual const Kernel::Material & material() const =0
virtual bool isFiniteGeometry() const
Definition: IObject.h:46
virtual IObject * clone() const =0
virtual void draw() const =0
virtual bool hasValidShape() const =0
Defines a track as a start point and a direction.
Definition: Track.h:165
A material is defined as being composed of a given element, defined as a PhysicalConstants::NeutronAt...
Definition: Material.h:50
Defines a 1D pseudo-random number generator, i.e.
Class for 3D vectors.
Definition: V3D.h:34
std::unique_ptr< const IObject > IObject_const_uptr
Typdef for a unique pointer to a const object.
Definition: IObject.h:98
std::unique_ptr< IObject > IObject_uptr
Typdef for a unique pointer.
Definition: IObject.h:96
std::shared_ptr< const IObject > IObject_const_sptr
Typdef for a shared pointer to a const object.
Definition: IObject.h:94
std::shared_ptr< IObject > IObject_sptr
Typdef for a shared pointer.
Definition: IObject.h:92
Helper class which provides the Collimation Length for SANS instruments.