Commit baf50afc authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[makepointsampler] add overload for bbox

parent 23aecfd4
......@@ -45,6 +45,11 @@ namespace Frackit {
*
* \tparam ctype The type used for coordinates
* \tparam T The traits class containing the distributions
* \todo TODO: This actually implements a sampler for axis-aligned
* boxes (bounding boxes). Currently, the box class implements
* an axis-aligned box. Once this is generalized, we should
* move this to "BoundingBoxSampler" and implement a more generic
* sampler in this class.
*/
template<class ctype, class T>
class BoxPointSampler
......
......@@ -25,6 +25,7 @@
#define FRACKIT_MAKE_POINT_SAMPLER_HH
#include <frackit/geometry/box.hh>
#include <frackit/geometry/boundingbox.hh>
#include <frackit/geometry/cylinder.hh>
#include <frackit/geometry/hollowcylinder.hh>
......@@ -79,18 +80,30 @@ makePointSampler(const HollowCylinder<ctype>& hollowCylinder)
/*!
* \ingroup Sampling
* \brief Overload of the free function to create point
* samplers for boxes.
* samplers for bounding boxes.
*/
template< class Traits, class ctype >
BoxPointSampler< ctype, Traits >
makePointSampler(const Box<ctype>& box)
makePointSampler(const BoundingBox<ctype>& bbox)
{
using Sampler = BoxPointSampler<ctype, Traits>;
return Sampler( typename Traits::DistributionBase1(box.xMin(), box.xMax()),
typename Traits::DistributionBase2(box.yMin(), box.yMax()),
typename Traits::DistributionBase3(box.zMin(), box.zMax()) );
return Sampler( typename Traits::DistributionBase1(bbox.xMin(), bbox.xMax()),
typename Traits::DistributionBase2(bbox.yMin(), bbox.yMax()),
typename Traits::DistributionBase3(bbox.zMin(), bbox.zMax()) );
}
/*!
* \ingroup Sampling
* \brief Overload of the free function to create point
* samplers for boxes.
* \todo TODO: Once Box class is made more generic, this
* should be adapted.
*/
template< class Traits, class ctype >
BoxPointSampler< ctype, Traits >
makePointSampler(const Box<ctype>& box)
{ return makePointSampler<Traits>(BoundingBox<ctype>(box)); }
} // end namespace Frackit
#endif // FRACKIT_MAKE_POINT_SAMPLER_HH
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment