geom/sample: Use correct grammar in comments.

This commit is contained in:
Danny Robson 2018-11-19 15:41:55 +11:00
parent 210c963d9f
commit 1dcb20fb53

View File

@ -20,12 +20,12 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
namespace cruft::geom { namespace cruft::geom {
/// a function object that selects a uniformly random point inside a shape /// A function object that selects a uniformly random point inside a shape
/// using a provided random generator. the point will lie within the shape, /// using a provided random generator. The point will lie within the shape,
/// inclusive of boundaries. /// inclusive of boundaries.
/// ///
/// may be specialised for arbitrary shapes but uses rejection sampling /// May be specialised for arbitrary shapes but uses rejection sampling
/// as a safe default. this implies that execution may not take a constant /// as a safe default. This implies that execution may not take a constant
/// time. /// time.
template <typename ShapeT> template <typename ShapeT>
struct sampler { struct sampler {
@ -47,7 +47,7 @@ namespace cruft::geom {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/// a convenience function that calls sample::fn to select a random point /// A convenience function that calls sample::fn to select a random point
/// in a provided shape. /// in a provided shape.
template < template <
typename ShapeT, typename ShapeT,
@ -60,15 +60,18 @@ namespace cruft::geom {
} }
///////////////////////////////////////////////////////////////////////////
std::vector<cruft::point2f> std::vector<cruft::point2f>
poisson_sample (cruft::extent2i, float distance, int samples); poisson_sample (cruft::extent2i, float distance, int samples);
///////////////////////////////////////////////////////////////////////////
namespace surface { namespace surface {
// a generator of samples that lie on the surface of a shape /// A generator of samples that lie on the surface of a shape
template <typename ShapeT> template <typename ShapeT>
class sampler; class sampler;
template <typename ShapeT> template <typename ShapeT>
sampler (ShapeT const&) -> sampler<std::decay_t<ShapeT>>; sampler (ShapeT const&) -> sampler<std::decay_t<ShapeT>>;
@ -97,13 +100,15 @@ namespace cruft::geom {
cruft::extent<S,T> target; cruft::extent<S,T> target;
}; };
/// approximate a poisson disc sampling through mitchell's best candidate.
/// Approximate a poisson disc sampling through the "Mitchell's Best
/// Candidate" algorithm.
/// ///
/// try to keep adding a new point to a set. each new point is the /// Try to keep adding a new point to a set. Each new point is the
/// best of a set of candidates. the 'best' is the point that is /// best of a set of candidates. The 'best' is the point that is
/// furthest from all selected points. /// furthest from all selected points.
/// ///
/// \return a vector of the computed points /// \return A vector of the computed points
template <typename SamplerT, typename DistanceT, typename GeneratorT> template <typename SamplerT, typename DistanceT, typename GeneratorT>
auto auto
poisson (SamplerT const &target, poisson (SamplerT const &target,