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

Functions

template<Kernel::V3D(*)(const detail::ShapeInfo &, Kernel::PseudoRandomNumberGenerator &) T>
boost::optional< Kernel::V3Dbounded (const detail::ShapeInfo &shapeInfo, Kernel::PseudoRandomNumberGenerator &rng, const BoundingBox &box, size_t maxAttempts)
 Return a random point in a known shape restricted by a bounding box. More...
 
MANTID_GEOMETRY_DLL boost::optional< Kernel::V3Dbounded (const IObject &object, Kernel::PseudoRandomNumberGenerator &rng, const BoundingBox &box, size_t maxAttempts)
 Return a random point in a generic shape limited by a bounding box. More...
 
MANTID_GEOMETRY_DLL Kernel::V3D inCuboid (const detail::ShapeInfo &shapeInfo, Kernel::PseudoRandomNumberGenerator &rng)
 Return a random point in a cuboid shape. More...
 
MANTID_GEOMETRY_DLL Kernel::V3D inCylinder (const detail::ShapeInfo &shapeInfo, Kernel::PseudoRandomNumberGenerator &rng)
 Return a random point in cylinder. More...
 
MANTID_GEOMETRY_DLL boost::optional< Kernel::V3DinGenericShape (const IObject &object, Kernel::PseudoRandomNumberGenerator &rng, size_t maxAttempts)
 Return a random point in a generic shape. More...
 
MANTID_GEOMETRY_DLL Kernel::V3D inHollowCylinder (const detail::ShapeInfo &shapeInfo, Kernel::PseudoRandomNumberGenerator &rng)
 Return a random point in a hollow cylinder. More...
 
MANTID_GEOMETRY_DLL Kernel::V3D inSphere (const detail::ShapeInfo &shapeInfo, Kernel::PseudoRandomNumberGenerator &rng)
 Return a random point in sphere. More...
 
MANTID_GEOMETRY_DLL Kernel::V3D localPointInCylinder (const Kernel::V3D &basis, const Kernel::V3D &alongAxis, double polarAngle, double radialLength)
 Return a local point in a cylinder shape. More...
 

Function Documentation

◆ bounded() [1/2]

boost::optional< Kernel::V3D > Mantid::Geometry::RandomPoint::bounded ( const detail::ShapeInfo shapeInfo,
Kernel::PseudoRandomNumberGenerator rng,
const BoundingBox box,
size_t  maxAttempts 
)

Return a random point in a known shape restricted by a bounding box.

This could be called with one of the inCylinder, inSphere,... functions as the template argument.

Parameters
shapeInfoa shape info
rnga random number generator
boxa restricting box
maxAttemptsnumber of attempts
Returns
a point or none if maxAttempts was exceeded

Definition at line 62 of file RandomPoint.h.

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

Referenced by Mantid::Geometry::CSGObject::generatePointInObject(), Mantid::Geometry::MeshObject::generatePointInObject(), and inGenericShape().

◆ bounded() [2/2]

boost::optional< Kernel::V3D > Mantid::Geometry::RandomPoint::bounded ( const IObject object,
Kernel::PseudoRandomNumberGenerator rng,
const BoundingBox box,
size_t  maxAttempts 
)

Return a random point in a generic shape limited by a bounding box.

Parameters
objectan object in which the point is generated
rnga random number generator
boxa box restricting the point's volume
maxAttemptsnumber of attempts to find a suitable point
Returns
a point or none if maxAttempts was exceeded

Definition at line 145 of file RandomPoint.cpp.

References Mantid::Geometry::BoundingBox::generatePointInside(), Mantid::Geometry::BoundingBox::isNull(), and Mantid::Kernel::PseudoRandomNumberGenerator::nextValue().

◆ inCuboid()

Kernel::V3D Mantid::Geometry::RandomPoint::inCuboid ( const detail::ShapeInfo shapeInfo,
Kernel::PseudoRandomNumberGenerator rng 
)

Return a random point in a cuboid shape.

