Mantid
|
MeshObjectCommon : Performs functions common to 3D and 2D closed meshes. More...
Functions | |
MANTID_GEOMETRY_DLL void | checkVertexLimit (size_t nVertices) |
MANTID_GEOMETRY_DLL const BoundingBox & | getBoundingBox (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... | |
MeshObjectCommon : Performs functions common to 3D and 2D closed meshes.
void Mantid::Geometry::MeshObjectCommon::checkVertexLimit | ( | size_t | nVertices | ) |
Definition at line 194 of file MeshObjectCommon.cpp.
References std::to_string().
Referenced by Mantid::Geometry::MeshObject::initialize(), and Mantid::Geometry::MeshObject2D::initialize().
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.
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().
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.
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().
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))
a | :: first point of triangle |
b | :: second point of triangle |
c | :: third point of triangle |
observer | :: point from which solid angle is required |
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().
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...
vertices | : input vector of Kernel::V3D |
Definition at line 19 of file MeshObjectCommon.cpp.
Referenced by Mantid::Geometry::MeshObject::getVertices(), and Mantid::Geometry::MeshObject2D::getVertices().
bool Mantid::Geometry::MeshObjectCommon::isOnTriangle | ( | const Kernel::V3D & | point, |
const Kernel::V3D & | v1, | ||
const Kernel::V3D & | v2, | ||
const Kernel::V3D & | v3 | ||
) |
isOnTriangle
point | : point to test |
v1 | : first vertex of triangle |
v2 | : second vertex of triangle |
v3 | : thrid vertex of triangle |
Definition at line 75 of file MeshObjectCommon.cpp.
References Mantid::Kernel::V3D::scalar_prod().
Referenced by Mantid::Geometry::MeshObject2D::isValid().
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.
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 |
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().