Mantid
|
#include <MeshObject2D.h>
Classes | |
struct | PlaneParameters |
Public Member Functions | |
MeshObject2D * | clone () const override |
MeshObject2D * | cloneWithMaterial (const Kernel::Material &material) const override |
double | distance (const Geometry::Track &ut) const override |
Compute the distance to the first point of intersection with the mesh. More... | |
double | distanceToPlane (const Kernel::V3D &point) const |
void | draw () const override |
boost::optional< Kernel::V3D > | generatePointInObject (Kernel::PseudoRandomNumberGenerator &rng, const BoundingBox &activeRegion, const size_t) const override |
boost::optional< Kernel::V3D > | generatePointInObject (Kernel::PseudoRandomNumberGenerator &rng, const size_t) const override |
const BoundingBox & | getBoundingBox () const override |
Returns an axis-aligned bounding box that will fit the shape. More... | |
void | getBoundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const override |
Calculate (or return cached value of) Axis Aligned Bounding box (DEPRECATED) More... | |
std::shared_ptr< GeometryHandler > | getGeometryHandler () const override |
int | getName () const override |
void | GetObjectGeom (detail::ShapeInfo::GeometryShape &type, std::vector< Kernel::V3D > &vectors, double &innerRadius, double &radius, double &height) const override |
int | getPointInObject (Kernel::V3D &point) const override |
Try to find a point that lies within (or on) the object. More... | |
std::vector< uint32_t > | getTriangles () const |
std::vector< double > | getVertices () const |
bool | hasValidShape () const override |
const std::string & | id () const override |
void | initDraw () const override |
int | interceptSurface (Geometry::Track &ut) const override |
Given a track, fill the track with valid section. More... | |
bool | isOnSide (const Kernel::V3D &) const override |
Determine if point is on the side of the object. More... | |
bool | isValid (const Kernel::V3D &point) const override |
Check if a point is inside. More... | |
const Kernel::Material & | material () const override |
MeshObject2D (std::vector< uint32_t > &&faces, std::vector< Kernel::V3D > &&vertices, const Kernel::Material &&material) | |
Constructor. More... | |
MeshObject2D (std::vector< uint32_t > faces, std::vector< Kernel::V3D > vertices, const Kernel::Material &material) | |
Constructor. More... | |
size_t | numberOfTriangles () const |
size_t | numberOfVertices () const |
bool | operator== (const MeshObject2D &other) const |
void | setID (const std::string &id) override |
virtual void | setMaterial (const Kernel::Material &material) override |
detail::ShapeInfo::GeometryShape | shape () const override |
const detail::ShapeInfo & | shapeInfo () const override |
double | solidAngle (const Kernel::V3D &observer) const override |
Solid angle only considers triangle facing sample. More... | |
double | solidAngle (const Kernel::V3D &observer, const Kernel::V3D &scaleFactor) const override |
double | volume () const override |
Public Member Functions inherited from Mantid::Geometry::IObject | |
virtual IObject * | clone () const =0 |
virtual IObject * | cloneWithMaterial (const Kernel::Material &material) const =0 |
virtual double | distance (const Geometry::Track &) const =0 |
virtual void | draw () 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 const BoundingBox & | getBoundingBox () const =0 |
Return cached value of axis-aligned bounding box. More... | |
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) More... | |
virtual std::shared_ptr< GeometryHandler > | getGeometryHandler () const =0 |
virtual int | getName () const =0 |
virtual void | GetObjectGeom (detail::ShapeInfo::GeometryShape &type, std::vector< Kernel::V3D > &vectors, double &innerRadius, double &radius, double &height) const =0 |
virtual int | getPointInObject (Kernel::V3D &point) const =0 |
virtual bool | hasValidShape () const =0 |
virtual const std::string & | id () const =0 |
virtual void | initDraw () const =0 |
virtual int | interceptSurface (Geometry::Track &) const =0 |
virtual bool | isFiniteGeometry () const |
virtual bool | isOnSide (const Kernel::V3D &) const =0 |
virtual bool | isValid (const Kernel::V3D &) const =0 |
virtual const Kernel::Material & | material () const =0 |
virtual void | setFiniteGeometryFlag (bool) |
virtual void | setID (const std::string &id)=0 |
virtual void | setMaterial (const Kernel::Material &material)=0 |
virtual detail::ShapeInfo::GeometryShape | shape () const =0 |
virtual const detail::ShapeInfo & | shapeInfo () const =0 |
virtual double | solidAngle (const Kernel::V3D &observer) const =0 |
virtual double | solidAngle (const Kernel::V3D &observer, const Kernel::V3D &scaleFactor) const =0 |
virtual double | volume () const =0 |
virtual | ~IObject ()=default |
Static Public Member Functions | |
static bool | pointsCoplanar (const std::vector< Kernel::V3D > &vertices) |
Estalish if points are coplanar. More... | |
Static Public Attributes | |
static const std::string | Id = "MeshObject2D" |
Id as static. More... | |
static const double | MinThickness = 0.001 |
Private Member Functions | |
void | initialize () |
Common initialization. More... | |
Private Attributes | |
BoundingBox | m_boundingBox |
Bounding box. More... | |
std::shared_ptr< GeometryHandler > | m_handler |
Geometry Handle for rendering. More... | |
std::string | m_id |
optional string identifier More... | |
Kernel::Material | m_material |
Material composition. More... | |
struct Mantid::Geometry::MeshObject2D::PlaneParameters | m_planeParameters |
std::vector< uint32_t > | m_triangles |
Triangles are specified by indices into a list of vertices. More... | |
std::vector< Kernel::V3D > | m_vertices |
Vertices. More... | |
Defines an IObject implemented as a 2D mesh composed of triangles. Avoids assumptions made in MeshObject to do with closed surfaces, non-zero volumes and assoicated additional runtime costs. The number of vertices is limited to 2^16 based on index type.
Definition at line 30 of file MeshObject2D.h.
Mantid::Geometry::MeshObject2D::MeshObject2D | ( | std::vector< uint32_t > | faces, |
std::vector< Kernel::V3D > | vertices, | ||
const Kernel::Material & | material | ||
) |
Mantid::Geometry::MeshObject2D::MeshObject2D | ( | std::vector< uint32_t > && | faces, |
std::vector< Kernel::V3D > && | vertices, | ||
const Kernel::Material && | material | ||
) |
Constructor.
Move constructor.
Definition at line 156 of file MeshObject2D.cpp.
References initialize().
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 281 of file MeshObject2D.cpp.
References m_material, m_triangles, and m_vertices.
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 285 of file MeshObject2D.cpp.
References m_triangles, and m_vertices.
|
overridevirtual |
Compute the distance to the first point of intersection with the mesh.
ut | Track defining start/direction |
std::runtime_error | if no intersection was found |
Implements Mantid::Geometry::IObject.
Definition at line 257 of file MeshObject2D.cpp.
References Mantid::Geometry::Track::direction(), Mantid::Geometry::intersection(), m_planeParameters, m_vertices, Mantid::Geometry::MeshObject2D::PlaneParameters::normal, Mantid::Geometry::MeshObject2D::PlaneParameters::p0, Mantid::Geometry::MeshObjectCommon::rayIntersectsTriangle(), Mantid::Kernel::V3D::scalar_prod(), and Mantid::Geometry::Track::startPoint().
double Mantid::Geometry::MeshObject2D::distanceToPlane | ( | const Kernel::V3D & | point | ) | const |
Definition at line 187 of file MeshObject2D.cpp.
References Mantid::Geometry::MeshObject2D::PlaneParameters::a, Mantid::Geometry::MeshObject2D::PlaneParameters::b, Mantid::Geometry::MeshObject2D::PlaneParameters::c, Mantid::Geometry::MeshObject2D::PlaneParameters::k, m_planeParameters, Mantid::Kernel::V3D::X(), Mantid::Kernel::V3D::Y(), and Mantid::Kernel::V3D::Z().
Referenced by isValid().
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 413 of file MeshObject2D.cpp.
References m_handler.
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 370 of file MeshObject2D.cpp.
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 362 of file MeshObject2D.cpp.
|
overridevirtual |
Returns an axis-aligned bounding box that will fit the shape.
This is not threadsafe
Implements Mantid::Geometry::IObject.
Definition at line 346 of file MeshObject2D.cpp.
References Mantid::Geometry::MeshObjectCommon::getBoundingBox(), m_boundingBox, and m_vertices.
|
overridevirtual |
Calculate (or return cached value of) Axis Aligned Bounding box (DEPRECATED)
Implements Mantid::Geometry::IObject.
Definition at line 350 of file MeshObject2D.cpp.
References Mantid::Geometry::MeshObjectCommon::getBoundingBox(), m_boundingBox, and m_vertices.
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 389 of file MeshObject2D.cpp.
References m_handler.
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 289 of file MeshObject2D.cpp.
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 408 of file MeshObject2D.cpp.
|
overridevirtual |
Try to find a point that lies within (or on) the object.
[out] | point | :: on exit set to the point value, if found |
Implements Mantid::Geometry::IObject.
Definition at line 360 of file MeshObject2D.cpp.
References isValid().
std::vector< uint32_t > Mantid::Geometry::MeshObject2D::getTriangles | ( | ) | const |
Definition at line 397 of file MeshObject2D.cpp.
References m_triangles.
std::vector< double > Mantid::Geometry::MeshObject2D::getVertices | ( | ) | const |
Definition at line 395 of file MeshObject2D.cpp.
References Mantid::Geometry::MeshObjectCommon::getVertices(), and m_vertices.
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 182 of file MeshObject2D.cpp.
References m_triangles, and m_vertices.
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 387 of file MeshObject2D.cpp.
References Id.
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 420 of file MeshObject2D.cpp.
References m_handler.
|
private |
Common initialization.
Definition at line 165 of file MeshObject2D.cpp.
References Mantid::Geometry::MeshObject2D::PlaneParameters::a, Mantid::Geometry::MeshObject2D::PlaneParameters::abs_normal, Mantid::Geometry::MeshObject2D::PlaneParameters::b, Mantid::Geometry::MeshObject2D::PlaneParameters::c, Mantid::Geometry::MeshObjectCommon::checkVertexLimit(), Mantid::Geometry::MeshObject2D::PlaneParameters::k, m_handler, m_planeParameters, m_vertices, Mantid::Kernel::V3D::norm(), Mantid::Geometry::MeshObject2D::PlaneParameters::normal, Mantid::Geometry::MeshObject2D::PlaneParameters::p0, Mantid::Geometry::CoplanarChecks::validatePointsCoplanar(), Mantid::Kernel::V3D::X(), Mantid::Kernel::V3D::Y(), and Mantid::Kernel::V3D::Z().
Referenced by MeshObject2D().
|
overridevirtual |
Given a track, fill the track with valid section.
ut | :: Initial track |
Implements Mantid::Geometry::IObject.
Definition at line 225 of file MeshObject2D.cpp.
References Mantid::Geometry::Track::addPoint(), Mantid::Geometry::Track::buildLink(), Mantid::Geometry::Track::count(), Mantid::Geometry::Track::direction(), Mantid::Geometry::intersection(), m_planeParameters, m_vertices, Mantid::Geometry::MeshObject2D::PlaneParameters::normal, Mantid::Geometry::MeshObject2D::PlaneParameters::p0, Mantid::Geometry::MeshObjectCommon::rayIntersectsTriangle(), Mantid::Kernel::V3D::scalar_prod(), and Mantid::Geometry::Track::startPoint().
|
overridevirtual |
Determine if point is on the side of the object.
point | : Point to test |
Implements Mantid::Geometry::IObject.
Definition at line 218 of file MeshObject2D.cpp.
References isValid().
|
overridevirtual |
Check if a point is inside.
Check that the point is on the plane AND that it is inside or on.
MeshObject2D::isOnSide one of the triangles that defines the plane. Both must be true.
point | : Point to test |
Implements Mantid::Geometry::IObject.
Definition at line 199 of file MeshObject2D.cpp.
References distanceToPlane(), Mantid::Geometry::MeshObjectCommon::isOnTriangle(), m_triangles, m_vertices, and tolerance.
Referenced by getPointInObject(), and isOnSide().
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 380 of file MeshObject2D.cpp.
References m_material.
Referenced by setMaterial().
size_t Mantid::Geometry::MeshObject2D::numberOfTriangles | ( | ) | const |
Definition at line 393 of file MeshObject2D.cpp.
References m_triangles.
size_t Mantid::Geometry::MeshObject2D::numberOfVertices | ( | ) | const |
Definition at line 391 of file MeshObject2D.cpp.
References m_vertices.
bool Mantid::Geometry::MeshObject2D::operator== | ( | const MeshObject2D & | other | ) | const |
Definition at line 328 of file MeshObject2D.cpp.
References Mantid::Geometry::MeshObject2D::PlaneParameters::a, Mantid::Geometry::MeshObject2D::PlaneParameters::b, Mantid::Geometry::MeshObject2D::PlaneParameters::c, Mantid::Geometry::MeshObject2D::PlaneParameters::k, m_material, m_planeParameters, m_triangles, m_vertices, Mantid::Kernel::Material::name(), and Mantid::Geometry::MeshObject2D::PlaneParameters::p0.
|
static |
Estalish if points are coplanar.
vertices | : All vertices to consider |
Definition at line 130 of file MeshObject2D.cpp.
References Mantid::Geometry::CoplanarChecks::allCoplanar(), Mantid::Kernel::V3D::norm2(), Mantid::Geometry::CoplanarChecks::sufficientPoints(), and Mantid::Geometry::CoplanarChecks::surfaceNormal().
|
inlineoverridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 73 of file MeshObject2D.h.
|
overridevirtual |
material | :: material that is being set for the object |
Implements Mantid::Geometry::IObject.
Definition at line 385 of file MeshObject2D.cpp.
References m_material, and material().
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 399 of file MeshObject2D.cpp.
References Mantid::Geometry::detail::ShapeInfo::NOSHAPE.
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 404 of file MeshObject2D.cpp.
|
overridevirtual |
Solid angle only considers triangle facing sample.
Back faces do NOT contribute.
This is tantamount to defining an object that is opaque to neutrons. Note that it is still possible to define a facing surface which is obscured by another. In that case there would still be a solid angle contribution as there is no way of detecting the shadowing.
observer |
Implements Mantid::Geometry::IObject.
Definition at line 307 of file MeshObject2D.cpp.
References Mantid::Geometry::MeshObjectCommon::getTriangleSolidAngle(), m_triangles, and m_vertices.
Referenced by solidAngle().
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 319 of file MeshObject2D.cpp.
References m_material, m_triangles, m_vertices, and solidAngle().
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 335 of file MeshObject2D.cpp.
|
static |
|
mutableprivate |
|
private |
Geometry Handle for rendering.
Definition at line 106 of file MeshObject2D.h.
Referenced by draw(), getGeometryHandler(), initDraw(), and initialize().
|
private |
optional string identifier
Definition at line 100 of file MeshObject2D.h.
|
private |
Material composition.
Definition at line 102 of file MeshObject2D.h.
Referenced by clone(), material(), operator==(), setMaterial(), and solidAngle().
|
private |
Referenced by distance(), distanceToPlane(), initialize(), interceptSurface(), and operator==().
|
private |
Triangles are specified by indices into a list of vertices.
Offset is always 3.
Definition at line 96 of file MeshObject2D.h.
Referenced by clone(), cloneWithMaterial(), getTriangles(), hasValidShape(), isValid(), numberOfTriangles(), operator==(), and solidAngle().
|
private |
Vertices.
Definition at line 98 of file MeshObject2D.h.
Referenced by clone(), cloneWithMaterial(), distance(), getBoundingBox(), getVertices(), hasValidShape(), initialize(), interceptSurface(), isValid(), numberOfVertices(), operator==(), and solidAngle().
|
static |
Definition at line 54 of file MeshObject2D.h.