Mantid
Loading...
Searching...
No Matches
MeshObject2D.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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"
13#include "MantidKernel/V3D.h"
14#include <memory>
15#include <vector>
16
17namespace Mantid {
18
19namespace Geometry {
20class Track;
21class GeometryHandler;
22
30class MANTID_GEOMETRY_DLL MeshObject2D : public IObject {
31public:
33 MeshObject2D(std::vector<uint32_t> faces, std::vector<Kernel::V3D> vertices, const Kernel::Material &material);
35 MeshObject2D(std::vector<uint32_t> &&faces, std::vector<Kernel::V3D> &&vertices, const Kernel::Material &&material);
36
37 double volume() const override;
38
39 static bool pointsCoplanar(const std::vector<Kernel::V3D> &vertices);
40
41 bool hasValidShape() const override;
42 double distanceToPlane(const Kernel::V3D &point) const;
43 bool isValid(const Kernel::V3D &point) const override;
44 bool isOnSide(const Kernel::V3D &) const override;
45 int interceptSurface(Geometry::Track &ut) const override;
46 double distance(const Geometry::Track &ut) const override;
47 MeshObject2D *clone() const override;
48 MeshObject2D *cloneWithMaterial(const Kernel::Material &material) const override;
49 int getName() const override;
50 double solidAngle(const Kernel::V3D &observer) const override;
51 double solidAngle(const Kernel::V3D &observer, const Kernel::V3D &scaleFactor) const override;
52 bool operator==(const MeshObject2D &other) const;
53 const BoundingBox &getBoundingBox() const override;
54 const static double MinThickness;
55
56 void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin,
57 double &zmin) const override;
58 int getPointInObject(Kernel::V3D &point) const override;
59
60 boost::optional<Kernel::V3D> generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng,
61 const size_t) const override;
62 boost::optional<Kernel::V3D> generatePointInObject(Kernel::PseudoRandomNumberGenerator &rng,
63 const BoundingBox &activeRegion, const size_t) const override;
64 detail::ShapeInfo::GeometryShape shape() const override;
65 const detail::ShapeInfo &shapeInfo() const override;
66 void GetObjectGeom(detail::ShapeInfo::GeometryShape &type, std::vector<Kernel::V3D> &vectors, double &innerRadius,
67 double &radius, double &height) const override;
68 void draw() const override;
69 void initDraw() const override;
70 const Kernel::Material &material() const override;
71 virtual void setMaterial(const Kernel::Material &material) override;
72 const std::string &id() const override;
73 void setID(const std::string &id) override { m_id = id; };
74 std::shared_ptr<GeometryHandler> getGeometryHandler() const override;
76 static const std::string Id;
77 size_t numberOfVertices() const;
78 size_t numberOfTriangles() const;
79 std::vector<double> getVertices() const;
80 std::vector<uint32_t> getTriangles() const;
81
82private:
84 double a;
85 double b;
86 double c;
87 double k;
90 double abs_normal;
91 } m_planeParameters;
92
93 void initialize();
96 std::vector<uint32_t> m_triangles;
98 std::vector<Kernel::V3D> m_vertices;
100 std::string m_id;
106 std::shared_ptr<GeometryHandler> m_handler;
107};
108
109} // namespace Geometry
110} // namespace Mantid
double height
Definition: GetAllEi.cpp:155
std::string getName(const IMDDimension &self)
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
std::shared_ptr< GeometryHandler > m_handler
Geometry Handle for rendering.
Definition: MeshObject2D.h:106
static const double MinThickness
Definition: MeshObject2D.h:54
static const std::string Id
Id as static.
Definition: MeshObject2D.h:76
std::vector< uint32_t > m_triangles
Triangles are specified by indices into a list of vertices.
Definition: MeshObject2D.h:96
void setID(const std::string &id) override
Definition: MeshObject2D.h:73
std::vector< Kernel::V3D > m_vertices
Vertices.
Definition: MeshObject2D.h:98
BoundingBox m_boundingBox
Bounding box.
Definition: MeshObject2D.h:104
Kernel::Material m_material
Material composition.
Definition: MeshObject2D.h:102
std::string m_id
optional string identifier
Definition: MeshObject2D.h:100
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
Helper class which provides the Collimation Length for SANS instruments.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)