Mantid
Loading...
Searching...
No Matches
Functions
Mantid::Geometry::MeshObjectCommon Namespace Reference

MeshObjectCommon : Performs functions common to 3D and 2D closed meshes. More...

Functions

MANTID_GEOMETRY_DLL void checkVertexLimit (size_t nVertices)
 
MANTID_GEOMETRY_DLL const BoundingBoxgetBoundingBox (const std::vector< Kernel::V3D > &vertices, BoundingBox &cacheBB)
 Takes input vertices and calculates bounding box. More...
 
MANTID_GEOMETRY_DLL void getBoundingBox (const std::vector< Kernel::V3D > &vertices, BoundingBox &cacheBB, double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin)
 From vertices calculates the bounding box. More...
 
MANTID_GEOMETRY_DLL double getTriangleSolidAngle (const Kernel::V3D &a, const Kernel::V3D &b, const Kernel::V3D &c, const Kernel::V3D &observer)
 Find the solid angle of a triangle defined by vectors a,b,c from point "observer". More...
 
MANTID_GEOMETRY_DLL std::vector< double > getVertices (const std::vector< Kernel::V3D > &vertices)
 getVertices converts vector Kernel::V3D to vector doubles. More...
 
MANTID_GEOMETRY_DLL bool isOnTriangle (const Kernel::V3D &point, const Kernel::V3D &v1, const Kernel::V3D &v2, const Kernel::V3D &v3)
 isOnTriangle More...
 
MANTID_GEOMETRY_DLL bool rayIntersectsTriangle (const Kernel::V3D &start, const Kernel::V3D &direction, const Kernel::V3D &v1, const Kernel::V3D &v2, const Kernel::V3D &v3, Kernel::V3D &intersection, TrackDirection &entryExit)
 Get intersection points and their in out directions on the given ray. More...
 

Detailed Description

MeshObjectCommon : Performs functions common to 3D and 2D closed meshes.

Function Documentation

◆ checkVertexLimit()

void Mantid::Geometry::MeshObjectCommon::checkVertexLimit ( size_t  nVertices)

◆ getBoundingBox() [1/2]

const BoundingBox & Mantid::Geometry::MeshObjectCommon::getBoundingBox ( const std::vector< Kernel::V3D > &  vertices,
BoundingBox cacheBB 
)

Takes input vertices and calculates bounding box.

Returns the bounding box.

Parameters
vertices:: vertices to create BB from
cacheBB:: mutable BB object to write to.

Definition at line 207 of file MeshObjectCommon.cpp.

References Mantid::Geometry::BoundingBox::isNull().

Referenced by Mantid::Geometry::MeshObject2D::getBoundingBox(), getBoundingBox(), and Mantid::Geometry::MeshObject::getBoundingBox().

◆ getBoundingBox() [2/2]

void Mantid::Geometry::MeshObjectCommon::getBoundingBox ( const std::vector< Kernel::V3D > &  vertices,
BoundingBox cacheBB,
double &  xmax,
double &  ymax,
double &  zmax,
double &  xmin,
double &  ymin,
double &  zmin 
)

From vertices calculates the bounding box.

Returns them back in max and min points as well as mutated BB object.

Parameters
vertices:: vertices to create BB from
cacheBB:: mutable BB object to write to.
xmax:: Maximum value for the bounding box in x direction
ymax:: Maximum value for the bounding box in y direction
zmax:: Maximum value for the bounding box in z direction
xmin:: Minimum value for the bounding box in x direction
ymin:: Minimum value for the bounding box in y direction
zmin:: Minimum value for the bounding box in z direction

Definition at line 255 of file MeshObjectCommon.cpp.

References getBoundingBox().

◆ getTriangleSolidAngle()

double Mantid::Geometry::MeshObjectCommon::getTriangleSolidAngle ( const Kernel::V3D a,
const Kernel::V3D b,
const Kernel::V3D c,
const Kernel::V3D observer 
)

Find the solid angle of a triangle defined by vectors a,b,c from point "observer".

formula (Oosterom) O=2atan([a,b,c]/(abc+(a.b)c+(a.c)b+(b.c)a))

Parameters
a:: first point of triangle
b:: second point of triangle
c:: third point of triangle
observer:: point from which solid angle is required
Returns
:: solid angle of triangle in Steradians.

This duplicates code in CSGOjbect both need a place to be merged. To aid this, this function has been defined as a non-member.

Definition at line 48 of file MeshObjectCommon.cpp.

References Mantid::Kernel::V3D::cross_prod(), Mantid::Kernel::V3D::norm(), and Mantid::Kernel::V3D::scalar_prod().

Referenced by Mantid::Geometry::MeshObject::solidAngle(), and Mantid::Geometry::MeshObject2D::solidAngle().

◆ getVertices()

std::vector< double > Mantid::Geometry::MeshObjectCommon::getVertices ( const std::vector< Kernel::V3D > &  vertices)

getVertices converts vector Kernel::V3D to vector doubles.

3x size of input. ordered x,y,z,x,y,z...

Parameters
vertices: input vector of Kernel::V3D
Returns
: vector of doubles. Elements of input.

Definition at line 19 of file MeshObjectCommon.cpp.

Referenced by Mantid::Geometry::MeshObject::getVertices(), and Mantid::Geometry::MeshObject2D::getVertices().

◆ isOnTriangle()

bool Mantid::Geometry::MeshObjectCommon::isOnTriangle ( const Kernel::V3D point,
const Kernel::V3D v1,
const Kernel::V3D v2,
const Kernel::V3D v3 
)

isOnTriangle

Parameters
point: point to test
v1: first vertex of triangle
v2: second vertex of triangle
v3: thrid vertex of triangle
Returns
True only point if is on triangle

Definition at line 75 of file MeshObjectCommon.cpp.

References Mantid::Kernel::V3D::scalar_prod().

Referenced by Mantid::Geometry::MeshObject2D::isValid().

◆ rayIntersectsTriangle()

bool Mantid::Geometry::MeshObjectCommon::rayIntersectsTriangle ( const Kernel::V3D start,
const Kernel::V3D direction,
const Kernel::V3D v1,
const Kernel::V3D v2,
const Kernel::V3D v3,
Kernel::V3D intersection,
TrackDirection entryExit 
)

Get intersection points and their in out directions on the given ray.

Parameters
start:: Start point of ray
direction:: Direction of ray
v1:: First vertex of triangle
v2:: Second vertex of triangle
v3:: Third vertex of triangle
intersection:: Intersection point
entryExit:: 1 if intersection is entry, -1 if exit intersection
Returns
true if there is an intersection

Definition at line 130 of file MeshObjectCommon.cpp.

References Mantid::Kernel::V3D::cross_prod(), Mantid::Geometry::ENTERING, EPSILON(), Mantid::Geometry::intersection(), Mantid::Geometry::LEAVING, and Mantid::Kernel::V3D::scalar_prod().

Referenced by Mantid::Geometry::MeshObject2D::distance(), Mantid::Geometry::MeshObject::distance(), Mantid::Geometry::MeshObject::getIntersections(), and Mantid::Geometry::MeshObject2D::interceptSurface().