Parameters
shapeInfocuboid's shape info
rnga random number generate
Returns
a random point inside the cuboid

Definition at line 50 of file RandomPoint.cpp.

References Mantid::Geometry::detail::ShapeInfo::cuboidGeometry(), and Mantid::Kernel::PseudoRandomNumberGenerator::nextValue().

Referenced by Mantid::Geometry::CSGObject::generatePointInObject().

◆ inCylinder()

Kernel::V3D Mantid::Geometry::RandomPoint::inCylinder ( const detail::ShapeInfo shapeInfo,
Kernel::PseudoRandomNumberGenerator rng 
)

Return a random point in cylinder.

Parameters
shapeInfocylinder's shape info
rnga random number generator
Returns
a point

Definition at line 67 of file RandomPoint.cpp.

References Mantid::Geometry::detail::ShapeInfo::cylinderGeometry(), localPointInCylinder(), Mantid::Kernel::PseudoRandomNumberGenerator::nextValue(), and Mantid::Geometry::z.

Referenced by Mantid::Geometry::CSGObject::generatePointInObject().

◆ inGenericShape()

boost::optional< Kernel::V3D > Mantid::Geometry::RandomPoint::inGenericShape ( const IObject object,
Kernel::PseudoRandomNumberGenerator rng,
size_t  maxAttempts 
)

Return a random point in a generic shape.

Parameters
objectan IObject within which the point is generated
rnga random number generator
maxAttemptsmaximum number of random numbers to use before giving up
Returns
a point

Definition at line 132 of file RandomPoint.cpp.

References bounded().

Referenced by Mantid::Geometry::CSGObject::generatePointInObject().

◆ inHollowCylinder()

Kernel::V3D Mantid::Geometry::RandomPoint::inHollowCylinder ( const detail::ShapeInfo shapeInfo,
Kernel::PseudoRandomNumberGenerator rng 
)

Return a random point in a hollow cylinder.

Parameters
shapeInfohollow cylinder's shape info
rnga random number generator
Returns
a point

Definition at line 87 of file RandomPoint.cpp.

References Mantid::Geometry::detail::ShapeInfo::hollowCylinderGeometry(), localPointInCylinder(), Mantid::Kernel::PseudoRandomNumberGenerator::nextValue(), and Mantid::Geometry::z.

Referenced by Mantid::Geometry::CSGObject::generatePointInObject().

◆ inSphere()

Kernel::V3D Mantid::Geometry::RandomPoint::inSphere ( const detail::ShapeInfo shapeInfo,
Kernel::PseudoRandomNumberGenerator rng 
)

Return a random point in sphere.

Parameters
shapeInfosphere's shape info
rnga random number generator
Returns
a point

Definition at line 110 of file RandomPoint.cpp.

References Mantid::Kernel::PseudoRandomNumberGenerator::nextValue(), Mantid::Geometry::detail::ShapeInfo::sphereGeometry(), Mantid::Geometry::x, Mantid::Geometry::y, and Mantid::Geometry::z.

Referenced by Mantid::Geometry::CSGObject::generatePointInObject().

◆ localPointInCylinder()

Kernel::V3D Mantid::Geometry::RandomPoint::localPointInCylinder ( const Kernel::V3D basis,
const Kernel::V3D alongAxis,
double  polarAngle,
double  radialLength 
)

Return a local point in a cylinder shape.

Parameters
basisa basis vector
alongAxissymmetry axis vector of a cylinder
polarAnglea polar angle (in radians) of a point in a cylinder
radialLengthradial position of point in a cylinder
Returns
a local point inside the cylinder

Definition at line 23 of file RandomPoint.cpp.

References Mantid::Kernel::V3D::cross_prod(), Mantid::Kernel::V3D::normalize(), Mantid::Kernel::V3D::setX(), Mantid::Kernel::V3D::setY(), Mantid::Kernel::V3D::setZ(), Mantid::Kernel::V3D::X(), Mantid::Kernel::V3D::Y(), and Mantid::Kernel::V3D::Z().

Referenced by inCylinder(), and inHollowCylinder().